April 06, 2014
Walter Bright, el  5 de April a las 21:15 me escribiste:
> On 4/5/2014 6:28 PM, Leandro Lucarella wrote:
> >Walter Bright, el  5 de April a las 11:04 me escribiste:
> >>Of course, you can hide all this in a template.
> >
> >Well, you can "emulate" enums as they are now with structs too, so that doesn't change anything in the argument about why to provide syntax sugar for one and not the other.
> 
> 
> The argument for syntactic sugar is it must show a very large benefit over using a template.
> 
> Having special syntax for everything makes the language unusable.

What I mean is the current semantics of enum are as they are for historical reasons, not because they make (more) sense (than other possibilities). You showed a lot of examples that makes sense only because you are used to the current semantics, not because they are the only option or the option that makes the most sense.

Is it better to redesign enum semantics now? Probably not, but I'm just saying :)

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
El techo de mi cuarto lleno de cometas
April 06, 2014
Walter Bright:

> Having special syntax for everything makes the language unusable.

While there are ways to reach excesses in every design direction, and make things unusable, the risk discussed here seems remote to me.

So do you have an example of this risk? Or examples of languages that have fallen in this trap? Perhaps Ada?

Bye,
bearophile
April 06, 2014
On 4/6/14, 3:31 AM, Leandro Lucarella wrote:
> What I mean is the current semantics of enum are as they are for
> historical reasons, not because they make (more) sense (than other
> possibilities). You showed a lot of examples that makes sense only
> because you are used to the current semantics, not because they are the
> only option or the option that makes the most sense.
>
> Is it better to redesign enum semantics now? Probably not, but I'm just
> saying :)

I fully agree. In my opinion, too, the enum design in D is suboptimal.

Andrei

April 06, 2014
On 4/6/2014 3:31 AM, Leandro Lucarella wrote:
> What I mean is the current semantics of enum are as they are for
> historical reasons, not because they make (more) sense (than other
> possibilities). You showed a lot of examples that makes sense only
> because you are used to the current semantics, not because they are the
> only option or the option that makes the most sense.

I use enums a lot in D. I find they work very satisfactorily. The way they work was deliberately designed, not a historical accident.

April 06, 2014
On 4/6/2014 4:26 AM, bearophile wrote:
> So do you have an example of this risk?

Algol is a rather famous one.

A counterexample is Go, which has gotten a lot of traction with a simple syntax.
April 06, 2014
On Sunday, 6 April 2014 at 16:46:12 UTC, Andrei Alexandrescu wrote:
> On 4/6/14, 3:31 AM, Leandro Lucarella wrote:
>> What I mean is the current semantics of enum are as they are for
>> historical reasons, not because they make (more) sense (than other
>> possibilities). You showed a lot of examples that makes sense only
>> because you are used to the current semantics, not because they are the
>> only option or the option that makes the most sense.
>>
>> Is it better to redesign enum semantics now? Probably not, but I'm just
>> saying :)
>
> I fully agree. In my opinion, too, the enum design in D is suboptimal.
>
> Andrei

Hey bearophile - I rest my case...

-Eric
April 06, 2014
On Sunday, 6 April 2014 at 11:26:41 UTC, bearophile wrote:
> Walter Bright:
>> Having special syntax for everything makes the language unusable.
>
> While there are ways to reach excesses in every design direction, and make things unusable, the risk discussed here seems remote to me.

Too much syntax diversity for almost the same things leads to a language that is harder to learn, but I think readability has little to do with special syntax, but rather how it is done and how frequently used those constructs are.

You can get syntax diversity with simple formal syntax too. Lisp code often shows signs of this.  D and C++ show signs of this with overuse of templates. I find template heavy code to be very poor in terms of readability and well designed special syntax would have been much better in terms of usability.

April 06, 2014
Am 06.04.2014 19:54, schrieb Walter Bright:
> On 4/6/2014 4:26 AM, bearophile wrote:
>> So do you have an example of this risk?
>
> Algol is a rather famous one.
>
> A counterexample is Go, which has gotten a lot of traction with a simple
> syntax.

It has more to do with Google than with the language's design.
April 06, 2014
On Sunday, 6 April 2014 at 17:52:19 UTC, Walter Bright wrote:
> On 4/6/2014 3:31 AM, Leandro Lucarella wrote:
>> What I mean is the current semantics of enum are as they are for
>> historical reasons, not because they make (more) sense (than other
>> possibilities). You showed a lot of examples that makes sense only
>> because you are used to the current semantics, not because they are the
>> only option or the option that makes the most sense.
>
> I use enums a lot in D. I find they work very satisfactorily. The way they work was deliberately designed, not a historical accident.

The fact that you are unaware of how it's properly done (hint: Pascal got right with 'set of enum' being distinct from 'enum') makes it a historical accident.
April 06, 2014
On 4/6/2014 2:26 PM, Araq wrote:
> The fact that you are unaware of how it's properly done (hint: Pascal got right
> with 'set of enum' being distinct from 'enum') makes it a historical accident.

I wrote a Pascal compiler before the C one.