News for hackers. Stuff that matters.
Re:Lambda School leaked documents show poor performance over... by kace91 on Monday October 25, 2021 @01:45PM (#28990838)
Why not teach them functional concepts (map, filter, reduce, etc are well supported and comfortable) and leave the horrors of Js classes alone?
Re:Lambda School leaked documents show poor performance over... by sam0x17 on Monday October 25, 2021 @02:04PM (#28991086)
They run into enough problems with objectness just learning map / filter / reduce. I've seen so many angry / frustrated students trying to use a for each loop to iterate over an Array only to find that although this works in most languages, in js these just loop over the fucking KEYS of the object (which now opens up the discussion about how `obj[1]` is not a key but `obj['hey']` is a key and the differences therein.
Re:Lambda School leaked documents show poor performance over... by skrebbel on Monday October 25, 2021 @02:38PM (#28991473)
I wonder if there would be a market for a "stricter mode" version of JavaScript that simply does not allow you to use the legacy features that are so quirky.

Eg just disallow for...in to be used at all (but allow for...of)

No iterating over objects except via eg Object.entries

No inheriting objects from other objects (ie no prototypal inheritance)

No var

No anonymous functions (ie only named function declarations or lambda/fat-arrow expressions, to avoid `this` binding gotchas)

Etc

I think the only real big blocker to a thing like this is that it'd need tooling (eg a transpiler that injects error throws at appropriate places), and tooling is another big hairy thing that makes JS less approachable for beginners.

Re:Lambda School leaked documents show poor performance over... by sam0x17 on Tuesday October 26, 2021 @03:29AM (#28997415)
> I wonder if there would be a market for a "stricter mode" version of JavaScript that simply does not allow you to use the legacy features that are so quirky.

It's almost like we could use a better frontend language. Too bad there isn't some magical universal assembly language supported by all major browsers we could use as a launchpad for such a thing ;)

Re:Lambda School leaked documents show poor performance over... by threatofrain on Monday October 25, 2021 @03:54PM (#28992310)
That's something which can be done at build time, such as through a linter.
Re:Lambda School leaked documents show poor performance over... by skrebbel on Monday October 25, 2021 @04:40PM (#28992846)
Some of it would need to be runtime checks to be fully consistent and unsurprising, I think.
Re:Lambda School leaked documents show poor performance over... by abecedarius on Monday October 25, 2021 @03:14PM (#28991879)
I haven't tried it, but somewhere in that neighborhood: https://github.com/endojs/Jessie
Re:Lambda School leaked documents show poor performance over... by enahs-sf on Monday October 25, 2021 @09:12PM (#28995256)
these should be expert mode only features that have to be unlocked as opposed to default. So easy to shoot yourself in the foot. Kinda fun if you've been doing it for a while though.
Re:Lambda School leaked documents show poor performance over... by woah on Monday October 25, 2021 @02:28PM (#28991357)
Kind of crazy that nobody taught them to use "for of" instead of "for in". Maybe make a linter that marks "for in" as a syntax error