View mode: basic / threaded / horizontal-split · Log in · Help
December 29, 2009
Tuples, C#, Java, language design
C# will probably not follow the route of stagnation of Java for some more time, thanks to Mono too. I don't like that string interpolation syntax because it looks unsafe, and that design of tuples can be improved, but they are listening to programmes (even if they risk creating a mudball language):
http://www.infoq.com/news/2009/12/Mono-CSharp-Ex

More on those tuples:
http://tirania.org/blog/archive/2009/Dec-23.html

Eventually it will be quite useful to have some very well designed multi-return support in D (like those tuples, but better).

Bye,
bearophile
December 29, 2009
Re: Tuples, C#, Java, language design
bearophile Wrote:

> C# will probably not follow the route of stagnation of Java for some more time, thanks to Mono too. I don't like that string interpolation syntax because it looks unsafe, and that design of tuples can be improved, but they are listening to programmes (even if they risk creating a mudball language):
> http://www.infoq.com/news/2009/12/Mono-CSharp-Ex
> 
> More on those tuples:
> http://tirania.org/blog/archive/2009/Dec-23.html
> 
> Eventually it will be quite useful to have some very well designed multi-return support in D (like those tuples, but better).

Doesn't D2 already have tuples in Phobos. D has the comma operator which C# doesn't so such syntax is not possible in D, me thinks.
December 29, 2009
Re: Tuples, C#, Java, language design
justme wrote:
> bearophile Wrote:
> 
>> C# will probably not follow the route of stagnation of Java for some more time, thanks to Mono too. I don't like that string interpolation syntax because it looks unsafe, and that design of tuples can be improved, but they are listening to programmes (even if they risk creating a mudball language):
>> http://www.infoq.com/news/2009/12/Mono-CSharp-Ex
>>
>> More on those tuples:
>> http://tirania.org/blog/archive/2009/Dec-23.html
>>
>> Eventually it will be quite useful to have some very well designed multi-return support in D (like those tuples, but better).
> 
> Doesn't D2 already have tuples in Phobos. D has the comma operator which C# doesn't so such syntax is not possible in D, me thinks.

But tuples in D really suck. Compared to other languages, D tuples feel 
inflexible, stiff, and complicated.
December 29, 2009
Re: Tuples, C#, Java, language design
grauzone Wrote:

> justme wrote:
> > bearophile Wrote:
> > 
> >> C# will probably not follow the route of stagnation of Java for some more time, thanks to Mono too. I don't like that string interpolation syntax because it looks unsafe, and that design of tuples can be improved, but they are listening to programmes (even if they risk creating a mudball language):
> >> http://www.infoq.com/news/2009/12/Mono-CSharp-Ex
> >>
> >> More on those tuples:
> >> http://tirania.org/blog/archive/2009/Dec-23.html
> >>
> >> Eventually it will be quite useful to have some very well designed multi-return support in D (like those tuples, but better).
> > 
> > Doesn't D2 already have tuples in Phobos. D has the comma operator which C# doesn't so such syntax is not possible in D, me thinks.
> 
> But tuples in D really suck. Compared to other languages, D tuples feel 
> inflexible, stiff, and complicated.

The burden of proving your claims is still there. Isn't D meritocracy - nobody listens your opinions unless you post compiler / stdlib patches. I believe the Phobos tuple classes are sufficient until a better system arrives in D3 or D4. D2 book is almost finished so you need to write your patches against D3 now.
December 29, 2009
Re: Tuples, C#, Java, language design
justme wrote:
> grauzone Wrote:
> 
>> justme wrote:
>>> bearophile Wrote:
>>>
>>>> C# will probably not follow the route of stagnation of Java for some more time, thanks to Mono too. I don't like that string interpolation syntax because it looks unsafe, and that design of tuples can be improved, but they are listening to programmes (even if they risk creating a mudball language):
>>>> http://www.infoq.com/news/2009/12/Mono-CSharp-Ex
>>>>
>>>> More on those tuples:
>>>> http://tirania.org/blog/archive/2009/Dec-23.html
>>>>
>>>> Eventually it will be quite useful to have some very well designed multi-return support in D (like those tuples, but better).
>>> Doesn't D2 already have tuples in Phobos. D has the comma operator which C# doesn't so such syntax is not possible in D, me thinks.
>> But tuples in D really suck. Compared to other languages, D tuples feel 
>> inflexible, stiff, and complicated.
> 
> The burden of proving your claims is still there. Isn't D meritocracy - nobody listens your opinions unless you post compiler / stdlib patches. I believe the Phobos tuple classes are sufficient until a better system arrives in D3 or D4. D2 book is almost finished so you need to write your patches against D3 now.

My experience with patches is, that they're mostly either ignored or 
rejected. I guess the chance of an unrequested patch changing a core 
language feature in crucial ways is 200%. Walter doesn't listen to 
anyone anyway *g*.

The downsides of D tuples has been often mentioned, e.g. here: 
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=98953
(Sorry, I'm not as eloquent as language_fan to write it up myself, plus 
nobody would read it.)
December 29, 2009
Re: Tuples, C#, Java, language design
grauzone wrote:
> justme wrote:
>> grauzone Wrote:
>>
>>> justme wrote:
>>>> bearophile Wrote:
>>>>
>>>>> C# will probably not follow the route of stagnation of Java for 
>>>>> some more time, thanks to Mono too. I don't like that string 
>>>>> interpolation syntax because it looks unsafe, and that design of 
>>>>> tuples can be improved, but they are listening to programmes (even 
>>>>> if they risk creating a mudball language):
>>>>> http://www.infoq.com/news/2009/12/Mono-CSharp-Ex
>>>>>
>>>>> More on those tuples:
>>>>> http://tirania.org/blog/archive/2009/Dec-23.html
>>>>>
>>>>> Eventually it will be quite useful to have some very well designed 
>>>>> multi-return support in D (like those tuples, but better).
>>>> Doesn't D2 already have tuples in Phobos. D has the comma operator 
>>>> which C# doesn't so such syntax is not possible in D, me thinks.
>>> But tuples in D really suck. Compared to other languages, D tuples 
>>> feel inflexible, stiff, and complicated.
>>
>> The burden of proving your claims is still there. Isn't D meritocracy 
>> - nobody listens your opinions unless you post compiler / stdlib 
>> patches. I believe the Phobos tuple classes are sufficient until a 
>> better system arrives in D3 or D4. D2 book is almost finished so you 
>> need to write your patches against D3 now.
> 
> My experience with patches is, that they're mostly either ignored or 
> rejected. I guess the chance of an unrequested patch changing a core 
> language feature in crucial ways is 200%. Walter doesn't listen to 
> anyone anyway *g*.
> 
> The downsides of D tuples has been often mentioned, e.g. here: 
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=98953 

That was incomplete. You have to compare the code examples with the D 
version: 
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=98947

> (Sorry, I'm not as eloquent as language_fan to write it up myself, plus 
> nobody would read it.)
December 30, 2009
Comma expression as tuple operator [was Tuples, C#, Java, language design]
Hello justme,

> bearophile Wrote:
> 
>> C# will probably not follow the route of stagnation of Java for some
>> more time, thanks to Mono too. I don't like that string interpolation
>> syntax because it looks unsafe, and that design of tuples can be
>> improved, but they are listening to programmes (even if they risk
>> creating a mudball language):
>> 
>> http://www.infoq.com/news/2009/12/Mono-CSharp-Ex
>> 
>> More on those tuples:
>> http://tirania.org/blog/archive/2009/Dec-23.html
>> Eventually it will be quite useful to have some very well designed
>> multi-return support in D (like those tuples, but better).
>> 
> Doesn't D2 already have tuples in Phobos. D has the comma operator
> which C# doesn't so such syntax is not possible in D, me thinks.
> 

A though on the comma operator: if the comma operator were defined to give 
a tuple type and be implicitly castable to any suffix of it's self, then 
you could get both the comma expression usage that Walter wants as well as 
all the fun things that tuple expressions give.

int i = 1, j = 2;

(i, j) = (j, i); // swap

i = (j+= i, i*2 + j); // first expression gets evaluated and dropped.

Thoughts?
December 30, 2009
Re: Comma expression as tuple operator [was Tuples, C#, Java, language design]
BCS wrote:
> Hello justme,
> 
>> bearophile Wrote:
>>
>>> C# will probably not follow the route of stagnation of Java for some
>>> more time, thanks to Mono too. I don't like that string interpolation
>>> syntax because it looks unsafe, and that design of tuples can be
>>> improved, but they are listening to programmes (even if they risk
>>> creating a mudball language):
>>>
>>> http://www.infoq.com/news/2009/12/Mono-CSharp-Ex
>>>
>>> More on those tuples:
>>> http://tirania.org/blog/archive/2009/Dec-23.html
>>> Eventually it will be quite useful to have some very well designed
>>> multi-return support in D (like those tuples, but better).
>>>
>> Doesn't D2 already have tuples in Phobos. D has the comma operator
>> which C# doesn't so such syntax is not possible in D, me thinks.
>>
> 
> A though on the comma operator: if the comma operator were defined to 
> give a tuple type and be implicitly castable to any suffix of it's self, 
> then you could get both the comma expression usage that Walter wants as 
> well as all the fun things that tuple expressions give.
> 
> int i = 1, j = 2;
> 
> (i, j) = (j, i); // swap
> 
> i = (j+= i, i*2 + j); // first expression gets evaluated and dropped.
> 
> Thoughts?

Why not make the programmer write tuple[$-1] instead?

i = (j += i, i*2 + j)[$-1];

There's no reason to keep the current comma operator.

>
December 30, 2009
Re: Comma expression as tuple operator [was Tuples, C#, Java, languagedesign]
Hello grauzone,

> BCS wrote:
> 
>> Hello justme,
>> 
>>> bearophile Wrote:
>>> 
>>>> C# will probably not follow the route of stagnation of Java for
>>>> some more time, thanks to Mono too. I don't like that string
>>>> interpolation syntax because it looks unsafe, and that design of
>>>> tuples can be improved, but they are listening to programmes (even
>>>> if they risk creating a mudball language):
>>>> 
>>>> http://www.infoq.com/news/2009/12/Mono-CSharp-Ex
>>>> 
>>>> More on those tuples:
>>>> http://tirania.org/blog/archive/2009/Dec-23.html
>>>> Eventually it will be quite useful to have some very well designed
>>>> multi-return support in D (like those tuples, but better).
>>> Doesn't D2 already have tuples in Phobos. D has the comma operator
>>> which C# doesn't so such syntax is not possible in D, me thinks.
>>> 
>> A though on the comma operator: if the comma operator were defined to
>> give a tuple type and be implicitly castable to any suffix of it's
>> self, then you could get both the comma expression usage that Walter
>> wants as well as all the fun things that tuple expressions give.
>> 
>> int i = 1, j = 2;
>> 
>> (i, j) = (j, i); // swap
>> 
>> i = (j+= i, i*2 + j); // first expression gets evaluated and dropped.
>> 
>> Thoughts?
>> 
> Why not make the programmer write tuple[$-1] instead?
> 
> i = (j += i, i*2 + j)[$-1];
> 
> There's no reason to keep the current comma operator.
> 

Frankly, while I have no problem with it, I'd also be fine with dumping the 
comma operator all together, even making the [$-1] thing illegal ("code has 
no effect" and all that) but Walter has time and again shot down anything 
that does away with the comma operator so I was looking at it as a way to 
have my cake and eat it to.
December 30, 2009
Re: Comma expression as tuple operator [was Tuples, C#, Java, language design]
BCS:
> A though on the comma operator: if the comma operator were defined to give 
> a tuple type and be implicitly castable to any suffix of it's self, then 
> you could get both the comma expression usage that Walter wants as well as 
> all the fun things that tuple expressions give.

D2 has enough warts now, so it's much better to not add some more. Languages must be tidy, when possible. It's often better to not have a feature that having a dirty one.

Bye,
bearophile
« First   ‹ Prev
1 2
Top | Discussion index | About this forum | D home