On 07/05/2012 21:27, Nick Sabalausky wrote:
snip
I'm usually fairly ambivalent about the idea of statements being
expressions, but I would *love* for switch to be usable as an expression.
snip
Switch cases are sequences of statements. Allowing them to alternatively be expressions
would
David Piepgrass:
Or how about:
auto area = {
auto tmp = foo.bar(baz);
tmp.width * tmp.height;
}
Rust is like that, but I don't see it as a significant
improvement.
I also wish void were a first-class type with sizeof==0 for
maximum efficiency:
int[void] intSet = [2:(),
I'm usually fairly ambivalent about the idea of statements
being
expressions, but I would *love* for switch to be usable as an
expression.
For instance, in Haxe, you can do stuff like the following,
which I get a
ton of use out of and often wish D had:
a = switch(b)
{
case 1: foo;
int[void] intSet = [2:(), 3:(), 4:()]
oops, void[int] intSet = [2:(), 3:(), 4:()] rather.
On 07/05/2012 18:06, deadalnix wrote:
Hi,
Working on D I noticed that some statement, notably assert, are expression of
type void.
Why not all statement (that are not expression already) are expression ?
Because it wouldn't make sense.
The semantic of an ExpressionStatement is to evaluate
Le 07/05/2012 19:06, deadalnix a écrit :
Hi,
Working on D I noticed that some statement, notably assert, are
expression of type void. Why not all statement (that are not expression
already) are expression ?
I want to pop this question.
This is an important one. And nothing is documented
Le 09/05/2012 14:11, Stewart Gordon a écrit :
On 07/05/2012 18:06, deadalnix wrote:
Hi,
Working on D I noticed that some statement, notably assert, are
expression of type void.
Why not all statement (that are not expression already) are expression ?
Because it wouldn't make sense.
The
On 2012-05-07 22:37, deadalnix wrote:
This won't work anyway. We are talking about language grammar here. If
made expression, statement would be of type void. Just like assert is.
Says who? :)
--
/Jacob Carlborg
On 07/05/12 19:06, deadalnix wrote:
Hi,
Working on D I noticed that some statement, notably assert, are
expression of type void. Why not all statement (that are not expression
already) are expression ?
assert isn't a statement. It's an expression ( same as is() ). What
makes you think it's a
On 05/08/2012 10:46 AM, Don Clugston wrote:
On 07/05/12 19:06, deadalnix wrote:
Hi,
Working on D I noticed that some statement, notably assert, are
expression of type void. Why not all statement (that are not expression
already) are expression ?
assert isn't a statement. It's an expression (
On Tuesday, 8 May 2012 at 18:30:08 UTC, Timon Gehr wrote:
On 05/08/2012 10:46 AM, Don Clugston wrote:
On 07/05/12 19:06, deadalnix wrote:
Hi,
Working on D I noticed that some statement, notably assert,
are
expression of type void. Why not all statement (that are not
expression
already) are
Hi,
Working on D I noticed that some statement, notably assert, are
expression of type void. Why not all statement (that are not expression
already) are expression ?
Le 07/05/2012 22:27, Nick Sabalausky a écrit :
Jacob Carlborgd...@me.com wrote in message
news:jo98d1$frl$1...@digitalmars.com...
On 2012-05-07 19:06, deadalnix wrote:
Hi,
Working on D I noticed that some statement, notably assert, are
expression of type void. Why not all statement (that are
deadalnix deadal...@gmail.com wrote in message
news:jo9be0$mgh$1...@digitalmars.com...
This won't work anyway. We are talking about language grammar here. If
made expression, statement would be of type void. Just like assert is.
The question is why assert is an expression ? Why not other
14 matches
Mail list logo