digitalmars.D - nogc for structs, blocks or modules?
- maik klein (15/15) Feb 15 2016 I am probably the minority but I almost never use the GC in D.
- WebFreak001 (6/7) Feb 15 2016 you can mark everything as nogc with
- maik klein (5/12) Feb 15 2016 Thanks, this should probably added to
- Era Scarecrow (6/8) Feb 15 2016 Or it hasn't been tagged @nogc or based on templates they can't
- rsw0x (3/12) Feb 15 2016 templated constructs aren't tagged @nogc because it's inferred,
- jmh530 (5/7) Feb 15 2016 It's actually in there, it's just easy to miss.
- John Colvin (3/19) Feb 16 2016 You probably can, remember that templates have their attributes
I am probably the minority but I almost never use the GC in D. Because I never use the GC I could mark 99% of my functions with nogc. I just seems very annoying to add nogc to every function. For people like me it seems that it could be a nice addition to also allow nogc for structs like nocgc struct Foo{..} or blocks nogc{ void foo(){} void foo1(){} } or even modules nogc module Foo What do you think?
Feb 15 2016
On Tuesday, 16 February 2016 at 02:42:06 UTC, maik klein wrote:I just seems very annoying to add nogc to every function.you can mark everything as nogc with // gc functions here nogc: // nogc functions here void foo() {}
Feb 15 2016
On Tuesday, 16 February 2016 at 02:47:38 UTC, WebFreak001 wrote:On Tuesday, 16 February 2016 at 02:42:06 UTC, maik klein wrote:Thanks, this should probably added to https://dlang.org/spec/attribute.html#nogc I just realized that I can't even use nogc because pretty much nothing in phobos uses nogcI just seems very annoying to add nogc to every function.you can mark everything as nogc with // gc functions here nogc: // nogc functions here void foo() {}
Feb 15 2016
On Tuesday, 16 February 2016 at 03:13:48 UTC, maik klein wrote:I just realized that I can't even use nogc because pretty much nothing in phobos uses nogcOr it hasn't been tagged nogc or based on templates they can't be preemptively marked it. I'd think most ranges could be nogc; And recently with some of the toString's being rewritten to use ranges instead of allocating memory would be nogc as well. Many algorithms are probably be nogc too.
Feb 15 2016
On Tuesday, 16 February 2016 at 03:41:12 UTC, Era Scarecrow wrote:On Tuesday, 16 February 2016 at 03:13:48 UTC, maik klein wrote:templated constructs aren't tagged nogc because it's inferred, tagging them nogc would impose restrictions on the end userI just realized that I can't even use nogc because pretty much nothing in phobos uses nogcOr it hasn't been tagged nogc or based on templates they can't be preemptively marked it. I'd think most ranges could be nogc; And recently with some of the toString's being rewritten to use ranges instead of allocating memory would be nogc as well. Many algorithms are probably be nogc too.
Feb 15 2016
On Tuesday, 16 February 2016 at 03:13:48 UTC, maik klein wrote:Thanks, this should probably added to https://dlang.org/spec/attribute.html#nogcIt's actually in there, it's just easy to miss. It's the box with the text after "Attributes are a way to modify one or more declarations. The general forms are: "
Feb 15 2016
On Tuesday, 16 February 2016 at 03:13:48 UTC, maik klein wrote:On Tuesday, 16 February 2016 at 02:47:38 UTC, WebFreak001 wrote:You probably can, remember that templates have their attributes inferred.On Tuesday, 16 February 2016 at 02:42:06 UTC, maik klein wrote:Thanks, this should probably added to https://dlang.org/spec/attribute.html#nogc I just realized that I can't even use nogc because pretty much nothing in phobos uses nogcI just seems very annoying to add nogc to every function.you can mark everything as nogc with // gc functions here nogc: // nogc functions here void foo() {}
Feb 16 2016