Re: GC.addRange in pure function

2021-02-12 Thread Petar via Digitalmars-d-learn
On Friday, 12 February 2021 at 12:17:13 UTC, Per Nordlöw wrote: On Tuesday, 9 February 2021 at 03:05:10 UTC, frame wrote: On Sunday, 7 February 2021 at 14:13:18 UTC, vitamin wrote: Why using 'new' is allowed in pure functions but calling GC.addRange or GC.removeRange isn't allowed? Would maki

Re: GC.addRange in pure function

2021-02-12 Thread Petar via Digitalmars-d-learn
On Friday, 12 February 2021 at 19:48:01 UTC, vitamin wrote: On Wednesday, 10 February 2021 at 16:25:44 UTC, Petar Kirov [ZombineDev] wrote: On Wednesday, 10 February 2021 at 13:44:53 UTC, vit wrote: [...] TL;DR Yes, you can, but it depends on what "without problem" means for you :P [...]

Re: GC.addRange in pure function

2021-02-12 Thread vitamin via Digitalmars-d-learn
On Wednesday, 10 February 2021 at 16:25:44 UTC, Petar Kirov [ZombineDev] wrote: On Wednesday, 10 February 2021 at 13:44:53 UTC, vit wrote: [...] TL;DR Yes, you can, but it depends on what "without problem" means for you :P [...] Thanks, Yes, I am implementing container (ref counted point

Re: GC.addRange in pure function

2021-02-12 Thread Per Nordlöw via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 03:05:10 UTC, frame wrote: On Sunday, 7 February 2021 at 14:13:18 UTC, vitamin wrote: Why using 'new' is allowed in pure functions but calling GC.addRange or GC.removeRange isn't allowed? Would making `new T[]` inject a call to `GC.addRange` based on `T` (and ma

Re: GC.addRange in pure function

2021-02-10 Thread Petar via Digitalmars-d-learn
On Wednesday, 10 February 2021 at 16:25:44 UTC, Petar Kirov [ZombineDev] wrote: [..] A few practical examples: Here it is deemed that the only observable side-effect of `malloc` and friends is the setting of `errno` in case of failure, so these wrappers ensure that this is not observed. Sur

Re: GC.addRange in pure function

2021-02-10 Thread Petar via Digitalmars-d-learn
On Wednesday, 10 February 2021 at 13:44:53 UTC, vit wrote: On Wednesday, 10 February 2021 at 12:17:43 UTC, rm wrote: On 09/02/2021 5:05, frame wrote: On Sunday, 7 February 2021 at 14:13:18 UTC, vitamin wrote: Why using 'new' is allowed in pure functions but calling GC.addRange or GC.removeRang

Re: GC.addRange in pure function

2021-02-10 Thread vit via Digitalmars-d-learn
On Wednesday, 10 February 2021 at 12:17:43 UTC, rm wrote: On 09/02/2021 5:05, frame wrote: On Sunday, 7 February 2021 at 14:13:18 UTC, vitamin wrote: Why using 'new' is allowed in pure functions but calling GC.addRange or GC.removeRange isn't allowed? Does 'new' violate the 'pure' paradigm? P

Re: GC.addRange in pure function

2021-02-10 Thread rm via Digitalmars-d-learn
On 09/02/2021 5:05, frame wrote: On Sunday, 7 February 2021 at 14:13:18 UTC, vitamin wrote: Why using 'new' is allowed in pure functions but calling GC.addRange or GC.removeRange isn't allowed? Does 'new' violate the 'pure' paradigm? Pure functions can only call pure functions and GC.addRange

Re: GC.addRange in pure function

2021-02-10 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 21:00:39 UTC, Paul Backus wrote: On Tuesday, 9 February 2021 at 19:53:27 UTC, Temtaime wrote: pure is broken. Just don't [use it] Allowing memory allocation in pure code in a language that can distinguish between pointer equality and value equality is, let's sa

Re: GC.addRange in pure function

2021-02-09 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 20:50:12 UTC, Max Haughton wrote: On Tuesday, 9 February 2021 at 19:53:27 UTC, Temtaime wrote: On Sunday, 7 February 2021 at 14:13:18 UTC, vitamin wrote: Why using 'new' is allowed in pure functions but calling GC.addRange or GC.removeRange isn't allowed? pure i

Re: GC.addRange in pure function

2021-02-09 Thread Max Haughton via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 19:53:27 UTC, Temtaime wrote: On Sunday, 7 February 2021 at 14:13:18 UTC, vitamin wrote: Why using 'new' is allowed in pure functions but calling GC.addRange or GC.removeRange isn't allowed? pure is broken. Just don't [use it] [Citation needed]

Re: GC.addRange in pure function

2021-02-09 Thread Temtaime via Digitalmars-d-learn
On Sunday, 7 February 2021 at 14:13:18 UTC, vitamin wrote: Why using 'new' is allowed in pure functions but calling GC.addRange or GC.removeRange isn't allowed? pure is broken. Just don't [use it]

Re: GC.addRange in pure function

2021-02-08 Thread frame via Digitalmars-d-learn
On Sunday, 7 February 2021 at 14:13:18 UTC, vitamin wrote: Why using 'new' is allowed in pure functions but calling GC.addRange or GC.removeRange isn't allowed? Does 'new' violate the 'pure' paradigm? Pure functions can only call pure functions and GC.addRange or GC.removeRange is only 'nothr

GC.addRange in pure function

2021-02-07 Thread vitamin via Digitalmars-d-learn
Why using 'new' is allowed in pure functions but calling GC.addRange or GC.removeRange isn't allowed?