Re: Is there any writeln like functions without GC?

2019-11-13 Thread 9il via Digitalmars-d-learn
On Sunday, 10 November 2019 at 07:57:38 UTC, dangbinghoo wrote: On Sunday, 3 November 2019 at 05:46:53 UTC, 9il wrote: On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? See also Mir's @nogc formatting module

Re: Is there any writeln like functions without GC?

2019-11-12 Thread Ogi via Digitalmars-d-learn
If your goal is to debug your @nogc code, you can use writeln in debug statement: @nogc void main() { debug writeln("hello, debug world!"); }

Re: Is there any writeln like functions without GC?

2019-11-11 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 11 November 2019 at 16:20:59 UTC, bauss wrote: If you wanted to follow the standard of D then you didn't need a string type. Since it doesn't really exist in D. string is just an alias for immutable(char)[] And that is why std.exception.assumeUnique converts char[] to string

Re: Is there any writeln like functions without GC?

2019-11-11 Thread bauss via Digitalmars-d-learn
On Saturday, 9 November 2019 at 22:03:03 UTC, Ferhat Kurtulmuş wrote: On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? Upon this post, I thought writing a gc-free writeln would be a good learning practice. Although it is not a feature-complete one, it

Re: Is there any writeln like functions without GC?

2019-11-10 Thread dangbinghoo via Digitalmars-d-learn
On Sunday, 3 November 2019 at 05:46:53 UTC, 9il wrote: On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? See also Mir's @nogc formatting module https://github.com/libmir/mir-runtime/blob/master/source/mir/format.d hi, is mir right now fully implemented

Re: Is there any writeln like functions without GC?

2019-11-09 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? Upon this post, I thought writing a gc-free writeln would be a good learning practice. Although it is not a feature-complete one, it was a lot of fun to do it :) https://github.com/aferust/stringnogc

Re: Is there any writeln like functions without GC?

2019-11-02 Thread 9il via Digitalmars-d-learn
On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? See also Mir's @nogc formatting module https://github.com/libmir/mir-runtime/blob/master/source/mir/format.d

Re: Is there any writeln like functions without GC?

2019-11-02 Thread Seb via Digitalmars-d-learn
On Thursday, 31 October 2019 at 16:03:22 UTC, bachmeier wrote: On Thursday, 31 October 2019 at 15:11:42 UTC, Ferhat Kurtulmuş wrote: It would be nice if one reimplement writeln of Phobos by bypassing gc and use a custom nogc exception as described here*? Of course I can imagine that it would

Re: Is there any writeln like functions without GC?

2019-11-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, October 31, 2019 9:11:42 AM MDT Ferhat Kurtulmuş via Digitalmars-d-learn wrote: > On Thursday, 31 October 2019 at 13:46:07 UTC, Adam D. Ruppe wrote: > > On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: > >> Hi: > >>why writeln need GC? > > > > It almost never does, it

Re: Is there any writeln like functions without GC?

2019-10-31 Thread bachmeier via Digitalmars-d-learn
On Thursday, 31 October 2019 at 15:11:42 UTC, Ferhat Kurtulmuş wrote: It would be nice if one reimplement writeln of Phobos by bypassing gc and use a custom nogc exception as described here*? Of course I can imagine that it would be a breaking change in the language and requires so much work

Re: Is there any writeln like functions without GC?

2019-10-31 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 31 October 2019 at 13:46:07 UTC, Adam D. Ruppe wrote: On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? It almost never does, it just keeps the option open in case * it needs to throw an exception (like if stdout is closed) * you pass it a

Re: Is there any writeln like functions without GC?

2019-10-31 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? It almost never does, it just keeps the option open in case * it needs to throw an exception (like if stdout is closed) * you pass it a custom type with toString that uses GC @nogc is just super strict and

Re: Is there any writeln like functions without GC?

2019-10-31 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? I cannot answer why it needs GC but something can be implemented like: import core.stdc.stdio; struct Point { int x; int y; } class Person { string name; uint age; } template

Is there any writeln like functions without GC?

2019-10-30 Thread lili via Digitalmars-d-learn
Hi: why writeln need GC?