Re: Specifying @nogc on structs seems to have no effect

2017-09-20 Thread B4s1L3 via Digitalmars-d
On Wednesday, 20 September 2017 at 16:13:44 UTC, Craig Black wrote: On Wednesday, 20 September 2017 at 02:43:44 UTC, B4s1L3 wrote: It's another way of doing things. It's less strict than checking all the functions. note: the script can be run directly by passing the file to DUB (single file

Re: Specifying @nogc on structs seems to have no effect

2017-09-20 Thread Craig Black via Digitalmars-d
On Wednesday, 20 September 2017 at 02:43:44 UTC, B4s1L3 wrote: It's another way of doing things. It's less strict than checking all the functions. note: the script can be run directly by passing the file to DUB (single file package). Wow! Yeah that seems like almost exactly what I want.

Re: Specifying @nogc on structs seems to have no effect

2017-09-20 Thread Craig Black via Digitalmars-d
On Wednesday, 20 September 2017 at 02:43:44 UTC, B4s1L3 wrote: On Tuesday, 19 September 2017 at 13:11:03 UTC, Craig Black wrote: I've recently tried coding in D again after some years. One of my earlier concerns was the ability to code without the GC, which seemed difficult to pull off. To

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread B4s1L3 via Digitalmars-d
On Tuesday, 19 September 2017 at 13:11:03 UTC, Craig Black wrote: I've recently tried coding in D again after some years. One of my earlier concerns was the ability to code without the GC, which seemed difficult to pull off. To be clear, I want my programs to be garbage collected, but I want

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread Craig Black via Digitalmars-d
On Tuesday, 19 September 2017 at 20:57:17 UTC, Neia Neutuladh wrote: On Tuesday, 19 September 2017 at 15:11:31 UTC, Craig Black wrote: [...] You want to ensure that it can never refer to GC memory. The type system does not contain that information. It doesn't say whether an object was

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread Neia Neutuladh via Digitalmars-d
On Tuesday, 19 September 2017 at 15:11:31 UTC, Craig Black wrote: Thank you for the information. What I would like to do is to create an Array template class that doesn't use GC at all. You want to ensure that it can never refer to GC memory. The type system does not contain that

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread ag0aep6g via Digitalmars-d
On 09/19/2017 08:06 PM, Craig Black wrote: This wouldn't be allowed for classes or class references, since they are always pointing to GC data That's not true. You can put class objects into other places than the GC heap.

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread Steven Schveighoffer via Digitalmars-d
On 9/19/17 2:06 PM, Craig Black wrote: Thank you for the clarification. I understand mow that @nogc is only for functions and not for data types.  Thinking out loud, it would seem beneficial if there was a way to mark a pointer or data structure as not pointing to the GC heap. A guarantee to

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread Craig Black via Digitalmars-d
On Tuesday, 19 September 2017 at 15:15:05 UTC, Steven Schveighoffer wrote: On 9/19/17 10:22 AM, Craig Black wrote: On Tuesday, 19 September 2017 at 13:59:27 UTC, Jonathan M Davis wrote: On Tuesday, September 19, 2017 13:11:03 Craig Black via Digitalmars-d wrote: I've recently tried coding in D

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread Steven Schveighoffer via Digitalmars-d
On 9/19/17 10:22 AM, Craig Black wrote: On Tuesday, 19 September 2017 at 13:59:27 UTC, Jonathan M Davis wrote: On Tuesday, September 19, 2017 13:11:03 Craig Black via Digitalmars-d wrote: I've recently tried coding in D again after some years.  One of my earlier concerns was the ability to

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread Craig Black via Digitalmars-d
On Tuesday, 19 September 2017 at 14:34:10 UTC, Mike Parker wrote: On Tuesday, 19 September 2017 at 14:22:21 UTC, Craig Black wrote: Thank you for your response. The @nogc attribute is good, but in my opinion it is incomplete if all types still require scanning. The purpose of not employing

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread Mike Parker via Digitalmars-d
On Tuesday, 19 September 2017 at 14:22:21 UTC, Craig Black wrote: Thank you for your response. The @nogc attribute is good, but in my opinion it is incomplete if all types still require scanning. The purpose of not employing GC in certain sections of code is performance, and we are

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread Craig Black via Digitalmars-d
On Tuesday, 19 September 2017 at 13:59:27 UTC, Jonathan M Davis wrote: On Tuesday, September 19, 2017 13:11:03 Craig Black via Digitalmars-d wrote: I've recently tried coding in D again after some years. One of my earlier concerns was the ability to code without the GC, which seemed difficult

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread John Colvin via Digitalmars-d
On Tuesday, 19 September 2017 at 13:11:03 UTC, Craig Black wrote: I've recently tried coding in D again after some years. One of my earlier concerns was the ability to code without the GC, which seemed difficult to pull off. To be clear, I want my programs to be garbage collected, but I want

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, September 19, 2017 13:11:03 Craig Black via Digitalmars-d wrote: > I've recently tried coding in D again after some years. One of > my earlier concerns was the ability to code without the GC, which > seemed difficult to pull off. To be clear, I want my programs to > be garbage

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread ag0aep6g via Digitalmars-d
On 09/19/2017 03:46 PM, Craig Black wrote: struct MyStruct { @nogc: public:   Foo foo; // This does not produce an error, but it still requires a GC scan @nogc is about GC allocations. `Foo foo;` doesn't cause a GC allocation. @nogc doesn't control what memory is scanned by the GC.

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread Mike Parker via Digitalmars-d
On Tuesday, 19 September 2017 at 13:46:20 UTC, Craig Black wrote: Thanks, I didn't know you could to that but it still doesn't give me the behavior that I want: class Foo { } struct MyStruct { @nogc: public: Foo foo; // This does not produce an error, but it still requires a GC scan

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread drug via Digitalmars-d
19.09.2017 16:46, Craig Black пишет: class Foo { } struct MyStruct { @nogc: public:   Foo foo; // This does not produce an error, but it still requires a GC scan   void Bar()   {     foo = new Foo; // This produces an error   } } it produces an error for me

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread drug via Digitalmars-d
19.09.2017 16:49, drug пишет: 19.09.2017 16:48, drug пишет: 19.09.2017 16:46, Craig Black пишет: class Foo { } struct MyStruct { @nogc: public:    Foo foo; // This does not produce an error, but it still requires a GC scan    void Bar()    { foo = new Foo; // This produces an error   

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread Craig Black via Digitalmars-d
On Tuesday, 19 September 2017 at 13:32:59 UTC, Eugene Wissner wrote: On Tuesday, 19 September 2017 at 13:11:03 UTC, Craig Black wrote: I've recently tried coding in D again after some years. One of my earlier concerns was the ability to code without the GC, which seemed difficult to pull off.

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread drug via Digitalmars-d
19.09.2017 16:48, drug пишет: 19.09.2017 16:46, Craig Black пишет: class Foo { } struct MyStruct { @nogc: public:    Foo foo; // This does not produce an error, but it still requires a GC scan    void Bar()    { foo = new Foo; // This produces an error    } } it produces an error for

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread Eugene Wissner via Digitalmars-d
On Tuesday, 19 September 2017 at 13:11:03 UTC, Craig Black wrote: I've recently tried coding in D again after some years. One of my earlier concerns was the ability to code without the GC, which seemed difficult to pull off. To be clear, I want my programs to be garbage collected, but I want

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread Andrea Fontana via Digitalmars-d
On Tuesday, 19 September 2017 at 13:13:48 UTC, Craig Black wrote: @nogc struct Array(T) { ... } class GarbageCollectedClass { } void main() { Array!int intArray; // fine Array!GarbageCollectedClass classArray; // Error: struct Array is @nogc } If you want to enforce that behaviour I

Re: Specifying @nogc on structs seems to have no effect

2017-09-19 Thread Craig Black via Digitalmars-d
On Tuesday, 19 September 2017 at 13:11:03 UTC, Craig Black wrote: I've recently tried coding in D again after some years. One of my earlier concerns was the ability to code without the GC, which seemed difficult to pull off. To be clear, I want my programs to be garbage collected, but I want