Re: Multi-assign

new topic     » goto parent     » topic index » view thread      » older message » newer message
mattlewis said...

For 4.1, I started working on multiple assignment. Basically, it would look like this:

{ x, y } = { 1, "foo" } 
 
{ $, x } = value( y ) 

It's really syntactic sugar, but can make some code a lot easier to read. My implementation currently uses dollar signs to ignore values. There's been some concern on the dev list that this might be confusing, so I'd like to get feedback from the wider community.

Does a dollar make sense? Should we use a different symbol? Should we just put extra commas in?

For those interested, the code is currently in the 'multi-assign' branch in the Mercurial repo.

Matt

I don't really understand what multiple assignment is; but if you use a dollar sign in a sequence could it be confused with the last position of a sequence for example: seq[1..$]

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu