Re: getters and setters not an lvalue

2012-10-31 Thread Andrej Mitrovic
On 10/31/12, Adam D. Ruppe destructiona...@gmail.com wrote: On Wednesday, 31 October 2012 at 22:46:17 UTC, Andrej Mitrovic wrote: I wonder if this is low-hanging fruit to implement in the DMD frontend. I tried it and found getting almost there is easy... but getting it to work in a bunch

Re: not an lvalue

2011-05-02 Thread Steven Schveighoffer
in my matrix class: If I do this I get an error: Matrix33 mtest = new Matrix33(); mtest.SetIdentity(); Vector3 test1 = new Vector3(0, 0, 0); Vector3 test2 = test + mtest.GetColumn(2); I get the error Error: mtest.GetColumn(x) is not an lvalue But the following works: Matrix33 mtest = new

not an lvalue

2011-05-01 Thread CrypticMetaphor
(); mtest.SetIdentity(); Vector3 test1 = new Vector3(0, 0, 0); Vector3 test2 = test + mtest.GetColumn(2); I get the error Error: mtest.GetColumn(x) is not an lvalue But the following works: Matrix33 mtest = new Matrix33(); mtest.SetIdentity(); Vector3 test1 = new Vector3(0, 0, 0); Vector3 temp

Re: not an lvalue

2011-05-01 Thread Peter Alexander
: Matrix33 mtest = new Matrix33(); mtest.SetIdentity(); Vector3 test1 = new Vector3(0, 0, 0); Vector3 test2 = test + mtest.GetColumn(2); I get the error Error: mtest.GetColumn(x) is not an lvalue But the following works: Matrix33 mtest = new Matrix33(); mtest.SetIdentity(); Vector3 test1 = new

Re: not an lvalue

2011-05-01 Thread Dmitry Olshansky
an error: Matrix33 mtest = new Matrix33(); mtest.SetIdentity(); Vector3 test1 = new Vector3(0, 0, 0); Vector3 test2 = test + mtest.GetColumn(2); I get the error Error: mtest.GetColumn(x) is not an lvalue But the following works: Matrix33 mtest = new Matrix33(); mtest.SetIdentity(); Vector3 test1 = new

Re: not an lvalue

2011-05-01 Thread CrypticMetaphor
On 5/1/2011 3:53 PM, Dmitry Olshansky wrote: Ehm.. Well, first things first: you shouldn't use classes for lightweight plain data things like vectors. There are structs for that. In general, structs are value-like objects living on the stack while classes are reference-like objects living on

Re: not an lvalue

2011-05-01 Thread Peter Alexander
On 1/05/11 2:53 PM, Dmitry Olshansky wrote: Ehm.. Well, first things first: you shouldn't use classes for lightweight plain data things like vectors. There are structs for that. In general, structs are value-like objects living on the stack while classes are reference-like objects living on the

Re: not an lvalue

2011-05-01 Thread Dmitry Olshansky
On 01.05.2011 19:31, Peter Alexander wrote: On 1/05/11 2:53 PM, Dmitry Olshansky wrote: Ehm.. Well, first things first: you shouldn't use classes for lightweight plain data things like vectors. There are structs for that. In general, structs are value-like objects living on the stack while

Re: lvalue method

2010-10-13 Thread BCS
Hello Benjamin, Am 08.10.2010 11:13, schrieb Lars T. Kyllingstad: On Fri, 08 Oct 2010 09:33:22 +0200, Benjamin Thaut wrote: Hi, I'm writing a vec4 math struct and I have a method of which the return value has to be a lvalue so I wonder which is the correct way to do this: vec4 Normalize

lvalue method

2010-10-08 Thread Benjamin Thaut
Hi, I'm writing a vec4 math struct and I have a method of which the return value has to be a lvalue so I wonder which is the correct way to do this: vec4 Normalize() const { ... } //won't work, not a lvalue ref vec4 Normalize() const { vec4 temp; ... return temp; } //will this lead

Re: lvalue method

2010-10-08 Thread Stanislav Blinov
Benjamin Thaut wrote: Hi, I'm writing a vec4 math struct and I have a method of which the return value has to be a lvalue so I wonder which is the correct way to do this: vec4 Normalize() const { ... } //won't work, not a lvalue ref vec4 Normalize() const { vec4 temp; ... return temp

Re: lvalue method

2010-10-08 Thread Simen kjaeraas
Benjamin Thaut c...@benjamin-thaut.de wrote: Hi, I'm writing a vec4 math struct and I have a method of which the return value has to be a lvalue so I wonder which is the correct way to do this: vec4 Normalize() const { ... } //won't work, not a lvalue ref vec4 Normalize() const { vec4

Re: lvalue method

2010-10-08 Thread Lars T. Kyllingstad
On Fri, 08 Oct 2010 09:33:22 +0200, Benjamin Thaut wrote: Hi, I'm writing a vec4 math struct and I have a method of which the return value has to be a lvalue so I wonder which is the correct way to do this: vec4 Normalize() const { ... } //won't work, not a lvalue ref vec4 Normalize

Re: lvalue method

2010-10-08 Thread Steven Schveighoffer
On Fri, 08 Oct 2010 09:26:19 -0400, Benjamin Thaut c...@benjamin-thaut.de wrote: Am 08.10.2010 11:13, schrieb Lars T. Kyllingstad: On Fri, 08 Oct 2010 09:33:22 +0200, Benjamin Thaut wrote: Hi, I'm writing a vec4 math struct and I have a method of which the return value has to be a lvalue

Re: lvalue method

2010-10-08 Thread Simen kjaeraas
Steven Schveighoffer schvei...@yahoo.com wrote: The correct way is to use auto ref as the parameter: struct vec4 { ... vec4 Normalize(auto ref const(vec4) param) {...} } But AFAIK, this doesn't really work. It doesn't, no. I'm not even sure it's scheduled for inclusion. Also, with

Re: lvalue method

2010-10-08 Thread Steven Schveighoffer
On Fri, 08 Oct 2010 09:51:59 -0400, Simen kjaeraas simen.kja...@gmail.com wrote: Steven Schveighoffer schvei...@yahoo.com wrote: The correct way is to use auto ref as the parameter: struct vec4 { ... vec4 Normalize(auto ref const(vec4) param) {...} } But AFAIK, this doesn't really

Re: Error: constant false is not an lvalue

2009-08-31 Thread Don
Rainer Deyke wrote: Jarrett Billingsley wrote: Members are always initialized to the default initializer for their type, which is usually 0 for integer types and NAN for floating point types. This eliminates an entire class of obscure problems that come from neglecting to initialize a member

Re: Error: constant false is not an lvalue

2009-08-31 Thread Manfred_Nowak
Steven Schveighoffer wrote: What is i referencing when you call: foo(); Is this an argument for making int j; void foo(ref int i = j); foo(): legal D? -manfred

Re: Error: constant false is not an lvalue

2009-08-31 Thread Steven Schveighoffer
On Mon, 31 Aug 2009 13:00:34 -0400, Manfred_Nowak svv1...@hotmail.com wrote: Steven Schveighoffer wrote: What is i referencing when you call: foo(); Is this an argument for making int j; void foo(ref int i = j); foo(): legal D? No, I'm just trying to explain why having a

Re: Error: constant false is not an lvalue

2009-08-31 Thread Steven Schveighoffer
On Mon, 31 Aug 2009 14:55:43 -0400, Steven Schveighoffer schvei...@yahoo.com wrote: It's possible that something like what you wrote could work (although I'd write it foo(ref int i = j)). In fact, it does work, in D1 no less. # cat testme.d import tango.io.Stdout; int j; void foo(ref

Re: Error: constant false is not an lvalue

2009-08-30 Thread Rainer Deyke
Jarrett Billingsley wrote: Although teeechnically speaking that would be illegal code. The D spec says that it's not legal to use the value of uninitialized variables. Default initialization is kind of a poor man's substitute for actual flow control which determines that. By relying on

Re: Error: constant false is not an lvalue

2009-08-30 Thread Jarrett Billingsley
On Sun, Aug 30, 2009 at 5:34 AM, Rainer Deykerain...@eldwood.com wrote: Jarrett Billingsley wrote: Although teeechnically speaking that would be illegal code. The D spec says that it's not legal to use the value of uninitialized variables. Default initialization is kind of a poor man's

Re: Error: constant false is not an lvalue

2009-08-30 Thread Jarrett Billingsley
On Sun, Aug 30, 2009 at 7:13 AM, grauzonen...@example.net wrote: Although teeechnically speaking that would be illegal code. The D spec says that it's not legal to use the value of uninitialized variables. Default initialization is kind of a poor man's substitute for actual flow control

Re: Error: constant false is not an lvalue

2009-08-30 Thread Ellery Newcomer
Steven Schveighoffer wrote: On Sat, 29 Aug 2009 20:15:55 -0400, Ellery Newcomer ellery-newco...@utulsa.edu wrote: void blah(out bool a = false){ // blah blah blah } compile time use of blah results in error. Am I doing anything wrong? out implies a reference. You can't have a

Re: Error: constant false is not an lvalue

2009-08-30 Thread Jarrett Billingsley
On Sun, Aug 30, 2009 at 3:14 PM, Jarrett Billingsleyjarrett.billings...@gmail.com wrote: On Sun, Aug 30, 2009 at 3:02 PM, Rainer Deykerain...@eldwood.com wrote: The purpose of default initialization is not to find or reduce bugs, but to reduce the size of legal programs. I'm wondering where

Re: Error: constant false is not an lvalue

2009-08-30 Thread Rainer Deyke
Jarrett Billingsley wrote: On Sun, Aug 30, 2009 at 3:02 PM, Rainer Deykerain...@eldwood.com wrote: The purpose of default initialization is not to find or reduce bugs, but to reduce the size of legal programs. I'm wondering where the heck you got that justification. By looking at the actual

Re: Error: constant false is not an lvalue

2009-08-30 Thread Rainer Deyke
Jarrett Billingsley wrote: Members are always initialized to the default initializer for their type, which is usually 0 for integer types and NAN for floating point types. This eliminates an entire class of obscure problems that come from neglecting to initialize a member in one of the

Re: Error: constant false is not an lvalue

2009-08-29 Thread Jarrett Billingsley
On Sun, Aug 30, 2009 at 12:24 AM, Ary Borenszweiga...@esperanto.org.ar wrote: Steven Schveighoffer escribió: On Sat, 29 Aug 2009 20:15:55 -0400, Ellery Newcomer ellery-newco...@utulsa.edu wrote: void blah(out bool a = false){  // blah blah blah } compile time use of blah results in

Re: lvalue - opIndexAssign - Tango

2009-03-15 Thread downs
The Anh Tran wrote: Hi, When porting from c++ to D, i encounter this strange discrimination: 1. Built-in AA: int[int] arr; arr[123] += 12345; arr[321]++; 2. Tango HashMap: auto hm = new HashMap!(int, int)(); hm[123] += 12345; // error not lvalue hm[123

Re: lvalue - opIndexAssign - Tango

2009-03-14 Thread The Anh Tran
Daniel Keep wrote: You could try the Tango IRC channel: That, or the Tango forums: http://dsource.org/projects/tango/forums You can report problems with Tango via the ticket system: http://dsource.org/projects/tango/report (New Ticket is down the bottom of the page.) I tried to register. But

lvalue - opIndexAssign - Tango

2009-03-13 Thread The Anh Tran
Hi, When porting from c++ to D, i encounter this strange discrimination: 1. Built-in AA: int[int] arr; arr[123] += 12345; arr[321]++; 2. Tango HashMap: auto hm = new HashMap!(int, int)(); hm[123] += 12345; // error not lvalue hm[123

Re: lvalue - opIndexAssign - Tango

2009-03-13 Thread Daniel Keep
The Anh Tran wrote: Hi, When porting from c++ to D, i encounter this strange discrimination: 1. Built-in AA: int[int] arr; arr[123] += 12345; arr[321]++; 2. Tango HashMap: auto hm = new HashMap!(int, int)(); hm[123] += 12345; // error not lvalue hm[123

Re: lvalue - opIndexAssign - Tango

2009-03-13 Thread Denis Koroskin
)(); hm[123] += 12345; // error not lvalue hm[123]++; // error D document says current opIndexAssign does not work as lvalue. But why can builtin AA can that? How can i copy builtin AA behaviour? -- Forgive my noob, where is the place to ask question, report bug

<    1   2