switch case for constants-only?

retard re at tard.com.invalid
Tue Dec 8 07:59:04 PST 2009


Sat, 05 Dec 2009 20:03:28 -0500, Nick Sabalausky wrote:

> "grauzone" <none at example.net> wrote in message
> news:hfeu6p$1apu$1 at digitalmars.com...
>> Nick Sabalausky wrote:
>>> "Ellery Newcomer" <ellery-newcomer at utulsa.edu> wrote in message
>>>> It's a useful divergence. It's a feature that should exist. But I
>>>> contend it makes more sense to make a new construct which *is*
>>>> equivalent to a certain pattern of nested ifs (switch isn't) and
>>>> incorporate your feature into that than to shoehorn it into switch.
>>>
>>> I definitely agree we need a new switch that isn't so stuck in C-land.
>>> And if we got it, I'd be perfectly happy to restrict all the new stuff
>>> to the newer switch and just let C-style switch atrophy into oblivion.
>>> But a new switch just doesn't seem to be happening :(.
>>
>> You'd still need to keep around the old switch for stuff like Duff's
>> Device. But I agree that it'd be nice to have a new switch for the
>> following reasons: could use pattern matching instead of just a list of
>> values, no redundant "case", no fallthrough by default, allow a more
>> functional programming style.
> 
> I have to admit, I'm so jealous of what I've seen of Nemerle's pattern
> matching (and it's metaprogramming), that I've been tempted to to give a
> shot at switching to it for things that don't strickly need system-level
> capabilities.

I sense words of heresy! TBH pattern matching is pretty nice. But given 
the amount of time we have left before D2 is out, I don't really expect 
anything to change anymore. D3 might not be ever released if D2 fails. 
And I somehow can't see the D community embracing the functional 
programming paradigm.



More information about the Digitalmars-d mailing list