News for hackers. Stuff that matters.
Re:Trine – A utility library for functional programming in J... by the_mitsuhiko on Thursday June 11, 2015 @10:06AM (#9699767)
> They're both (subjectively) wrong: the natural place for data in JS is the this parameter.

... said the person not understanding the language semantics.

Passing arbitrary data as this is a terrible idea. It has to be an object and as such all primitives end up boxed.

Re:Trine – A utility library for functional programming in J... by inglor on Thursday June 11, 2015 @10:28AM (#9699896)
Not in strict mode... `(function(){ console.log(typeof this); })(5);` try in sloppy and strict mode - remember modules are strict mode by default.
Re:Trine – A utility library for functional programming in J... by codecurve on Thursday June 11, 2015 @11:36AM (#9700320)
(function double() { return this * 2; }).call(2) === 4

I didn't have to box anything to pass a primitive as this. Maybe some other versions are different, but this works in Chrome 40 and Firefox 33.

Re:Trine – A utility library for functional programming in J... by implicit on Thursday June 11, 2015 @12:36PM (#9700704)
Are you sure?

    > function isboxed() { return this instanceof Number; }
    > isboxed.call(5);
    true
Re:Trine – A utility library for functional programming in J... by CrossEye on Thursday June 11, 2015 @04:28PM (#9702166)
as inglor said, this depends on strict mode:

    > var isboxed = (function() {"use strict"; return function isboxed() {return this instanceof Number;}}());
    > isboxed.call(5);
    false