## D - x,y,z = 0;

• Juarez Rudsatz (25/25) May 22 2002 Just a new `Sintatic Sugar' :
• Russ Lewis (8/8) May 22 2002 Why not
• Juarez Rudsatz (5/10) May 22 2002 Because...
• anderson (20/29) May 23 2002 Why not make...
• Matthew Wilson (4/36) May 23 2002 This is all hideous.
• anderson (35/90) May 23 2002 I know, I was mainly considering maintanance reasons.
• anderson (27/122) May 23 2002 I just thought of something else that may work even better, but it has a
• anderson (4/22) May 23 2002 Mistake,
• anderson (8/26) May 23 2002 On thing I didn't think of with the current syntax is,
• anderson (22/61) May 24 2002 What was I thinking.
• Russ Lewis (8/11) May 23 2002 This syntax already exists...it is array copy syntax. However, it would
• anderson (7/18) May 23 2002 I'd be good if the comilper was able to pick this up as a special case
• Sean L. Palmer (27/36) May 23 2002 It's a matter of precedence of operators.
• anderson (8/47) May 23 2002 I doesn't necessarily have to be comma if precedence is so important. Ca...
Juarez Rudsatz <juarez correio.com> writes:
```Just a new `Sintatic Sugar' :

int x, y, z;

x, y, z = 0;  // initialize all variables at same time

x = 0; y = 0; z = 0;

x, y, z = veryLowFunctionCalled();

int i;

i = veryLowFunctionCalled();

x = i; y = i; z = i;

// and folowing

int[] a, b, c;

a[], b[3..5], b[6..7], c[x..y] = 0;

x, y, z = 0, 3 , 9 ? 1 : 2;

pros
o	less typing
o	optimization
o	less code height

cons
o	unusual in C*
o	ugly
o	code not so clear

Question, Sugestion, Negatives ?
```
May 22 2002
Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
```Why not
x = y = z = 0;

???

--
The Villagers are Online! villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]
```
May 22 2002
Juarez Rudsatz <juarez correio.com> writes:
```Russ Lewis wrote:

Why not
x = y = z = 0;

???

Because...

int[] a, b, c;

a[], b[3..5], b[6..447], c[x..y] = 0;
```
May 22 2002
"anderson" <anderson firestar.com.au> writes:
```"Juarez Rudsatz" <juarez correio.com> wrote in message
news:3CEC0DB6.FD23A790 correio.com...
Russ Lewis wrote:
Why not
x = y = z = 0;

???

Because...

int[] a, b, c;

a[], b[3..5], b[6..447], c[x..y] = 0;

Why not make...
a[] = b[3..5] = b[6..447] = c[x..y] = 0;
...legal?

Although Parhaps somthing simular to this could be used in comparisons.

if (a == b || a == c || a == d);

to something like,

if ( a == ||(b, c, d) );

if (a == b && a == c && a == d);

to something like,

if ( a == &&(b, c, d) );

So you'd get things like,

if ( a == &&(b, c, d) || e !=  ||(b, c, d));

if ((a == b && a == c && a == d) || (e != b || e != c || e != d));

Or parhaps someone could improve that that syntax.

PS - what does the <<< do.

Further note, I'd be nice if rotate (ie ><) and arithmetic shifts (????)
were also included.
```
May 23 2002
"Matthew Wilson" <mwilson nextgengaming.com> writes:
```This is all hideous.

Verbose does not mean obfuscated, often the reverse.

"anderson" <anderson firestar.com.au> wrote in message
news:aci6ji\$2o8h\$1 digitaldaemon.com...
"Juarez Rudsatz" <juarez correio.com> wrote in message
news:3CEC0DB6.FD23A790 correio.com...
Russ Lewis wrote:
Why not
x = y = z = 0;

???

Because...

int[] a, b, c;

a[], b[3..5], b[6..447], c[x..y] = 0;

Why not make...
a[] = b[3..5] = b[6..447] = c[x..y] = 0;
...legal?

Although Parhaps somthing simular to this could be used in comparisons.

if (a == b || a == c || a == d);

to something like,

if ( a == ||(b, c, d) );

if (a == b && a == c && a == d);

to something like,

if ( a == &&(b, c, d) );

So you'd get things like,

if ( a == &&(b, c, d) || e !=  ||(b, c, d));

if ((a == b && a == c && a == d) || (e != b || e != c || e != d));

Or parhaps someone could improve that that syntax.

PS - what does the <<< do.

Further note, I'd be nice if rotate (ie ><) and arithmetic shifts (????)
were also included.

```
May 23 2002
"anderson" <anderson firestar.com.au> writes:
```"Matthew Wilson" <mwilson nextgengaming.com> wrote in message
news:aci7j9\$2p84\$1 digitaldaemon.com...
This is all hideous.

Verbose does not mean obfuscated, often the reverse.

I know, I was mainly considering maintanance reasons.

ie

if ( a == &&(b, c, d, e));

if ((a == b && a == c && a == d && a == e));

If you had to change a, you'd have to either use find-replace or change it 4
times, which leaves room for more error. Also a complier may be able to take
advantage of the former (but I'm sure most compilers could probably reconise

Also you could do something that would be huge such as

if ( &&(x,y,z) != &&(a,b,c));

if ( x != a && x != b && x != c &&
y != a && y != b && y != c &&
z != a && z != b && z != c)

which would would optimise to,
if (x != y && y != z &&
a != b && b != c &&
c != x)

//Of coarse somthing like,
if ( &&(x,y,z) == &&(a,b,c));

would optimise to,
if (x == y && y == z &&
a == b && b == c &&
c == x)

Which I suppose isn't a huge difference in code, but it would save on manual
optimisation. I wonder if the compiler does that type of optimisation?

PS - As I said before, parhaps the syntax could be change.
ie

if (a == and(b,c,d,e));
if (a == or(b,c,d,e));

because personaly I like "and" and "or" better then "&&" and "||", but then
that would lead to function simularities.

"anderson" <anderson firestar.com.au> wrote in message
news:aci6ji\$2o8h\$1 digitaldaemon.com...
"Juarez Rudsatz" <juarez correio.com> wrote in message
news:3CEC0DB6.FD23A790 correio.com...
Russ Lewis wrote:
Why not
x = y = z = 0;

???

Because...

int[] a, b, c;

a[], b[3..5], b[6..447], c[x..y] = 0;

Why not make...
a[] = b[3..5] = b[6..447] = c[x..y] = 0;
...legal?

Although Parhaps somthing simular to this could be used in comparisons.

if (a == b || a == c || a == d);

to something like,

if ( a == ||(b, c, d) );

if (a == b && a == c && a == d);

to something like,

if ( a == &&(b, c, d) );

So you'd get things like,

if ( a == &&(b, c, d) || e !=  ||(b, c, d));

if ((a == b && a == c && a == d) || (e != b || e != c || e != d));

Or parhaps someone could improve that that syntax.

PS - what does the <<< do.

Further note, I'd be nice if rotate (ie ><) and arithmetic shifts (????)
were also included.

```
May 23 2002
"anderson" <anderson firestar.com.au> writes:
```I just thought of something else that may work even better, but it has a
hitch.

if ( a == &&{b,c,d,e})

So, b,c,d,e get up into an array and then tested

But & is used for reference operator....

Parhaps a space before the array like

if ( a == && {b,c,d,e})

or

if ( a == (&&){b,c,d,e})

or

if ( a == and{b,c,d,e})
if ( a == or{b,c,d,e})
if ( a == zor{b,c,d,e})

and then you could

int b[1000] = {...}

if (a == and b)
if (a == and b[1..20])

Syntax is not quite right, but I think you get the idea.

"anderson" <anderson firestar.com.au> wrote in message
news:acids4\$2ufi\$1 digitaldaemon.com...
"Matthew Wilson" <mwilson nextgengaming.com> wrote in message
news:aci7j9\$2p84\$1 digitaldaemon.com...
This is all hideous.

Verbose does not mean obfuscated, often the reverse.

I know, I was mainly considering maintanance reasons.

ie

if ( a == &&(b, c, d, e));

if ((a == b && a == c && a == d && a == e));

If you had to change a, you'd have to either use find-replace or change it

4
times, which leaves room for more error. Also a complier may be able to

take
advantage of the former (but I'm sure most compilers could probably

reconise

Also you could do something that would be huge such as

if ( &&(x,y,z) != &&(a,b,c));

if ( x != a && x != b && x != c &&
y != a && y != b && y != c &&
z != a && z != b && z != c)

which would would optimise to,
if (x != y && y != z &&
a != b && b != c &&
c != x)

//Of coarse somthing like,
if ( &&(x,y,z) == &&(a,b,c));

would optimise to,
if (x == y && y == z &&
a == b && b == c &&
c == x)

Which I suppose isn't a huge difference in code, but it would save on

manual
optimisation. I wonder if the compiler does that type of optimisation?

PS - As I said before, parhaps the syntax could be change.
ie

if (a == and(b,c,d,e));
if (a == or(b,c,d,e));

because personaly I like "and" and "or" better then "&&" and "||", but

then
that would lead to function simularities.

"anderson" <anderson firestar.com.au> wrote in message
news:aci6ji\$2o8h\$1 digitaldaemon.com...
"Juarez Rudsatz" <juarez correio.com> wrote in message
news:3CEC0DB6.FD23A790 correio.com...
Russ Lewis wrote:
Why not
x = y = z = 0;

???

Because...

int[] a, b, c;

a[], b[3..5], b[6..447], c[x..y] = 0;

Why not make...
a[] = b[3..5] = b[6..447] = c[x..y] = 0;
...legal?

Although Parhaps somthing simular to this could be used in

comparisons.
if (a == b || a == c || a == d);

to something like,

if ( a == ||(b, c, d) );

if (a == b && a == c && a == d);

to something like,

if ( a == &&(b, c, d) );

So you'd get things like,

if ( a == &&(b, c, d) || e !=  ||(b, c, d));

if ((a == b && a == c && a == d) || (e != b || e != c || e != d));

Or parhaps someone could improve that that syntax.

PS - what does the <<< do.

Further note, I'd be nice if rotate (ie ><) and arithmetic shifts

(????)
were also included.

```
May 23 2002
"anderson" <anderson firestar.com.au> writes:
```Mistake,

"anderson" <anderson firestar.com.au> wrote in message
news:ack4a4\$1gkp\$1 digitaldaemon.com...
I just thought of something else that may work even better, but it has a
hitch.

if ( a == &&{b,c,d,e})

So, b,c,d,e get up into an array and then tested

But & is used for reference operator....

Parhaps a space before the array like

if ( a == && {b,c,d,e})

or

if ( a == (&&){b,c,d,e})

or

if ( a == and{b,c,d,e})
if ( a == or{b,c,d,e})
if ( a == zor{b,c,d,e})

if ( a == xor{b,c,d,e})

and then you could

int b[1000] = {...}

if (a == and b)
if (a == and b[1..20])

Syntax is not quite right, but I think you get the idea.

```
May 23 2002
"anderson" <anderson firestar.com.au> writes:
```On thing I didn't think of with the current syntax is,

int a = ...;

if({a} == {d,e,f,g})

which would be like

if(a == && {d,e,f,g})

but that wouldn't do xor or "or".

"anderson" <anderson firestar.com.au> wrote in message
news:ack4a4\$1gkp\$1 digitaldaemon.com...
I just thought of something else that may work even better, but it has a
hitch.

if ( a == &&{b,c,d,e})

So, b,c,d,e get up into an array and then tested

But & is used for reference operator....

Parhaps a space before the array like

if ( a == && {b,c,d,e})

or

if ( a == (&&){b,c,d,e})

or

if ( a == and{b,c,d,e})
if ( a == or{b,c,d,e})
if ( a == xor{b,c,d,e})

and then you could

int b[1000] = {...}

if (a == and b)
if (a == and b[1..20])

Syntax is not quite right, but I think you get the idea.

```
May 23 2002
"anderson" <anderson firestar.com.au> writes:
```"anderson" <anderson firestar.com.au> wrote in message
news:ack5m4\$1i3s\$1 digitaldaemon.com...
On thing I didn't think of with the current syntax is,

int a = ...;

if({a} == {d,e,f,g})

What was I thinking.

It should have been
if({a,a,a,a} == {d,e,f,g})

Which isn't much better at all

but it gave me a further idea.

Parhaps

if (a == {d,e,f,g})

if (a == d && a == e && a == f && a == g)

Which makes && default getting rid of the referencial problem with &&.

if (a == || {d,e,f,g})

if (a == d || a == e || a == f || a == g)

if (a == ^^ {d,e,f,g})

if (a == d ^^ a == e ^^ a == f ^^ a == g)

if (a == | {d,e,f,g})

if (a == d | a == e | a == f | a == g)

and so on

which would be like

if(a == && {d,e,f,g})

but that wouldn't do xor or "or".

"anderson" <anderson firestar.com.au> wrote in message
news:ack4a4\$1gkp\$1 digitaldaemon.com...
I just thought of something else that may work even better, but it has a
hitch.

if ( a == &&{b,c,d,e})

So, b,c,d,e get up into an array and then tested

But & is used for reference operator....

Parhaps a space before the array like

if ( a == && {b,c,d,e})

or

if ( a == (&&){b,c,d,e})

or

if ( a == and{b,c,d,e})
if ( a == or{b,c,d,e})
if ( a == xor{b,c,d,e})

and then you could

int b[1000] = {...}

if (a == and b)
if (a == and b[1..20])

Syntax is not quite right, but I think you get the idea.

```
May 24 2002
Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
```anderson wrote:

Why not make...
a[] = b[3..5] = b[6..447] = c[x..y] = 0;
...legal?

This syntax already exists...it is array copy syntax.  However, it would
fail because the size of the ranges vary.

--
The Villagers are Online! villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]
```
May 23 2002
"anderson" <anderson firestar.com.au> writes:
```I'd be good if the comilper was able to pick this up as a special case
(whenever consts are involved). It  could also be used in comparisons. ie

if (b[3..5] == 0)

if (b[3] == 0 && b[4] == 0 && b[5] == 0)

"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message
news:3CED2563.AFAF2DB1 deming-os.org...
anderson wrote:

Why not make...
a[] = b[3..5] = b[6..447] = c[x..y] = 0;
...legal?

This syntax already exists...it is array copy syntax.  However, it would
fail because the size of the ranges vary.

--
The Villagers are Online! villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]

```
May 23 2002
"Sandor Hojtsy" <hojtsy index.hu> writes:
```"anderson" <anderson firestar.com.au> wrote in message
news:ack3sh\$1g1m\$1 digitaldaemon.com...
I'd be good if the comilper was able to pick this up as a special case
(whenever consts are involved). It  could also be used in comparisons. ie

if (b[3..5] == 0)

if (b[3] == 0 && b[4] == 0 && b[5] == 0)

Wow, that is quite intuitive.
BTW, is it possible to create an unnamed dynamic array by composing it from
elements?
Such as:
a[] = 3 ~ 4 ~ 5;
fn(12 ~ 1);

There are some problems here:
a ~ b should concatenate the arrays not insert them as elements to a bigger
one.
What will be the base type of the array?
So the ~ operator is not quite good in this context. Some other syntactic
sugar?

Yours,
Sandor Hojtsy
```
May 23 2002
"Sean L. Palmer" <seanpalmer earthlink.net> writes:
```It's a matter of precedence of operators.

In C/C++, operator comma is lower precedence than anything.

They're asking for comma to be moved up two notches past the assignment
operators.

I thought Walter was against altering precedence.  I don't care one way or
the other... the new precedence would work too I think and seems to make an
interesting language.  It could feel natural that way.  Would take some
getting used to which is what prompts Walter's reasoning.

A similar change is the one that allows

void Swap(inout Foo a, inout Foo b)
{
Foo temp = a = b = temp;
}

Which language lets you do that?  Lisp or something maybe.  I forget.

Anyway I think Walter wants D to stay closer to its C roots.  I think
sometimes change is a good thing.  D is definitely not going to be 100% C
compatible anyway so code will need ported anyway, it's just one little
thing and if it makes the language easier to work in, I'd say go for it; the
people porting the code are probably doing so not because D is the coolest
thing to port their C++ code to, but because they like working in D and need
to interface to some old code to be productive.   They'll take the time to
interface to it (if they're smart, and so long as it's possible) or port it
(if they're ambitious, or willing to do the nearly impossible, and have

Sean

"Juarez Rudsatz" <juarez correio.com> wrote in message
news:3CEC0DB6.FD23A790 correio.com...
Russ Lewis wrote:
Why not
x = y = z = 0;

???

Because...

int[] a, b, c;

a[], b[3..5], b[6..447], c[x..y] = 0;

```
May 23 2002
"anderson" <anderson firestar.com.au> writes:
```I doesn't necessarily have to be comma if precedence is so important. Can
you think of another neat symbol that would do the task?

"Sean L. Palmer" <seanpalmer earthlink.net> wrote in message
news:aci76p\$2on7\$1 digitaldaemon.com...
It's a matter of precedence of operators.

In C/C++, operator comma is lower precedence than anything.

They're asking for comma to be moved up two notches past the assignment
operators.

I thought Walter was against altering precedence.  I don't care one way or
the other... the new precedence would work too I think and seems to make

an
interesting language.  It could feel natural that way.  Would take some
getting used to which is what prompts Walter's reasoning.

A similar change is the one that allows

void Swap(inout Foo a, inout Foo b)
{
Foo temp = a = b = temp;
}

Which language lets you do that?  Lisp or something maybe.  I forget.

Anyway I think Walter wants D to stay closer to its C roots.  I think
sometimes change is a good thing.  D is definitely not going to be 100% C
compatible anyway so code will need ported anyway, it's just one little
thing and if it makes the language easier to work in, I'd say go for it;

the
people porting the code are probably doing so not because D is the coolest
thing to port their C++ code to, but because they like working in D and

need
to interface to some old code to be productive.   They'll take the time to
interface to it (if they're smart, and so long as it's possible) or port

it
(if they're ambitious, or willing to do the nearly impossible, and have

Sean

"Juarez Rudsatz" <juarez correio.com> wrote in message
news:3CEC0DB6.FD23A790 correio.com...
Russ Lewis wrote:
Why not
x = y = z = 0;

???

Because...

int[] a, b, c;

a[], b[3..5], b[6..447], c[x..y] = 0;

```
May 23 2002