Re: Assocative array lookup for object

2023-04-12 Thread Salih Dincer via Digitalmars-d-learn
On Wednesday, 12 April 2023 at 13:09:07 UTC, Ali Çehreli wrote: Not every type is null'able but nullable. ;) So, a design may use the following: https://dlang.org/library/std/typecons/nullable.html I implemented Handler into the Voldermort build, which Walter loved so much. For convenience,

Re: How can a function pointer required to be extern(C)?

2023-04-12 Thread John Chapman via Digitalmars-d-learn
On Wednesday, 12 April 2023 at 20:36:59 UTC, H. S. Teoh wrote: ---snip--- extern(C) void* abc(void*) {return null;} alias FuncPtr = typeof(&abc); You can also express it like this: ```d extern(C) alias FuncPtr = void* function(void*); ```

Re: How can a function pointer required to be extern(C)?

2023-04-12 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Apr 12, 2023 at 08:23:51PM +, rempas via Digitalmars-d-learn wrote: > Sorry if the title doesn't make any sense, let me explain. So, I do have the > following code that does not compile: > > ```d > import core.sys.posix.pthread; /* The library */ > > struct Thread { > private: > pth

How can a function pointer required to be extern(C)?

2023-04-12 Thread rempas via Digitalmars-d-learn
Sorry if the title doesn't make any sense, let me explain. So, I do have the following code that does not compile: ```d import core.sys.posix.pthread; /* The library */ struct Thread { private: pthread_t thread_id; public: this(void* function(void*) func, void* arg = null, scope const(pth

Re: @nogc and Phobos

2023-04-12 Thread rempas via Digitalmars-d-learn
On Tuesday, 14 March 2023 at 20:40:39 UTC, bomat wrote: Sounds intriguing. Anything I can look at yet? Or still all top secret? :) Oh, amazing! I let you on waiting for almost a month and I wouldn't had see it if I didn't came to post another question. I'm so so sorry for the waiting,

Re: Assocative array lookup for object

2023-04-12 Thread Ali Çehreli via Digitalmars-d-learn
On 4/12/23 04:35, Salih Dincer wrote: > I made a little mistake and I'll fix it before someone rub nose in it :) You asked for it! :) >auto opIndex(string key) { > if(auto ret = key in data) > { >return *ret; > } > return null; >} Not every type is null'able

Re: Mir-ion:YAML Example

2023-04-12 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 12 April 2023 at 12:00:14 UTC, Vino wrote: Hi All, Can some point me where i can find examples on how to use mir-ion YAML From, Vino.B documentation is very sparse, but essentially with mir-ion you import the different ser/deser packages that you would like to use. If you

Mir-ion:YAML Example

2023-04-12 Thread Vino via Digitalmars-d-learn
Hi All, Can some point me where i can find examples on how to use mir-ion YAML From, Vino.B

Re: Using DUB packages with Meson

2023-04-12 Thread Dmitry Olshansky via Digitalmars-d-learn
On Wednesday, 12 April 2023 at 11:07:56 UTC, Richard (Rikki) Andrew Cattermole wrote: Did you compile the library with dub using ldc2? Yup, I do not have other compilers installed. -- Dmitry Olshansky

Re: Assocative array lookup for object

2023-04-12 Thread Salih Dincer via Digitalmars-d-learn
On Wednesday, 12 April 2023 at 04:57:58 UTC, Salih Dincer wrote: I think you want to do an encapsulation like below. ```d auto opIndex(string key)    => *(key in data); ``` I made a little mistake and I'll fix it before someone rub nose in it :) ```d auto opIndex(string key) { if(a

Re: Using DUB packages with Meson

2023-04-12 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
Did you compile the library with dub using ldc2?

Re: Using DUB packages with Meson

2023-04-12 Thread Dmitry Olshansky via Digitalmars-d-learn
On Wednesday, 12 April 2023 at 10:24:48 UTC, Richard (Rikki) Andrew Cattermole wrote: I'm going to guess that you need to use the version specifier in the package name. Because I'm not seeing anything there to handle it specifically. https://github.com/mesonbuild/meson/blob/master/mesonbuild/d

Re: Using DUB packages with Meson

2023-04-12 Thread Dmitry Olshansky via Digitalmars-d-learn
On Wednesday, 12 April 2023 at 10:24:48 UTC, Richard (Rikki) Andrew Cattermole wrote: I'm going to guess that you need to use the version specifier in the package name. Because I'm not seeing anything there to handle it specifically. https://github.com/mesonbuild/meson/blob/master/mesonbuild/d

Re: Using DUB packages with Meson

2023-04-12 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
I'm going to guess that you need to use the version specifier in the package name. Because I'm not seeing anything there to handle it specifically. https://github.com/mesonbuild/meson/blob/master/mesonbuild/dependencies/dub.py i.e. ``dub build [[@]] []`` So use ``package:sub@1.0.2``. Also I

Re: How to setup D with SFML? (using bindbc-sfml)

2023-04-12 Thread Salih Dincer via Digitalmars-d-learn
On Tuesday, 11 April 2023 at 10:24:09 UTC, Ki Rill wrote: My `dub.json`: ```Json { "authors": [ "rillki" ], "copyright": "Copyright © 2023, rillki", "dependencies": { "bindbc-sfml": "~>1.0.2" }, "description": "D/SFML

Using DUB packages with Meson

2023-04-12 Thread Dmitry Olshansky via Digitalmars-d-learn
I'm trying to use my new DUB package from Photon, which is polyglot project and is built with Meson. Have anyone worked with DUB packages in Meson? I've found this bit of documentation: https://mesonbuild.com/Dependencies.html#dub And I did fetch & build but I do not understand how to introdu

Re: learning D as your first language but having difficulty in making or logic building in order to make software

2023-04-12 Thread Dom DiSc via Digitalmars-d-learn
On Tuesday, 11 April 2023 at 14:13:17 UTC, slectr wrote: I want to make software like krita inkscape and my own language using D Although i previosly learned C and C++ i left it in the middle and for some reasons i dont want to learn those so i searched for alternatives and found D but there

Re: Help with registering dub package

2023-04-12 Thread Dmitry Olshansky via Digitalmars-d-learn
On Wednesday, 12 April 2023 at 08:25:54 UTC, Richard (Rikki) Andrew Cattermole wrote: Your branches + tag is all messed up. You have both ~master and ~main. ~main has dub.json (which is required), but the tag is based upon ~master which has your README. Between the two branches everything is

Re: Help with registering dub package

2023-04-12 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
Your branches + tag is all messed up. You have both ~master and ~main. ~main has dub.json (which is required), but the tag is based upon ~master which has your README. Between the two branches everything is there, its just that it needs to be all in one.

Help with registering dub package

2023-04-12 Thread Dmitry Olshansky via Digitalmars-d-learn
Could someone walk me through the steps of publish my dub package? I'm stuck with this: https://code.dlang.org/packages/strand For some reason code.dlang.org cannot find my semver tag I guess. -- Dmitry Olshansky