3 ms·
JavaScript got better while I wasn't looking (2017)
- olliej 7y agoMy honest favorite is the use of destructuring object parameters so you effectively get named parameters. I find it super nice, especially in the absence of a first class enum system.
- tybit 7y agoOne of the few features I miss when going back to other languages. e.g C# 7's destructuring is good, but it's no where near as powerful and ubiquitous as JavaScripts.
- cglong 7y agoNeeds a "(2017)" tag
- dang 7y agoAdded. Thanks!
- wruza 7y ago>Lua doesn’t need a special case here, since it uses an iterator protocol that produces values rather than mutating a visible state variable, so there’s no problem with having the loop variable be truly distinct on each run through the loop. Lua works the same way, every iteration has different ‘i’ in iterative version of for loop: local fs = { } for i = 1, 5 do table.insert(fs, function () print(i) end) end for i,f in ipairs(fs) do f() end -- 1 2 3 4 5 What Lua lacks is a will of its authors to add real-life features like (de)structuring, __[gs]et, multi-spread, quick lambda syntax, generic classlib, generic byte buffers, etc. Read FRs in mailing list before any release for details. It is a DIY in C kit, but how long do you DIY until it’s annoying? As a long-time Lua 5.1/2 user who likes it, I must admit that with all js quirks and lacks js is simply more practical and that’s what matters.
- SyrupThinker 7y agoWhat behaviors do you wish for __get and __set that aren't covered by __index and __newindex? EDIT: I just realized you want to overload assignment and reading of the table variable, so this doesn't apply.
- bionhoward 7y agoShout out to Ramda, my favorite functional programming module for JS. I find modern JavaScript pretty fun to hack on https://ramdajs.com/docs/ https://ramdajs.com/docs/ https://github.com/ramda/ramda/wiki/Cookbook https://github.com/ramda/ramda/wiki/Cookbook https://ramdajs.com/repl/ https://ramdajs.com/repl/