
JavaScript got better while I wasn't looking (2017) - fanf2
https://eev.ee/blog/2017/10/07/javascript-got-better-while-i-wasnt-looking/
======
olliej
My 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
One 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.

------
wruza
>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
What 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.

------
cglong
Needs a "(2017)" tag

~~~
dang
Added. Thanks!

