Re: Garbage collector question

2013-05-15 Thread Jonathan M Davis
On Thursday, May 16, 2013 08:08:28 gedaiu wrote: > Does the garbage collector manages the memory from extern(C) > functions, or we have to delete manualy the objects created in > those kind of functions? The GC managase memory allocated with new or with core.memory. That's it. Anything allocated

Re: cannot have overloaded nested functions?

2013-05-15 Thread Jonathan M Davis
On Wednesday, May 15, 2013 20:48:19 Steven Schveighoffer wrote: > On Wed, 15 May 2013 19:10:49 -0400, Timothee Cour > > wrote: > > why isn't this supported? > > > > void main(){ > > > > void fun(); > > void fun(int x);//Error: declaration fun is already defined > > > > } > > Don't k

Re: Garbage collector question

2013-05-15 Thread Namespace
On Thursday, 16 May 2013 at 06:08:30 UTC, gedaiu wrote: Does the garbage collector manages the memory from extern(C) functions, or we have to delete manualy the objects created in those kind of functions? Thanks, Bogdan You mean something like malloc or any kind of, for example, derelict fu

Garbage collector question

2013-05-15 Thread gedaiu
Does the garbage collector manages the memory from extern(C) functions, or we have to delete manualy the objects created in those kind of functions? Thanks, Bogdan

Re: File I/O - rawWrite issues

2013-05-15 Thread 1100110
On 05/08/2013 07:29 PM, H. S. Teoh wrote: > > No need to be embarrassed; it happens to the best of us. IME, some of > the most frustrating, hair-pulling bugs that take hours (or days!) to > get to the bottom of often turn out to be dead-easy trivial mistakes > that got overlooked because they were

Re: cannot have overloaded nested functions?

2013-05-15 Thread Steven Schveighoffer
On Wed, 15 May 2013 19:10:49 -0400, Timothee Cour wrote: why isn't this supported? void main(){ void fun(); void fun(int x);//Error: declaration fun is already defined } Don't know, but it hasn't been supported ever. Spec clearly states it's not supported, but not why. I suppo

cannot have overloaded nested functions?

2013-05-15 Thread Timothee Cour
why isn't this supported? void main(){ void fun(); void fun(int x);//Error: declaration fun is already defined }

Re: What sync object should i use?

2013-05-15 Thread Sean Kelly
On Wednesday, 15 May 2013 at 15:35:05 UTC, Juan Manuel Cabo wrote: It sounds like you need to: 1) use a Message Queue. 2) Copy the message while you work on it with the consumer, so that you can exit the mutex. At which point I'll suggest considering std.concurrency instead of rollin

Re: cast(size_t)&c != 0, but c is null

2013-05-15 Thread Namespace
On Wednesday, 15 May 2013 at 20:15:26 UTC, Timothee Cour wrote: On Wed, May 15, 2013 at 12:35 PM, Namespace wrote: //writeln(AddressOf(B.init)); //waiting for rvalue ref, DIP39 Did I miss something? Since when is sure that the DIP is implemented? o.O just wishful thinking :) actual

Re: cast(size_t)&c != 0, but c is null

2013-05-15 Thread Timothee Cour
> > > > Won't this work? > *cast(void**)&object > >> >> great, works! I've added it to my dtools repo: https://github.com/timotheecour/dtools/blob/master/dtools/util/util.d#L19

Re: cast(size_t)&c != 0, but c is null

2013-05-15 Thread Timothee Cour
On Wed, May 15, 2013 at 12:35 PM, Namespace wrote: > //writeln(AddressOf(B.init)); //waiting for rvalue ref, DIP39 >> > Did I miss something? Since when is sure that the DIP is implemented? o.O > just wishful thinking :) actually this should've been: //writeln(AddressOf(B.init^)); //wait

Re: cast(size_t)&c != 0, but c is null

2013-05-15 Thread Namespace
//writeln(AddressOf(B.init)); //waiting for rvalue ref, DIP39 Did I miss something? Since when is sure that the DIP is implemented? o.O

Re: cast(size_t)&c != 0, but c is null

2013-05-15 Thread Dmitry Olshansky
15-May-2013 23:17, Timothee Cour пишет: >> You can insert a cast to Object first. doesn't seem to work. I'm trying to write a generic solution but having an innocent 'TopCast(T:int)(){return1;}' breaks it, see Error below. doesn't seem to work. This seems to call for a compiler solution? Won

Re: cast(size_t)&c != 0, but c is null

2013-05-15 Thread Timothee Cour
>> You can insert a cast to Object first. doesn't seem to work. I'm trying to write a generic solution but having an innocent 'T opCast(T : int)() { return 1; }' breaks it, see Error below. doesn't seem to work. This seems to call for a compiler solution? import std.stdio; import std.conv; v

Re: cast(size_t)&c != 0, but c is null

2013-05-15 Thread Steven Schveighoffer
On Wed, 15 May 2013 11:08:33 -0400, Artur Skawina wrote: On 05/15/13 13:04, Dicebot wrote: On Wednesday, 15 May 2013 at 10:31:29 UTC, David wrote: "&c" is address of reference, no class instance. I don't know if there is a way to get a pointer to class instance in D but I am not aware of

Re: std.range.zip and tuple labels

2013-05-15 Thread Joseph Rushton Wakeling
On 05/15/2013 08:00 PM, bearophile wrote: > I think currently you have to use map!() to replace the tuple. Maybe am unsafe > map-cast suffices: Feels a bit nasty, and I have the feeling it would probably slow things down ... ? :-( I like the zipWith idea, though I can't help but wish zip() itself

Re: std.range.zip and tuple labels

2013-05-15 Thread bearophile
Joseph Rushton Wakeling: If I use zip() to collate together one or more ranges, the individual elements get returned as a Tuple of the corresponding types. Is there any way to get zip to label those elements, i.e. to return e.g. See: http://d.puremagic.com/issues/show_bug.cgi?id=8715 I thi

std.range.zip and tuple labels

2013-05-15 Thread Joseph Rushton Wakeling
Hi all, If I use zip() to collate together one or more ranges, the individual elements get returned as a Tuple of the corresponding types. Is there any way to get zip to label those elements, i.e. to return e.g. Tuple!(int, "one", float, "two") instead of Tuple!(int, float) ..

Re: What sync object should i use?

2013-05-15 Thread Juan Manuel Cabo
On Wednesday, 15 May 2013 at 02:25:02 UTC, Heinz wrote: I have this "main loop" wich is named here as my consumer function. I didn't want this main loop to be cycling all the time if there was nothing to do. So i needed an event object (condition/mutex) that locked the loop until any of t

Re: cast(size_t)&c != 0, but c is null

2013-05-15 Thread Artur Skawina
On 05/15/13 13:04, Dicebot wrote: > On Wednesday, 15 May 2013 at 10:31:29 UTC, David wrote: >>> "&c" is address of reference, no class instance. I don't know if there >>> is a way to get a pointer to class instance in D but I am not aware of one. >> >> A simple cast to void* should do it: cast(void

Re: abstract class member functions can not have contracts

2013-05-15 Thread Timon Gehr
On 05/15/2013 04:16 PM, ref2401 wrote: Interface member functions can have in/out contracts but why abstract class member functions can not? abstract class Base { @property int field(); void foo() in { assert(field > 0); } // Error: function main.Base.foo in and out contracts require

Re: cast(size_t)&c != 0, but c is null

2013-05-15 Thread Dicebot
On Wednesday, 15 May 2013 at 10:31:29 UTC, David wrote: "&c" is address of reference, no class instance. I don't know if there is a way to get a pointer to class instance in D but I am not aware of one. A simple cast to void* should do it: cast(void*)c Is it actually defined somewhere in spe

Re: cast(size_t)&c != 0, but c is null

2013-05-15 Thread David
Am 14.05.2013 14:24, schrieb Dicebot: > On Tuesday, 14 May 2013 at 12:18:20 UTC, simendsjo wrote: >> Very newbie question coming up :) >> >> How does D mark null values for classes? >> `c is null` returns true, but `&c` isn't 0. >> So how does D know `c is null`? >> >> class C {} >> C c; >> assert(