[Issue 11988] Add __switch symbol to allow retrieval of switch statement value
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jan 24 18:12:55 PST 2014
https://d.puremagic.com/issues/show_bug.cgi?id=11988
yebblies <yebblies at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |yebblies at gmail.com
--- Comment #3 from yebblies <yebblies at gmail.com> 2014-01-25 13:12:50 EST ---
(In reply to comment #2)
> (In reply to comment #1)
> > Why don't we just allow `auto var = <expression>`, like in an if-statement?
>
> Because they would have different semantics. The if statement's body is not
> entered when the expression implicitly converts to false, e.g.:
>
> [snip]
>
> So you'd end up with different semantics.
Who would expect 'if' and 'switch' to have the same semantics?
I don't think this is worth adding a magic symbol (nested switch statements?)
but switch(auto a = b) solves this quite nicely.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list