DIP19: Remove comma operator from D and provision better syntactic support for tuples

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Mon Sep 24 03:20:55 PDT 2012


On Mon, 24 Sep 2012 10:47:38 +0200
"foobar" <foo at bar.com> wrote:
> 
> Nope.
> One of the ways in math to "build" the positive numbers based on 
> set theory is via singletons:
> n := |tuple of empty tuples|
> so "1" is defined as { {} } whereas "0" is simply {}. That does 
> not work with the above suggestion. Now, I realize this is an 
> arguably convoluted math example but it does show that the 
> treating { {} } as {} is limiting the expressive power of tuples.
> 

And int's are limiting compared to mathematical integers. So what?
So ok, maybe this is limiting from a theoretical standpoint. But
practically speaking? I dunno. We're not making tuples to emulate
set theory here, we're just looking for ad-hoc anonymous structs.

Besides, I only said they were logically the same thing, not
mechanically. I'm only suggesting that a one-element tuple be implicitly
convertible to/from the type of its element. So there would likely
still be the different types, it just makes sense that you should be
able to use one as the other.



More information about the Digitalmars-d mailing list