Re: ICE?

2015-05-19 Thread Daniel Kozak via Digitalmars-d-learn
On Sunday, 17 May 2015 at 09:25:33 UTC, Namespace wrote: Is this error an ICE? I think so, because I see the internal filename, but I'm not sure. Error: e2ir: cannot cast malloc(length * 8u) of type void* to type char[] https://github.com/D-Programming-Language/dmd/pull/4667

Re: The analogue of fill-pointer in D

2015-05-19 Thread Kagamin via Digitalmars-d-learn
On Monday, 18 May 2015 at 16:40:30 UTC, Dennis Ritchie wrote: On Monday, 18 May 2015 at 12:49:56 UTC, Kagamin wrote: Filling a buffer is usually done this way: http://dlang.org/phobos/std_stdio.html#.File.rawRead Here such example, the task. There is a flow stream, associated, for example,

Re: -vgc Info ok?

2015-05-19 Thread Chris via Digitalmars-d-learn
On Monday, 18 May 2015 at 18:40:15 UTC, ketmar wrote: On Mon, 18 May 2015 14:41:19 +, Chris wrote: On Monday, 18 May 2015 at 14:34:38 UTC, ketmar wrote: On Mon, 18 May 2015 14:30:42 +, Chris wrote: The following string[string] myarray = [key:value]; string entry; entry =

Re: -vgc Info ok?

2015-05-19 Thread Namespace via Digitalmars-d-learn
On Monday, 18 May 2015 at 14:30:43 UTC, Chris wrote: The following string[string] myarray = [key:value]; string entry; entry = myarray[key]; // = vgc: indexing an associative array may cause GC allocation Why is _accessing_ an assoc treated as indexing it? No error if you use

Re: -vgc Info ok?

2015-05-19 Thread thedeemon via Digitalmars-d-learn
On Monday, 18 May 2015 at 14:30:43 UTC, Chris wrote: Why is _accessing_ an assoc treated as indexing it? Are you sure you understand indexing as we do? It's not like indexing of databases, it's just accessing by index i.e. using myarray[some_index].

Re: -vgc Info ok?

2015-05-19 Thread Namespace via Digitalmars-d-learn
On Tuesday, 19 May 2015 at 09:43:06 UTC, Chris wrote: On Tuesday, 19 May 2015 at 09:10:50 UTC, Namespace wrote: On Monday, 18 May 2015 at 14:30:43 UTC, Chris wrote: The following string[string] myarray = [key:value]; string entry; entry = myarray[key]; // = vgc: indexing an associative array

Re: -vgc Info ok?

2015-05-19 Thread Chris via Digitalmars-d-learn
On Tuesday, 19 May 2015 at 09:10:50 UTC, Namespace wrote: On Monday, 18 May 2015 at 14:30:43 UTC, Chris wrote: The following string[string] myarray = [key:value]; string entry; entry = myarray[key]; // = vgc: indexing an associative array may cause GC allocation Why is _accessing_ an assoc

partialShuffle only shuffles subset.

2015-05-19 Thread BlackEdder via Digitalmars-d-learn
The documentation seems to indicate that partialShuffle: Partially shuffles the elements of r such that upon returning r[0..n] is a random subset of r, (which is what I want), but it seems that partialShuffle actually only shuffles the first subset of the range (which you could do probably

Re: -vgc Info ok?

2015-05-19 Thread Chris via Digitalmars-d-learn
On Tuesday, 19 May 2015 at 11:08:52 UTC, thedeemon wrote: On Monday, 18 May 2015 at 14:30:43 UTC, Chris wrote: Why is _accessing_ an assoc treated as indexing it? Are you sure you understand indexing as we do? It's not like indexing of databases, it's just accessing by index i.e. using

Re: GC Destruction Order

2015-05-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 19 May 2015 at 23:10:21 UTC, bitwise wrote: which is why I am asking if there are any plans to implement something like @nogc for entire modules or classes. At the top: @nogc: stuff here Gotta do it inside the class too i think.

Re: GC Destruction Order

2015-05-19 Thread bitwise via Digitalmars-d-learn
On Tue, 19 May 2015 19:03:02 -0400, bitwise bitwise@gmail.com wrote: Maybe I worded that incorrectly, but my point is that when you're running with the GC disabled, you should only use methods marked with @nogc if you want to make sure your code doesn't leak right? that's a lot of

Re: GC Destruction Order

2015-05-19 Thread bitwise via Digitalmars-d-learn
On Tue, 19 May 2015 19:16:14 -0400, Adam D. Ruppe destructiona...@gmail.com wrote: On Tuesday, 19 May 2015 at 23:10:21 UTC, bitwise wrote: which is why I am asking if there are any plans to implement something like @nogc for entire modules or classes. At the top: @nogc: stuff here

Re: Associative array on the heap

2015-05-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/18/15 7:55 PM, Freddy wrote: How do you allocate an associative array on the heap? void main(){ alias A=int[string]; auto b=new A; } $ rdmd test test.d(4): Error: new can only create structs, dynamic arrays or class objects, not int[string]'s Failed: [dmd, -v, -o-,

Re: -vgc Info ok?

2015-05-19 Thread ketmar via Digitalmars-d-learn
On Tue, 19 May 2015 11:36:32 +, Chris wrote: On Tuesday, 19 May 2015 at 11:08:52 UTC, thedeemon wrote: On Monday, 18 May 2015 at 14:30:43 UTC, Chris wrote: Why is _accessing_ an assoc treated as indexing it? Are you sure you understand indexing as we do? It's not like indexing of

Re: -vgc Info ok?

2015-05-19 Thread anonymous via Digitalmars-d-learn
On Monday, 18 May 2015 at 14:34:38 UTC, ketmar wrote: it can throw out of range error, which is `new`ed. Array access can also throw RangeError, but -vgc and @nogc don't mind that: void main() @nogc { int[] a; auto b = a[0]; }

Re: -vgc Info ok?

2015-05-19 Thread ketmar via Digitalmars-d-learn
On Tue, 19 May 2015 13:17:15 +, anonymous wrote: On Monday, 18 May 2015 at 14:34:38 UTC, ketmar wrote: it can throw out of range error, which is `new`ed. Array access can also throw RangeError, but -vgc and @nogc don't mind that: void main() @nogc { int[] a; auto b =

Re: -vgc Info ok?

2015-05-19 Thread Chris via Digitalmars-d-learn
On Tuesday, 19 May 2015 at 12:41:29 UTC, ketmar wrote: On Tue, 19 May 2015 11:36:32 +, Chris wrote: On Tuesday, 19 May 2015 at 11:08:52 UTC, thedeemon wrote: On Monday, 18 May 2015 at 14:30:43 UTC, Chris wrote: Why is _accessing_ an assoc treated as indexing it? Are you sure you

Re: partialShuffle only shuffles subset.

2015-05-19 Thread Ivan Kazmenko via Digitalmars-d-learn
On Tuesday, 19 May 2015 at 10:00:33 UTC, BlackEdder wrote: The documentation seems to indicate that partialShuffle: Partially shuffles the elements of r such that upon returning r[0..n] is a random subset of r, (which is what I want), but it seems that partialShuffle actually only shuffles the

Re: GC Destruction Order

2015-05-19 Thread bitwise via Digitalmars-d-learn
On Tue, 19 May 2015 14:19:30 -0400, Adam D. Ruppe destructiona...@gmail.com wrote: On Tuesday, 19 May 2015 at 18:15:06 UTC, bitwise wrote: Is this also true for D? Yes. The GC considers all the unreferenced memory dead at the same time and may clean up the class and its members in any

Re: GC Destruction Order

2015-05-19 Thread Namespace via Digitalmars-d-learn
On Tuesday, 19 May 2015 at 19:36:23 UTC, rsw0x wrote: On Tuesday, 19 May 2015 at 18:37:31 UTC, bitwise wrote: On Tue, 19 May 2015 14:19:30 -0400, Adam D. Ruppe destructiona...@gmail.com wrote: On Tuesday, 19 May 2015 at 18:15:06 UTC, bitwise wrote: Is this also true for D? Yes. The GC

Re: GC Destruction Order

2015-05-19 Thread rsw0x via Digitalmars-d-learn
On Tuesday, 19 May 2015 at 21:07:52 UTC, bitwise wrote: On Tue, 19 May 2015 15:36:21 -0400, rsw0x anonym...@anonymous.com wrote: On Tuesday, 19 May 2015 at 18:37:31 UTC, bitwise wrote: On Tue, 19 May 2015 14:19:30 -0400, Adam D. Ruppe destructiona...@gmail.com wrote: On Tuesday, 19 May

Re: GC Destruction Order

2015-05-19 Thread bitwise via Digitalmars-d-learn
On Tue, 19 May 2015 17:52:36 -0400, rsw0x anonym...@anonymous.com wrote: On Tuesday, 19 May 2015 at 21:07:52 UTC, bitwise wrote: Any idea what the plans are?. Does RefCounted become thread safe? Correct me if I'm wrong though, but even if RefCounted itself was thread-safe, RefCounted

Re: GC Destruction Order

2015-05-19 Thread Namespace via Digitalmars-d-learn
On Tuesday, 19 May 2015 at 20:02:07 UTC, rsw0x wrote: On Tuesday, 19 May 2015 at 19:45:38 UTC, Namespace wrote: On Tuesday, 19 May 2015 at 19:36:23 UTC, rsw0x wrote: On Tuesday, 19 May 2015 at 18:37:31 UTC, bitwise wrote: On Tue, 19 May 2015 14:19:30 -0400, Adam D. Ruppe

Re: GC Destruction Order

2015-05-19 Thread bitwise via Digitalmars-d-learn
On Tue, 19 May 2015 15:36:21 -0400, rsw0x anonym...@anonymous.com wrote: On Tuesday, 19 May 2015 at 18:37:31 UTC, bitwise wrote: On Tue, 19 May 2015 14:19:30 -0400, Adam D. Ruppe destructiona...@gmail.com wrote: On Tuesday, 19 May 2015 at 18:15:06 UTC, bitwise wrote: Is this also true for

Re: GC Destruction Order

2015-05-19 Thread bitwise via Digitalmars-d-learn
On Tue, 19 May 2015 18:47:26 -0400, Steven Schveighoffer schvei...@yahoo.com wrote: On 5/19/15 5:07 PM, bitwise wrote: On Tue, 19 May 2015 15:36:21 -0400, rsw0x anonym...@anonymous.com wrote: On Tuesday, 19 May 2015 at 18:37:31 UTC, bitwise wrote: On Tue, 19 May 2015 14:19:30 -0400,

Re: GC Destruction Order

2015-05-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/19/15 4:16 PM, Namespace wrote: On Tuesday, 19 May 2015 at 20:02:07 UTC, rsw0x wrote: After dconf http://forum.dlang.org/thread/5554d763.1080...@dawg.eu#post-5554D763.1080308:40dawg.eu I thought the new releases would come faster. They should. This is an exception. Read the thread

Re: GC Destruction Order

2015-05-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/19/15 5:07 PM, bitwise wrote: On Tue, 19 May 2015 15:36:21 -0400, rsw0x anonym...@anonymous.com wrote: On Tuesday, 19 May 2015 at 18:37:31 UTC, bitwise wrote: On Tue, 19 May 2015 14:19:30 -0400, Adam D. Ruppe destructiona...@gmail.com wrote: On Tuesday, 19 May 2015 at 18:15:06 UTC,

Re: GC Destruction Order

2015-05-19 Thread rsw0x via Digitalmars-d-learn
On Tuesday, 19 May 2015 at 19:45:38 UTC, Namespace wrote: On Tuesday, 19 May 2015 at 19:36:23 UTC, rsw0x wrote: On Tuesday, 19 May 2015 at 18:37:31 UTC, bitwise wrote: On Tue, 19 May 2015 14:19:30 -0400, Adam D. Ruppe destructiona...@gmail.com wrote: On Tuesday, 19 May 2015 at 18:15:06 UTC,

Re: GC Destruction Order

2015-05-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 19 May 2015 at 18:15:06 UTC, bitwise wrote: Is this also true for D? Yes. The GC considers all the unreferenced memory dead at the same time and may clean up the class and its members in any order.

GC Destruction Order

2015-05-19 Thread bitwise via Digitalmars-d-learn
In C#, it's possible that class members can actually be destroyed before the containing object. Example: class Stuff { Class1 thing1; Class2 thing2; ~Stuff() { thing1.DoSomeFinalization(); // [1] } } I forget what the exact behavior was, but basically, [1] is

Re: GC Destruction Order

2015-05-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/19/15 2:37 PM, bitwise wrote: On Tue, 19 May 2015 14:19:30 -0400, Adam D. Ruppe destructiona...@gmail.com wrote: On Tuesday, 19 May 2015 at 18:15:06 UTC, bitwise wrote: Is this also true for D? Yes. The GC considers all the unreferenced memory dead at the same time and may clean up the

Re: GC Destruction Order

2015-05-19 Thread bitwise via Digitalmars-d-learn
On Tue, 19 May 2015 14:55:55 -0400, Steven Schveighoffer schvei...@yahoo.com wrote: On 5/19/15 2:37 PM, bitwise wrote: On Tue, 19 May 2015 14:19:30 -0400, Adam D. Ruppe destructiona...@gmail.com wrote: On Tuesday, 19 May 2015 at 18:15:06 UTC, bitwise wrote: Is this also true for D? Yes.

Re: GC Destruction Order

2015-05-19 Thread rsw0x via Digitalmars-d-learn
On Tuesday, 19 May 2015 at 18:37:31 UTC, bitwise wrote: On Tue, 19 May 2015 14:19:30 -0400, Adam D. Ruppe destructiona...@gmail.com wrote: On Tuesday, 19 May 2015 at 18:15:06 UTC, bitwise wrote: Is this also true for D? Yes. The GC considers all the unreferenced memory dead at the same