--
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lua-l+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/lua-l/db9f0360-79d2-45b8-b8a6-86121985a619n%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "lua-l" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lua-l/BgNg4MkCOg0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lua-l+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/lua-l/CAN5FJ7cN3_Av-3jAHF%2BW4-2%3DGX0ij8ucpu3ypcXogRsr9%3DMqOg%40mail.gmail.com.
> Nothing is changes in the generated bytecode (except possibly with additional meta-data for retrospection of functions. The compiler would just do the trick to pass enough nil values in the call stack, but should then detect possible duplicate parameter...This would require the compiler to be tracking types,
This would require the compiler to be tracking types,
Absolutely NO.
... the compiled code of the function should expose in metadata a mapping from names to parameters number
--
You received this message because you are subscribed to a topic in the Google Groups "lua-l" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lua-l/BgNg4MkCOg0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lua-l+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/lua-l/CAGa7JC3kCZnP3Bf0A4GuCFkm%2B9Se1JEPDajxfqj%2ByMwgUW45Ug%40mail.gmail.com.
--
You received this message because you are subscribed to a topic in the Google Groups "lua-l" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lua-l/BgNg4MkCOg0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lua-l+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/lua-l/CAD55k3r0FGD0vjpXwDkvApkey7dDnOH1QE5s-%2B6nZvzd29DdrQ%40mail.gmail.com.
I strongly agree with the sentiment.
Lua does not need "named parameters". If you want named
parameters, use a table.
There is no need to introduce another language concept which is
just a crippled form of tables.
What I love about Lua is that it avoids such unnecessary language
complexities.
(And if a case was to be made for fragmenting "table-like"
concepts, the most important distinction would probably be lists
vs maps; and after that probably maps vs structs with a fixed set
of members.)
There are many advantages to passing a table. To name just one,
you can easily and cheaply pass it on to another function.
Probably quite a few scripting languages that have named
parameters eventually ended up using some kind of hash map to be
able to satisfy the demand for a variable number of them.
The assertion that "passing a table needs to have significant
cost" has been proven wrong by LuaJIT's allocation sinking
optimization [1].
I strongly encourage you to give it a shot. For a very simple
example, I get the exact same performance and machine code.
And as others have said already, if you want peak performance on a
hot path, might have to just use normal parameters after
profiling.
Such is the nature of a scripting language: You can not expect abstractions to be zero cost - at least not in a relatively simple interpreted implementation.
On the plus side, everything can be wonderfully simple,
reflectable and flexible.
Kind regards,
Lars
[1]:
https://github.com/tarantool/tarantool/wiki/LuaJIT-Allocation-Sinking-Optimization
To view this discussion visit https://groups.google.com/d/msgid/lua-l/CALW7ahxhokV8iSP-WF63ES%3DVoF_GY2RrxC-KVZToFA40n4rEcA%40mail.gmail.com.