• Create Account

### #Actualpatrrr

Posted 07 August 2013 - 02:00 AM

Yes, that's precisely what I mean. In most other languages, the assignment operator is a statement (i.e. it doesn't result in a value at all, and you can't use it in a conditional).

Only in C/C++ can you write such monstrosities as:

if ( (y += 12)/5 > 10) { /*...*/ }

Though, without assignment as a value you wouldn't have this beautiful pattern:

while (char *line = read(...)) {
...
}


It's pretty much poor man's Maybe and I sorely miss it in Java.

### #3patrrr

Posted 07 August 2013 - 01:58 AM

Yes, that's precisely what I mean. In most other languages, the assignment operator is a statement (i.e. it doesn't result in a value at all, and you can't use it in a conditional).

Only in C/C++ can you write such monstrosities as:

if ( (y += 12)/5 > 10) { /*...*/ }

Though, without assignment as a statement you wouldn't have this beautiful pattern:

while (char *line = read(...)) {
...
}


It's pretty much poor man's Maybe and I sorely miss it in Java.

### #2patrrr

Posted 07 August 2013 - 01:56 AM

Yes, that's precisely what I mean. In most other languages, the assignment operator is a statement (i.e. it doesn't result in a value at all, and you can't use it in a conditional).

Only in C/C++ can you write such monstrosities as:

if ( (y += 12)/5 > 10) { /*...*/ }

Though, without assignment as a statement, you wouldn't have this beautiful pattern:

while (char *line = read(...)) {
...
}


It's pretty much poor man's Maybe and I sorely miss it in Java.

### #1patrrr

Posted 07 August 2013 - 01:55 AM

Yes, that's precisely what I mean. In most other languages, the assignment operator is a statement (i.e. it doesn't result in a value at all, and you can't use it in a conditional).

Only in C/C++ can you write such monstrosities as:

if ( (y += 12)/5 > 10) { /*...*/ }

Though, without assignment as a statement, you wouldn't have this beautiful pattern:

while (char *line = read(...)) {
...
}


It's pretty much poor man's Maybe and I sorely miss it in Java.

PARTNERS