Another syntactic under-performer

Bill Baxter wbaxter at gmail.com
Mon Oct 13 20:28:02 PDT 2008


The colon.  I think this may be another piece of syntax that could be
better used.

In particular its use in goto and switch labels.  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.   And the more
generic labeled statements used for goto targets appear relatively
infrequently (*), so hogging the colon just for those is wasteful.   A
more verbose syntax would work fine for these.  Like maybe a context
keyword on goto:   "goto(label) FINISHED"

With the colon freed up to use in another statement or expression it
could be made part of a lambda syntax or something.

Just a thought.

--bb
(* except in Walter's code  :-P  )



More information about the Digitalmars-d mailing list