Thread overview
Re: Another syntactic under-performer
Oct 14, 2008
ore-sama
Oct 14, 2008
Bill Baxter
Oct 14, 2008
ore-sama
Oct 14, 2008
Bill Baxter
Oct 14, 2008
Bill Baxter
Oct 14, 2008
ore-sama
Oct 14, 2008
Bill Baxter
October 14, 2008
Bill Baxter Wrote:

> I've seen a few
> interesting proposals that wanted to use colons but which ran into
> troubles with ambiguity vs goto and switch labels.   But switch case
> labels are already inside a syntactically distinct structure, so it
> should be easy to change them to just about any syntax.

there was interesting proposal for if-style case statement, which gives real structure to switch statement! http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=77141
October 14, 2008
On Tue, Oct 14, 2008 at 4:59 PM, ore-sama <spam@here.lot> wrote:
> Bill Baxter Wrote:
>
>> I've seen a few
>> interesting proposals that wanted to use colons but which ran into
>> troubles with ambiguity vs goto and switch labels.   But switch case
>> labels are already inside a syntactically distinct structure, so it
>> should be easy to change them to just about any syntax.
>
> there was interesting proposal for if-style case statement, which gives real structure to switch statement! http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=77141
>

I saw the thread.   Like some others, I didn't really get the need for
that particular change.
I'd give it another look right now, but unfortunately links to that
web-news interface don't work right. :-(  That link goes to an
unrelated discussion.

--bb
October 14, 2008
Bill Baxter Wrote:

> > http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=77141
> >
> 
> I saw the thread.   Like some others, I didn't really get the need for
> that particular change.
> I'd give it another look right now, but unfortunately links to that
> web-news interface don't work right. :-(  That link goes to an
> unrelated discussion.
> 
> --bb

script has problem with art_group parameter, edit it manually to hold real group name:
art_group=digitalmars.D
art_group=digitalmars.D.announce
art_group=digitalmars.D.learn
October 14, 2008
On Tue, Oct 14, 2008 at 5:19 PM, ore-sama <spam@here.lot> wrote:
> Bill Baxter Wrote:
>
>> > http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=77141
>> >
>>
>> I saw the thread.   Like some others, I didn't really get the need for
>> that particular change.
>> I'd give it another look right now, but unfortunately links to that
>> web-news interface don't work right. :-(  That link goes to an
>> unrelated discussion.
>>
>> --bb
>
> script has problem with art_group parameter, edit it manually to hold real group name:
> art_group=digitalmars.D
> art_group=digitalmars.D.announce
> art_group=digitalmars.D.learn

Oh wait.. that was the right post.  It was just #4 out of 4 points. Sorry I just missed it.

--bb
October 14, 2008
On Tue, Oct 14, 2008 at 5:25 PM, Bill Baxter <wbaxter@gmail.com> wrote:
> On Tue, Oct 14, 2008 at 5:19 PM, ore-sama <spam@here.lot> wrote:
>> Bill Baxter Wrote:
>>
>>> > http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=77141
>>> >
>>>
>>> I saw the thread.   Like some others, I didn't really get the need for
>>> that particular change.
>>> I'd give it another look right now, but unfortunately links to that
>>> web-news interface don't work right. :-(  That link goes to an
>>> unrelated discussion.
>>>
>>> --bb
>>
>> script has problem with art_group parameter, edit it manually to hold real group name:
>> art_group=digitalmars.D
>> art_group=digitalmars.D.announce
>> art_group=digitalmars.D.learn
>
> Oh wait.. that was the right post.  It was just #4 out of 4 points. Sorry I just missed it.

The proposal was this:

"""
4. Replace C-style switch with something modern and more D-like:

switch (x)
{
    case (0) foo();
    case (1)
    {
        bar();
        baz();
    }
    else throw new Exception("nope");
}
"""

The question is why?  Replacing syntax just to look "more modern" is not a good justification for breaking everyone's code.

But if you have the goal of freeing up the colon for bigger and better things, I suppose that doesn't seem like a bad syntax.   I don't think it would kill the Duff's device, either.  It's just a different syntax for the current switch.


Excuse me now.. while I "free up my colon for bigger and better things".

--bb
October 14, 2008
Bill Baxter Wrote:

> It's just a different syntax for the current switch.

as it was noted, current case is just a type of label. In this proposal case is a scope statement like if.
October 14, 2008
On Tue, Oct 14, 2008 at 6:05 PM, ore-sama <spam@here.lot> wrote:
> Bill Baxter Wrote:
>
>> It's just a different syntax for the current switch.
>
> as it was noted, current case is just a type of label. In this proposal case is a scope statement like if.

Ah, I see.  Well, it's really a different goal than this thread in that case.  But very similar syntax could be used with current switch semantics to help free up the colon.

--bb