lvalue - rvalue problem

2013-01-27 Thread Namespace
The following code prints: /home/c494/c719.d(27): Error: (Vec2!(float) __ctmp1173 = _D4c71911__T4Vec2TfZ4Vec26__initZ; , __ctmp1173).this(4F, 2F) is not an lvalue [code] import std.stdio; struct Vec2(T) { public: T x; T y; this(T x, T y) { }

Re: lvalue - rvalue problem

2013-01-27 Thread Dicebot
Looks like a bug in function overload selection.

Re: lvalue - rvalue problem

2013-01-27 Thread Namespace
On Sunday, 27 January 2013 at 11:42:29 UTC, Dicebot wrote: Looks like a bug in function overload selection. I hope not! That would be really bad. That is part of my solution as long as auto ref isn't there. :D

Re: hasDataMember and mixin inconsistency

2013-01-27 Thread Olivier Grant
On Sunday, 27 January 2013 at 09:49:33 UTC, Philippe Sigaud wrote: Hi, If think in your code, your testing whether or a not a mixin(...) statement is valid D. Which it is. But what I'm surprised by is that the behavior of hasDataMember with my implementation works fine for all test cases

Re: lvalue - rvalue problem

2013-01-27 Thread Namespace
Same with this code: http://dpaste.1azy.net/2c98fe95 But there I found no workaround. This works: new C(cast(A) new B(), FloatRect(0, 1, 2, 3)); But that is ugly. o.O I think you are right and it is a bug in function overload selection. :(

Re: hasDataMember and mixin inconsistency

2013-01-27 Thread Artur Skawina
On 01/27/13 12:47, Olivier Grant wrote: On Sunday, 27 January 2013 at 09:49:33 UTC, Philippe Sigaud wrote: You cannot write to .init, it's not a member. It's a built-in property, like .sizeof or .offsetof. Makes sense. It does, but apparently the compiler disagrees. 2) Is there a better

Re: hasDataMember and mixin inconsistency

2013-01-27 Thread Philippe Sigaud
I'd put the mixin externally: template hasDataMember( T, string M ) { mixin( enum hasDataMember = __traits( compiles, ( ref T x, ref T y ){ x. ~ M ~ = y. ~ M ~ ; } );); } I've just tried that and it unfortunately does not work, the same test case still fails.

Re: lvalue - rvalue problem

2013-01-27 Thread Namespace
Ok, I will open a bug report for this.

Re: two mains

2013-01-27 Thread Vladimir Panteleev
On Saturday, 26 January 2013 at 20:42:27 UTC, Tyro[17] wrote: So why do we need to mov RBP, RSP in [2] but not in [1]? I'm thinking this is because RBP contains the address of args but not sure. The x64 calling convention passes the first few arguments via registers. I think it's most likely

try to compile githubs dmd-master zip with vstudio 2010

2013-01-27 Thread dennis luehring
i've grabbed the dmd-master.zip from github an opended the dmd_msc_vs10.sln but i get 3 errors C:\Test\dmd-master\src\mars.c wants missing include verstr.h C:\Test\dmd-master\src\c1xx missing ph.h C:\Test\dmd-master\src\c1xx missing util.c what else is needed to build from source this way?

Re: try to compile githubs dmd-master zip with vstudio 2010

2013-01-27 Thread Namespace
I had the same problem, few days ago. I wrote this short make script [1] which works for me. My solution is that you must clean before, call the vs buildme and then build again with the normal make file. Sounds weird but it works (for me). [1] makefile: set DM_HOME=D:\D cd dmd cd src make

Re: two mains

2013-01-27 Thread David Nadlinger
On Saturday, 26 January 2013 at 20:42:27 UTC, Tyro[17] wrote: Trying to learn from the ground up and would appreciate some assistance making sense of the following: // void main(){} [1] [...] This might not be directly relevant here, but in general, I'd steer clear of main() for such

Re: try to compile githubs dmd-master zip with vstudio 2010

2013-01-27 Thread dennis luehring
and if i want to use the solution file? Am 27.01.2013 14:45, schrieb Namespace: I had the same problem, few days ago. I wrote this short make script [1] which works for me. My solution is that you must clean before, call the vs buildme and then build again with the normal make file. Sounds

Re: two mains

2013-01-27 Thread David Nadlinger
On Saturday, 26 January 2013 at 20:57:54 UTC, Tyro[17] wrote: On 1/26/13 3:42 PM, Tyro[17] wrote: The second is the use of leave in [2]. If I understand correctly, leave is the exact same as: movRBP,RSP popRBP So why do we need to mov RBP, RSP in [2] but not in [1]?

Re: Why is null lowercase?

2013-01-27 Thread Phil Lavoie
DO YOU PREFER A LANGUAGE ALL IN UPPERCASE? Hahahaha! I find it ugly too. I prefer lowercaps null, as in Java.

Re: Why is null lowercase?

2013-01-27 Thread Phil Lavoie
On Friday, 25 January 2013 at 16:11:57 UTC, Maxim Fomin wrote: On Friday, 25 January 2013 at 14:22:20 UTC, Don wrote: On Friday, 25 January 2013 at 01:17:44 UTC, Ali Çehreli wrote: On 01/24/2013 12:42 PM, Matthew Caron wrote: for not null checks if ( ptr !is null) ... And too much perl

Re: hasDataMember and mixin inconsistency

2013-01-27 Thread Olivier Grant
On Sunday, 27 January 2013 at 12:58:39 UTC, Philippe Sigaud wrote: I'd put the mixin externally: template hasDataMember( T, string M ) { mixin( enum hasDataMember = __traits( compiles, ( ref T x, ref T y ){ x. ~ M ~ = y. ~ M ~ ; } );); } I've just tried that and it

Re: hasDataMember and mixin inconsistency

2013-01-27 Thread Philippe Sigaud
string hasDataMember( T )(string M ) { return __traits(compiles, { Test t; auto _ = t.D; // reading t.M t. ~ M ~ = t. ~ M ~ ; // assign to t.M }); } What is the purpose of auto _ = t.D; ? Just testing whether t.M can be assigned to something (ie, is it

Re: endless loop with ref and non-ref parameter

2013-01-27 Thread Namespace
no match match with im­plicit con­ver­sions match with con­ver­sion to const exact match Explain me, why this code prints: Error: A() is not an lvalue [code] import std.stdio; struct A { } void foo(A a, float r) { } void foo(const A a, float r) { } void foo(ref A a, float r) {

Re: endless loop with ref and non-ref parameter

2013-01-27 Thread Namespace
pull request - bug report. I'm a bit confused today.

Tutorial on how to build DMD/druntime/phobos and docs from source?

2013-01-27 Thread Chad Joan
I remember there being a tutorial on how to build DMD and such from source. I've been searching for a while and can't find it. It won't show up on google searches. Does anyone have a link? Right now I'm most interested in a tutorial on how to build the docs. Thanks.

Re: Tutorial on how to build DMD/druntime/phobos and docs from source?

2013-01-27 Thread H. S. Teoh
On Sun, Jan 27, 2013 at 04:13:08PM -0500, Chad Joan wrote: I remember there being a tutorial on how to build DMD and such from source. I've been searching for a while and can't find it. It won't show up on google searches. Does anyone have a link? http://wiki.dlang.org/Building_DMD Right

Re: two mains

2013-01-27 Thread Tyro[17]
On 1/27/13 8:57 AM, David Nadlinger wrote: On Saturday, 26 January 2013 at 20:42:27 UTC, Tyro[17] wrote: Trying to learn from the ground up and would appreciate some assistance making sense of the following: // void main(){} [1] [...] This might not be directly relevant here, but in general,

Re: lvalue - rvalue problem

2013-01-27 Thread Jonathan M Davis
On Sunday, January 27, 2013 12:42:28 Dicebot wrote: Looks like a bug in function overload selection. Definitely. - Jonathan M Davis

Re: lvalue - rvalue problem

2013-01-27 Thread Namespace
On Sunday, 27 January 2013 at 23:05:16 UTC, Jonathan M Davis wrote: On Sunday, January 27, 2013 12:42:28 Dicebot wrote: Looks like a bug in function overload selection. Definitely. - Jonathan M Davis And that prevents a workaround for the missing auto ref. :o) It seems dmd 2.060 is far

Delegate type inferred as pure

2013-01-27 Thread cal
This fails: void main() { int z; typeof((int a){return z;}) dg; dg = (int a) {return z;}; } Error: cannot implicitly convert expression (__lambda2) of type int delegate(int a) nothrow @safe to int delegate(int a) pure nothrow @safe But I can't make the delegate pure: dg = (int

Re: Tutorial on how to build DMD/druntime/phobos and docs from source?

2013-01-27 Thread Chad Joan
On 01/27/2013 04:34 PM, H. S. Teoh wrote: On Sun, Jan 27, 2013 at 04:13:08PM -0500, Chad Joan wrote: I remember there being a tutorial on how to build DMD and such from source. I've been searching for a while and can't find it. It won't show up on google searches. Does anyone have a link?