[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Proposal: Trailing comma in function calls
- From: Philipp Janda <siffiejoe@...>
- Date: Thu, 05 Jun 2014 05:14:50 +0200
Am 05.06.2014 05:01 schröbte Coda Highland:
On Wed, Jun 4, 2014 at 7:30 PM, Mike Nelson <email@example.com> wrote:
On 6/4/2014 6:01 PM, Luiz Henrique de Figueiredo wrote:
first,,third = something()
The idiom in these cases would be
first,_,third = something()
Perhaps it'd be helpful to have a second predeclared local named "_",
as a cheap throw-away variable...
Rather like Go, where _ is predeclared for the same purpose (would be
surprised if they didn't get the idea from Lua). What does everyone think
about also outlawing _ as an rvalue, as Go does?
This would firmly establish _ as a throw-away variable, but is it worth the
internal complexity to enforce it? Perhaps the middle way of predeclaring
but not enforcing is best.
The first of Luiz's examples uses _ as an rvalue.
... and if you swap those two examples you will get weird results, so
that would actually be an argument _against_ using `_` as an rvalue (at
least for normal code).
And predeclaring is not really useful. Usually you do
local first,_,third = something()
anyway, and if you predeclare `first` and `third`, you can add `_` to
the list there as well ...