Re: Concepts like c++20 with specialized overload resolution.

2023-05-27 Thread vushu via Digitalmars-d-learn
On Saturday, 27 May 2023 at 18:41:47 UTC, ryuukk_ wrote: On Saturday, 27 May 2023 at 17:49:27 UTC, vushu wrote: On Saturday, 27 May 2023 at 16:38:43 UTC, Steven Schveighoffer wrote: On 5/27/23 9:50 AM, vushu wrote: On Saturday, 27 May 2023 at 13:42:29 UTC, Basile B. wrote: [...] Yes I know

Re: Concepts like c++20 with specialized overload resolution.

2023-05-27 Thread vushu via Digitalmars-d-learn
On Saturday, 27 May 2023 at 16:38:43 UTC, Steven Schveighoffer wrote: On 5/27/23 9:50 AM, vushu wrote: On Saturday, 27 May 2023 at 13:42:29 UTC, Basile B. wrote: [...] Yes I know there is template constraint, but not with specialized overloading right? so you need to use static if for chec

Re: Concepts like c++20 with specialized overload resolution.

2023-05-27 Thread vushu via Digitalmars-d-learn
On Saturday, 27 May 2023 at 13:42:29 UTC, Basile B. wrote: On Saturday, 27 May 2023 at 13:23:38 UTC, vushu wrote: [...] Is there something equivalent in dlang, doesn't seem like d support specialized overload? D solution is called [template constraints](https://dlang.org/spec/template.html#t

Concepts like c++20 with specialized overload resolution.

2023-05-27 Thread vushu via Digitalmars-d-learn
``` template concept HasMagma = requires(T l) { l.magma(); }; struct LavaMan { void magma() { std::cout << " LavaMan is throwing LAVA" << std::endl; } }; struct FakeVulcano { void try_making_lava() { std::cout << " Making fake lava" << std::endl; } }; void make_lava(HasMagma auto& lava

Re: Idiomatic D using GC as a library writer

2022-12-05 Thread vushu via Digitalmars-d-learn
On Monday, 5 December 2022 at 14:48:33 UTC, cc wrote: On Sunday, 4 December 2022 at 09:53:41 UTC, vushu wrote: [...] If your program runs, does some stuff, and terminates, use the GC. If your program runs, stays up for a while with user occasionally interacting with it, use the GC. If your p

Re: Idiomatic D using GC as a library writer

2022-12-05 Thread vushu via Digitalmars-d-learn
On Sunday, 4 December 2022 at 17:47:38 UTC, ryuukk_ wrote: On Sunday, 4 December 2022 at 09:53:41 UTC, vushu wrote: [...] D gives you the choice But the most important thing is your usecase, what kind of library are you making? Once you answer this question, you can then ask what your me

Re: Idiomatic D using GC as a library writer

2022-12-05 Thread vushu via Digitalmars-d-learn
On Monday, 5 December 2022 at 10:53:33 UTC, Guillaume Piolat wrote: On Sunday, 4 December 2022 at 21:55:52 UTC, Siarhei Siamashka wrote: Is it possible to filter packages in this list by @nogc or @safe compatibility? You can list DUB packages for "@nogc usage" https://code.dlang.org/?sort=scor

Re: Idiomatic D using GC as a library writer

2022-12-05 Thread vushu via Digitalmars-d-learn
On Monday, 5 December 2022 at 10:48:59 UTC, Guillaume Piolat wrote: There are legitimate uses cases when you can't afford the runtime machinery (attach/detach every incoming thread in a shared library), more than not being able to afford the GC from a performance point of view. [...] Thanks

Re: Idiomatic D using GC as a library writer

2022-12-04 Thread vushu via Digitalmars-d-learn
On Sunday, 4 December 2022 at 15:57:26 UTC, Ali Çehreli wrote: On 12/4/22 05:58, vushu wrote: > I was worried if my library should be GC free May I humbly recommend you question where that thinking comes from? Ali P.S. I used to be certain that the idea of GC was wrong and the creators of

Re: Idiomatic D using GC as a library writer

2022-12-04 Thread vushu via Digitalmars-d-learn
On Sunday, 4 December 2022 at 13:03:07 UTC, Hipreme wrote: On Sunday, 4 December 2022 at 09:53:41 UTC, vushu wrote: Dear dlang community. I am unsure about what idiomatic D is. Some of the Dconf talks tells people just to use the GC, until you can't afford it. If there are documents that d

Re: Idiomatic D using GC as a library writer

2022-12-04 Thread vushu via Digitalmars-d-learn
On Sunday, 4 December 2022 at 12:37:08 UTC, Adam D Ruppe wrote: On Sunday, 4 December 2022 at 09:53:41 UTC, vushu wrote: What are your thoughts about using GC as a library writer? Do it. It is lots of gain for very little loss. If you wan't to include a library into your project aren't you m

Idiomatic D using GC as a library writer

2022-12-04 Thread vushu via Digitalmars-d-learn
Dear dlang community. I am unsure about what idiomatic D is. Some of the Dconf talks tells people just to use the GC, until you can't afford it. If there are documents that describes what idiomatic D is then I would appreciate it. So my questions are: What are your thoughts about using

Re: How to move from Unique(someClass) to Unique(someInterface)?

2022-11-27 Thread vushu via Digitalmars-d-learn
On Saturday, 16 May 2020 at 17:45:56 UTC, Konstantin wrote: import std.stdio; import automem; import std.experimental.allocator.mallocator : Mallocator; interface IGetInt { @nogc int GetInt(); } class Foo : IGetInt { @nogc int GetInt() { return 42; } } @nogc void main()

Re: dmd as a library

2022-11-09 Thread vushu via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 11:45:46 UTC, Dennis wrote: On Tuesday, 8 November 2022 at 05:48:54 UTC, vushu wrote: Ah thanks that's nice to have some examples. Here's an example of tools using dmd as a library: https://github.com/jacob-carlborg/dlp Thanks, much appreciated 😊

Re: dmd as a library

2022-11-07 Thread vushu via Digitalmars-d-learn
On Tuesday, 8 November 2022 at 06:35:43 UTC, Mike Parker wrote: On Tuesday, 8 November 2022 at 06:21:11 UTC, vushu wrote: So I do feel, that I am in need for some learning materials or guidance. You might find Lucian Danescu's DConf '22 presentation helpful: https://youtu.be/JYkb3PjIn4c

Re: dmd as a library

2022-11-07 Thread vushu via Digitalmars-d-learn
On Tuesday, 8 November 2022 at 02:55:34 UTC, max haughton wrote: On Tuesday, 8 November 2022 at 00:05:18 UTC, vushu wrote: Any where to find learning material for using dmd as a library? thanks. What do you want to do with it. Im trying to understand the idiomatic way of using visitors, si

Re: dmd as a library

2022-11-07 Thread vushu via Digitalmars-d-learn
On Tuesday, 8 November 2022 at 03:11:15 UTC, Tejas wrote: On Tuesday, 8 November 2022 at 00:05:18 UTC, vushu wrote: Any where to find learning material for using dmd as a library? thanks. https://github.com/Superbelko/dmdlib-notes This is the only resource I know of Ah thanks that's nice t

dmd as a library

2022-11-07 Thread vushu via Digitalmars-d-learn
Any where to find learning material for using dmd as a library? thanks.