Better HN
topnewbestaskshowjobs
Log inSign up

nickfargo

26 karma · joined Mar 29, 2011 (15y ago) · 13 submissions

~@G|gh|tw
Submissions

comment 9y ago · link · parent

The term is not merely a recent appropriation. Parametric polymorphism is a concept from functional programming and formal type theory, with application far beyond just JavaScript.

comment 9y ago · link · parent

That's interesting, because I find #() rather less easy to parse compared to (comp) or (partial) for otherwise equivalent expressions.

At a glance I know that (comp f g h) and its flat list of arguments expresses a simple function composition chain. Seeing a #(f (g (h %))) where (comp) will do makes me sift through more parens; more than that though, when (comp) is embraced as convention, a #() is an immediate cue that simple function composition is not what's being expressed, which draws me in necessarily to examine the particular structure of the #() body.

comment 9y ago · link · parent

This is a different notion of polymorphism, yes.

Suggested reading: http://mrale.ph/blog/2015/01/11/whats-up-with-monomorphism.h...

comment 10y ago · link · parent

> just use a closure!

Of course, but that means allocating a closure object per method per instance. When people say they want private variables, they mean they want them available in regular prototype-mounted methods. Proxies are one way ES6 lets you implement that. (Another is to use a WeakMap structure alongside a constructor, where each instance created by the constructor is mapped to a separate object that holds the "private" properties of that instance. Methods close over the WeakMap, but, crucially, are defined once on the constructor's prototype.)

comment 11y ago · link · parent

  ls -l /usr/local/bin/node
  lrwxr-xr-x  1 502  staff  4 Jan 13 20:10 /usr/local/bin/node -> iojs
Is this necessary?

comment 11y ago · link · parent

A generator is an iterator created and returned by a generator function.

comment 12y ago · link · parent

Faster read:

http://en.wikipedia.org/wiki/Chimera_(genetics)#Humans

comment 12y ago · link · parent

People whose opinions of you really matter know that the green boxes don't.

comment 12y ago · link · parent

Referencing C10k implies yes. Threads cost.

comment 12y ago · link · parent

The "looks more pleasant?" test can be valid only between cljs/Om and the CoffeeScript from which the generated JS was compiled.

By presenting Coffee's not-quite-idiomatic JS output as the counterpoint, the otherwise well made argument for Om's pleasantness is weakened.

comment 12y ago · link · parent

Pretty big rush to judgement. Slice off a copy of the arguments if you need them, but

  pall = -> console.log line for line in arguments; return
would have done just fine there.

One can be annoyed by `return` in tail position, or delighted by invocations-as-expressions. But not both. It's ok to choose the latter. :-)

Also, `console.log` is not a fit for map, forEach, et al. Check the parameters.

comment 12y ago · link · parent

And moreover,

    describe 'syntax after upgrading', ->
      it 'should be even meatier', ->
        expect parentheses.required
          .toBe false
Very tidy.

comment 13y ago · link · parent

I have understood “performant” to suggest a soundness of design that causes something to be “fast”. In the context of algorithms, certainly the distinction is blurred, but in other, higher-level contexts, it can be meaningful.