Sat, 09 May 2009 11:43:09 -0500, Andrei Alexandrescu wrote:
If we want to get rid of newID, we'd write:
writeln(dic.length, '\t', word);
dic[word] = dic.length;
by the Python rule, and
writeln(dic.length, '\t', word);
dic[word] = dic.length - 1;
by the
Georg Wrede wrote:
bearophile wrote:
Georg Wrede:
arra[i] = arrb[i++];
arra[i++] = arrb[i];
I'm not sure that such dependences are good code.
By stating a definite order between lvalue and rvalue, you
would actually encourage this kind of code.
I agree that putting such things in code is
Christopher Wright wrote:
Georg Wrede wrote:
bearophile wrote:
Georg Wrede:
arra[i] = arrb[i++];
arra[i++] = arrb[i];
I'm not sure that such dependences are good code.
By stating a definite order between lvalue and rvalue, you
would actually encourage this kind of code.
I agree that
Andrei Alexandrescu wrote:
Christopher Wright wrote:
Georg Wrede wrote:
bearophile wrote:
Georg Wrede:
arra[i] = arrb[i++];
arra[i++] = arrb[i];
I'm not sure that such dependences are good code.
By stating a definite order between lvalue and rvalue, you
would actually encourage this kind of
Georg Wrede:
arra[i] = arrb[i++];
arra[i++] = arrb[i];
I'm not sure that such dependences are good code.
By stating a definite order between lvalue and rvalue, you
would actually encourage this kind of code.
I agree that putting such things in code is bad, but nowadays the solution
adopted
bearophile wrote:
Georg Wrede:
arra[i] = arrb[i++];
arra[i++] = arrb[i];
I'm not sure that such dependences are good code.
By stating a definite order between lvalue and rvalue, you
would actually encourage this kind of code.
I agree that putting such things in code is bad, but nowadays the
Georg Wrede:
If Walter had ulimited time, the of course I'd favor either defining the
precedence, or then enforcing errors on them, and not leaving them
undefined. Or, probably, with Walter's unlimited time, I'd vote for a
system that is the Theoretically Best mix of programming praxis and
bearophile wrote:
Georg Wrede:
arra[i] = arrb[i++];
arra[i++] = arrb[i];
I'm not sure that such dependences are good code.
By stating a definite order between lvalue and rvalue, you
would actually encourage this kind of code.
I agree that putting such things in code is bad, but nowadays the
Jarrett Billingsley wrote:
It's
incredibly rare that I have to assign the same value to multiple
targets, and when I do, the little time I could save by not typing the
second assignment is offset by the increased time it takes me to look
for assignments to a variable when I come back to the
Michiel Helvensteijn wrote:
Jarrett Billingsley wrote:
It's
incredibly rare that I have to assign the same value to multiple
targets, and when I do, the little time I could save by not typing the
second assignment is offset by the increased time it takes me to look
for assignments to a
Well, seems like disambiguation will solve only portability issues.
From performance point of view in order to call
int opIndexAssign(int value, size_t i)
you should fisrt evaluate value, then indexes.
Andrei Alexandrescu wrote:
Consider:
uint fun();
int gun();
...
int[] a = new int[5];
a[fun] = gun;
Which should be evaluated first, fun() or gun()?
arra[i] = arrb[i++];
arra[i++] = arrb[i];
I'm not sure that such dependences are good code.
By stating a definite order between lvalue and
On 2009-05-11 05:49:01 -0400, Georg Wrede georg.wr...@iki.fi said:
Andrei Alexandrescu wrote:
Consider:
uint fun();
int gun();
...
int[] a = new int[5];
a[fun] = gun;
Which should be evaluated first, fun() or gun()?
arra[i] = arrb[i++];
arra[i++] = arrb[i];
I'm not sure that such
On Sat, 09 May 2009 19:15:59 -0400, Derek Parnell de...@psych.ward wrote:
On Sat, 09 May 2009 11:43:09 -0500, Andrei Alexandrescu wrote:
Consider:
uint fun();
int gun();
...
int[] a = new int[5];
a[fun] = gun;
Which should be evaluated first, fun() or gun()? It's a rather arbitrary
On Mon, 11 May 2009 07:34:38 -0400, Steven Schveighoffer
schvei...@yahoo.com wrote:
For example:
mydic[x] = mydic[y] = mydic[z] = mydic.length;
if evaluating right to left, this looks like:
1. calculate mydic.length, store it in register A.
2. lookup mydic[z], if it doesn't exist, add it.
Michel Fortin wrote:
arra[i++] = arrb[j]; // how can the compiler issue an
error for this?
assert( i != j);
-manfred
Consider that mathematically speaking, an array is a function. And an
assignment to an array element actually changes the function.
A[i] = E;
is actually the same as
A = A[E/i];,
where the right-hand side reads: A where i yields E (notation not to be
confused with division). It is formally
Jason House wrote:
Michel Fortin Wrote:
On 2009-05-11 05:49:01 -0400, Georg Wrede georg.wr...@iki.fi said:
Andrei Alexandrescu wrote:
Consider:
uint fun();
int gun();
...
int[] a = new int[5];
a[fun] = gun;
Which should be evaluated first, fun() or gun()?
arra[i] = arrb[i++];
arra[i++]
Steven Schveighoffer wrote:
On Mon, 11 May 2009 08:20:07 -0400, Manfred Nowak svv1...@hotmail.com
wrote:
Michel Fortin wrote:
arra[i++] = arrb[j]; // how can the compiler issue an
error for this?
assert( i != j);
-manfred
That is not a compiler error, it is an
Steven Schveighoffer wrote:
For example:
mydic[x] = mydic[y] = mydic[z] = mydic.length;
I distinctly remember Walter discouraging chained assignments in the
doccs, already in the very early versions of D.
On Mon, 11 May 2009 09:37:56 -0400, Georg Wrede georg.wr...@iki.fi wrote:
Steven Schveighoffer wrote:
For example:
mydic[x] = mydic[y] = mydic[z] = mydic.length;
I distinctly remember Walter discouraging chained assignments in the
doccs, already in the very early versions of D.
On Mon, May 11, 2009 at 11:07 AM, Steven Schveighoffer
schvei...@yahoo.com wrote:
mydic[x] = mydic[y] = mydic[z] = mydic.length;
auto tmp = mydic.length;
mydic[x] = tmp;
mydic[y] = tmp;
mydic[z] = tmp;
???
That sucks. We have to remember, there are reasons why we stopped having to
On Mon, 11 May 2009 11:26:36 -0400, Jarrett Billingsley
jarrett.billings...@gmail.com wrote:
On Mon, May 11, 2009 at 11:07 AM, Steven Schveighoffer
schvei...@yahoo.com wrote:
mydic[x] = mydic[y] = mydic[z] = mydic.length;
auto tmp = mydic.length;
mydic[x] = tmp;
mydic[y] = tmp;
mydic[z]
Andrei Alexandrescu wrote:
Georg Wrede wrote:
Andrei Alexandrescu wrote:
Consider:
uint fun();
int gun();
...
int[] a = new int[5];
a[fun] = gun;
Which should be evaluated first, fun() or gun()?
arra[i] = arrb[i++];
arra[i++] = arrb[i];
I'm not sure that such dependences are good code.
Georg Wrede wrote:
If the programmer has introduced dependencies on the evaluation order,
yes. But if he hasn't, then it will not introduce anything.
If violations could be checked such that invalid code is rejected, your
solution would work.
With
a[fun] = gun;
a rewrite
auto f =
Andrei Alexandrescu wrote:
Georg Wrede wrote:
If the programmer has introduced dependencies on the evaluation order,
yes. But if he hasn't, then it will not introduce anything.
If violations could be checked such that invalid code is rejected, your
solution would work.
With
a[fun] =
Steven Schveighoffer schvei...@yahoo.com wrote in message
news:op.utrtl8x7eav...@steves.networkengines.com...
On Mon, 11 May 2009 09:37:56 -0400, Georg Wrede georg.wr...@iki.fi
wrote:
Steven Schveighoffer wrote:
For example:
mydic[x] = mydic[y] = mydic[z] = mydic.length;
I distinctly
Nick Sabalausky wrote:
I was giving a little bit of thought to assignment chaining the other day.
Unless someone can point out why I'm wrong, I think some of the
functional-style stuff we've been getting into can make assignment
chaining obsolete.
Hypothetical example:
[mydic[x],
Michiel Helvensteijn m.helvensteijn.rem...@gmail.com wrote in message
news:gua0ub$130...@digitalmars.com...
Nick Sabalausky wrote:
I was giving a little bit of thought to assignment chaining the other
day.
Unless someone can point out why I'm wrong, I think some of the
functional-style
On Mon, 11 May 2009 16:03:39 -0400, Nick Sabalausky wrote:
I was giving a little bit of thought to assignment chaining the other day.
Unless someone can point out why I'm wrong, I think some of the
functional-style stuff we've been getting into can make assignment chaining
obsolete.
Nick Sabalausky wrote:
True, that's why I replied again and suggested something like:
[mydic[x], mydic[y], mydic[z]].each = mydic.length;
[[mydic[x], mydic[y], mydic[z]].each].each = mydic.length;
[[[mydic[x], mydic[y], mydic[z]].each].each].each = mydic.length;
mydic[x], mydic[y],
Rainer Deyke rain...@eldwood.com wrote in message
news:guamfi$2b0...@digitalmars.com...
Nick Sabalausky wrote:
True, that's why I replied again and suggested something like:
[mydic[x], mydic[y], mydic[z]].each = mydic.length;
[[mydic[x], mydic[y], mydic[z]].each].each = mydic.length;
Nick Sabalausky wrote:
Rainer Deyke rain...@eldwood.com wrote in message
news:guamfi$2b0...@digitalmars.com...
[[mydic[x], mydic[y], mydic[z]].each].each = mydic.length;
...
I'm not sure what point you're trying to make here, but my idea is that
each would basically be a write-only
On Mon, May 11, 2009 at 11:34 AM, Steven Schveighoffer
schvei...@yahoo.com wrote:
Funny, I vastly prefer the latter to the former. Having more than one
thing happen on one line is very difficult to read after having
written it, for me.
So I take it if you have many function calls, or
Consider:
uint fun();
int gun();
...
int[] a = new int[5];
a[fun] = gun;
Which should be evaluated first, fun() or gun()? It's a rather arbitrary
decision. C/C++ don't even define an order. Python chooses
left-to-right, EXCEPT for assignment, which is right-hand side first.
Lisp and C#
Andrei Alexandrescu schrieb:
Consider:
uint fun();
int gun();
int[] a = new int[5];
a[fun] = gun;
Which should be evaluated first, fun() or gun()? It's a rather arbitrary
decision. C/C++ don't even define an order. Python chooses
left-to-right, EXCEPT for assignment, which is
Frank Benoit wrote:
From my POV, it would be nice if it would be the same as in Java,
because i am porting lots of it to D.
Good point. I searched for that one and found:
http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html
The Java programming language guarantees that
On Sat, May 9, 2009 at 1:52 PM, Andrei Alexandrescu
seewebsiteforem...@erdani.org wrote:
I also searched for the way Perl does it and got a tad disappointed:
http://www.nntp.perl.org/group/perl.perl5.porters/2003/09/msg82032.html
Essentially the order of evaluation in Perl is as arbitrary
Andrei Alexandrescu wrote:
Consider:
uint fun();
int gun();
...
int[] a = new int[5];
a[fun] = gun;
Which should be evaluated first, fun() or gun()? It's a rather arbitrary
decision. C/C++ don't even define an order. Python chooses
left-to-right, EXCEPT for assignment, which is
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote in message
news:gu4bqu$b...@digitalmars.com...
Consider:
uint fun();
int gun();
...
int[] a = new int[5];
a[fun] = gun;
Which should be evaluated first, fun() or gun()? It's a rather arbitrary
decision. C/C++ don't even define an
Andrei Alexandrescu schrieb:
Frank Benoit wrote:
From my POV, it would be nice if it would be the same as in Java,
because i am porting lots of it to D.
Good point. I searched for that one and found:
http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html
The Java
On Sat, 09 May 2009 11:43:09 -0500, Andrei Alexandrescu wrote:
Consider:
uint fun();
int gun();
...
int[] a = new int[5];
a[fun] = gun;
Which should be evaluated first, fun() or gun()? It's a rather arbitrary
decision. C/C++ don't even define an order. Python chooses
left-to-right,
42 matches
Mail list logo