Tuple DIP

rjframe dlang at ryanjframe.com
Sat Jan 13 20:39:09 UTC 2018


On Sat, 13 Jan 2018 19:43:48 +0000, aberba wrote:

> 
> When I raised this feature for D, suggestions on the use of () instead
> of {} got me concerned. All languages that I know to have this feature
> (known as destructuring) use curly braces. Thats what kotlin and
> JavaScript (that I know have support) use. Let's not be Rust that goes
> with different syntax without any technical advantage. curly braces are
> more common (So to speak).
> 
> auto (name, email) = fetchUser();
>     vs
> auto {name, email} = fetchUser();

Python and Pony use (). C++17 uses []. Perhaps D should use <>? [not a 
serious question]

It was hard for me not to use angled brackets for templates when I started 
with D, but now it's second nature. I think you're right, familiarity with 
other languages is important, but it isn't everything.

I'm not sure I like the idea of ever reading `foo((a, b), c);`, but like 
templates, I'd get used to it.


More information about the Digitalmars-d mailing list