HNHacker News
TopNewBestAskShowJobs

Havvy

221 karma · joined April 1, 2014

submissionscomments
Havvy··on Facebook Launches Flow, Static Type Checker for JavaScript
The `new` is used at the call site while invisible at the function declaration.
Havvy··on What Xfinity Internet Data Usage Plans will Comcast be Launching?
Corporatism. There are laws that prevent true capitalistic competition from happening.
Havvy··on Bill to Restrict N.S.A. Data Collection Blocked in Vote by Senate Republicans
Being spied on by your own country is worse than being spied on by other countries. Your own country doesn't have another country between you and it to protect you. Also, other countries will look at the USA and say 'we can do it because they do it', and that just leads to more problems. Eventually you have to say no to spying. It's morally and ethically unacceptable, and we should not tolerate anybody doing it.
Havvy··on Facebook Launches Flow, Static Type Checker for JavaScript
Flow doesn't have any semantic changes from JS, only semantic restrictions. For anything that is not types, Flow defers to JS. Dart defers to it's own specification.
Havvy··on Facebook Launches Flow, Static Type Checker for JavaScript
But `new` is a bad part. Just an optimized bad part... You could replace every usage of it with `var instance = Object.create(Ctor.prototype);` (and change every `this` to `instance` in your code), and actually explicitly return `instance` -- and then never use `new` again. Your code will become more readable to boot, as there is less action at a distance.
Havvy··on Facebook Launches Flow, Static Type Checker for JavaScript
There's Sweet.js if you want macros.
Havvy··on Microsoft takes .NET open source and cross-platform
You really should not be installing dependencies for anything globally. Instead, add them as dev-dependencies and call them in the package.json `scripts` property. The only npm package you really need installed globally is npm itself, and you can almost always let the package manager handle that for you.
Havvy··on Microsoft takes .NET open source and cross-platform
Yes, but Rust is on the final stretch to 1.0 with a finite set of features to be implemented before release. So soon we can get enterprise to look at it.
Havvy··on At Penn, students can get credit for ‘Wasting Time on the Internet’
Yes. I was tired when I wrote that.
Havvy··on An easier way of using polyfills
Well, there's "shim"....
Havvy··on Stop Using Constructors in JS (2012)
Yeah, but that falls under epediaman's "Stop over-engineering. YAGNI!" quote.

If you want the benefits of `new` without exposing your interface, you should totally wrap it.

But if you're going to have boilerplate like that for code that not's performance critical (and most of it is not), why not just go for Object.create() and returning the instance yourself. Less action at a distance.

Havvy··on Stop Using Constructors in JS (2012)
It's not async functions, it's first class functions. Having multiple ways of calling a function doesn't compose. I have enough experience to know where the foot guns are at, but I don't like writing code that has foot guns in them. It's like `null` in Java. "Remember to check for null before using every object". "Remember to use new before every function that instantiates an object.". I'd rather programmers quit creating new classes of errors in languages for 'programmer convenience'.

Object creation has not yet caused my any performance issues, so I've not seen a reason to personally use `new`.

Havvy··on Stop Using Constructors in JS (2012)
A linter to catch the bugs and then go back and fix them is more work than just making it not possible to have the bug exist. Also, the lint you are talking about is based on a typographic convention that you could easily get wrong. For instance, the linter won't catch the bug in this snippet:

``` var yourClass = require('your-class');

var myInstance = yourClass(); ```

Havvy··on Stop Using Constructors in JS (2012)
`new Foo` will always outperform `Object.create(FooProto)`

If I create an interpreter that changes `new Foo` to `$new(Foo)` where $new is a JS function that uses Object.create to do what the `new` operator does in spec (e.g., treat it as syntactic sugar) then it's unlikely that `new Foo` would outperform `Object.create(FooProto)`. Just because the current interpreters are hyperfocusing on `new` doesn't mean they can't make `Object.create` faster in the future.

All requiring `new` does is add an implicit requirement that the name of your function is actually `new X` instead of `X` with the added requirement that all aliases of the function be prefixed with `new `, which is not composable.

Yeah, `new` might be faster than not using it right now, but that's a bug in the interpreters. And for a lot of objects, your inner loop is not going to be in creation.

Havvy··on Game Programming Patterns now available in print and eBook
I also give my thanks. This was very helpful for me at the beginning of the year.
Havvy··on Game Programming Patterns now available in print and eBook
Is there any chance the code snippets translated to other languages, such as Rust (when it hits 1.0) & JavaScript?

I saw that the Command pattern has JS snippets and Prototype talks about JS, but most patterns don't seem to talk about JS.

BTW, JS is a prototypical language wrapped in classical syntax. That syntax exists because of Sun & Java's intervention. I find that using most of the language constructs there lead to more brittle code than writing it yourself. Object.create() might not have been in the language since the beginning, but it's here now, and it's what should be used.

"You don’t see many games where each monster is a unique snowflake, like “sort of halfway between a troll and a goblin with a bit of snake mixed in”."

You don't see many games where that's the case because classical programming makes it hard to do that. Programming with classes makes you think of homogenous classes of stuff, and that leads to homogenous stuff.

Havvy··on Immutable.js – Immutable Data Collections
So, how does this compare to Clojurescript's Mori?
Havvy··on At Penn, students can get credit for ‘Wasting Time on the Internet’
I read Thorough in high school. So it's not that atypical...
Havvy··on Windows 10 will come with a command-line package manager
Sure, but there's no reason for a Windows enhancement to be framed as a Linux vs. Windows thing, except as antagonistic clickbait. As somebody who uses both Windows and Linux, I'm not sad that Windows is becoming more usable. I'm happy - it's one less thing to complain about using Windows.
Havvy··on Emacs 24.4 RC 1
Each lisp varies dramatically in its semantics. Just because emacs is written in e-lisp does not mean it has first class language support for every other lisp. Would you say that vim has first class support for every language with block & statement based languages?
Havvy··on After California decriminalized pot, teen arrest, overdose, dropout rates fell
Pot is only decriminalized for people above a certain age, probably 18. It's still illegal for teenagers.
Havvy··on The Great Robocoin Rip-off: How We Lost $25,000 Buying a Robocoin ATM
On IRC, somebody once put a bug bounty of 2BTC for a geometric problem. I fixed the bug in two hours (including the time it took to look up the geometry formulas...) and did receive the bitcoin. This was at the time that Bitcoin was trending $850 each.

It seems to me though, that due to bitcoin's relative newness and grey market status, you're going to see a lot of scammers and bad businessmen related to it. It's high risk in that sense, and you need to do your research. Give it time, and the bad business practices will be weeded out, and stability will come. This is the pain of early adoption.

Havvy··on Edward Snowden’s Privacy Tips: “Get Rid of Dropbox,” Avoid Facebook and Google
To be honest, he's not looking for privacy for this statement. He's looking for exactly the opposite, so using the thing that doesn't care for privacy doesn't matter for this instance.
Havvy··on Aptly: Owning Your Debian Distribution
What does this give you over using NixOS?
Havvy··on "Open Source is awful in many ways, and people should be aware of this"
Your response is completely off the mark because in many ways "open source" is as much a community as it is a philosophy. Programming is as much a social activity as it is a technical one. You can release open source works, but if you don't use any social platform to distribute it, who's going to find and use it?
Havvy··on A Fresh Look at Rust
Rust 1.0 is supposed to be somewhat minimal, so things like custom operators and monadic syntax are out scope since they can be bolted on in a backwards-incompatible way in future versions. Active patterns would probably also fall under this.

Likewise, having functions have their own private global state is not on the table, and seems to me to actually be unsafe since the function could be called at the same time in two different threads overwriting the operations done to them.

For not warning when returning non-unit values for unit returning functions, a lint could probably help there.

Type inference isn't changing. The rule is that items need to be explicitly declared and expressions are inferred. Closures are expressions while most (all?) functions are items. It's a purposeful limitation on inference based on experience with prior languages.

Havvy··on Apocalypse soon: the scientists preparing for the end times
Anarchy won't cause an apocalypse, just a change in the structure of the ruling class as a new ruling structure is created.

also on the extra terrestrial influence side, there's direct hits by gamma rays that could wipe out Earth in an instant.

Havvy··on [dead]
0.4% from solar is helping by 0.4%. That's 1/250th less burning of fossil fuels than if it wasn't there.
Havvy··on Miss a Payment? Good Luck Moving That Car
That'd be illegal under US gov't. regulations.
Havvy··on The Cargo Cult of Game Mechanics
Overall good article and food for thought, but the last paragraph is a non-sequiter compared to the paragraphs that came before it.
← PreviousPage 3 of 5Next →