A Discussion of Tuple Syntax

Dicebot public at dicebot.lv
Mon Aug 19 17:36:52 PDT 2013


On Tuesday, 20 August 2013 at 00:28:47 UTC, Meta wrote:
> Yes, changing semantics is a bad thing, which is why I was 
> originally thinking of the tuple syntax as sugar for 
> std.typecons.Tuple. The proposed syntax takes a hit if it is 
> just sugar for the compiler tuples. They will break in some 
> cases when being passed to functions, and will still not be 
> able to be returned from functions.

It is not about sugar. It is about having entity in standard 
library to express concept that is built in into language and 
confusion it creates. Fixing semantics to allow _even more 
auto-expansion_ is a nice possible side effect.

What you ask it is done by Tuple and there is nothing special 
about it - it is a struct, normal value type. One may be 
disappointed with relatively verbose syntax but it is not a real 
issue. But conflating it with built-in possible is simply 
impossible - if you even start thinking about syntax that does 
it, you probably need to re-read all documentation linked in this 
topic on tuple topic.

Of course, we could have changed language in that regard - but 
this is a huge change, so complex that thinking about literal 
syntax is last thing we should do. And it does not seem to have 
much supporters to start with.


More information about the Digitalmars-d mailing list