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 AKA

Re: Unexpected aliasing

2019-11-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, November 11, 2019 12:17:37 PM MST Bastiaan Veelo via Digitalmars- d-learn wrote: > Recently I got my first surprise with our use of D. The symptom > was that two local variables in two different functions appeared > to be sharing data. > > A simplified example is shown below (the origina

Re: Unexpected aliasing

2019-11-11 Thread Antonio Corbi via Digitalmars-d-learn
On Monday, 11 November 2019 at 19:17:37 UTC, Bastiaan Veelo wrote: Recently I got my first surprise with our use of D. The symptom was that two local variables in two different functions appeared to be sharing data. A simplified example is shown below (the original was machine translated from

Unexpected aliasing

2019-11-11 Thread Bastiaan Veelo via Digitalmars-d-learn
Recently I got my first surprise with our use of D. The symptom was that two local variables in two different functions appeared to be sharing data. A simplified example is shown below (the original was machine translated from Pascal and involved templates and various levels of indirection).

DLL on LDC

2019-11-11 Thread Márcio Martins via Digitalmars-d-learn
Hi, I am trying to create a simple DLL and a simple app that loads it on Linux with end goal of having it work on MacOS. Everything seems to work fine with DMD, but when I use LDC2 to build the loader, I don't get the `shared static this()` and `~this` called when I `dlopen()` and `dlclose()

Re: Understand signature of opOpAssign in std/complex.d

2019-11-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 11 November 2019 at 16:59:57 UTC, Q. Schroll wrote: What's the difference of is(C R == Complex!R) to is(C == Complex!R, R) then? Nothing, they do the same thing. (I'm of the opinion that the first one should actually be illegal - I thought it was until I checked for this th

Re: Understand signature of opOpAssign in std/complex.d

2019-11-11 Thread Q. Schroll via Digitalmars-d-learn
On Saturday, 9 November 2019 at 13:26:12 UTC, Adam D. Ruppe wrote: On Saturday, 9 November 2019 at 12:30:46 UTC, René Heldmaier wrote: The part i don't understand is "is(C R == Complex!R)". What does that mean? That's checking the if the template argument C is a case of Complex!R, while at th

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 was

Re: Distinguishing a pointer to a function and a closure

2019-11-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 11 November 2019 at 13:10:44 UTC, berni44 wrote: (a normal delegate seems to be an Object somehow, though). The .ptr method is a pointer to the data associated with the delegate. It might be an object (class or struct) or it might be a memory block (for local variables on the stac

Distinguishing a pointer to a function and a closure

2019-11-11 Thread berni44 via Digitalmars-d-learn
While debugging phobos I came across some stuff I don't understand. A small example: void foo(void* p) { Object o = cast(Object) p; ClassInfo oc = typeid(o); } class Bar { void some_func(int i) {} void do_something(void delegate(int) d) { // is it possible to check