Re: How should class objects created in betterC be destroyed

2023-11-06 Thread zoe via Digitalmars-d-learn
On Monday, 6 November 2023 at 16:08:41 UTC, ryuukk_ wrote: Here is how adam seems to be doing it: https://github.com/adamdruppe/webassembly/blob/731a7033174127c0a6dd4f23eabdb440adab286b/arsd-webassembly/object.d#L650-L681 Specially here: ```D void destroy(bool initialize = true, T)(T obj) if (

Re: How should class objects created in betterC be destroyed

2023-11-06 Thread Paul Backus via Digitalmars-d-learn
On Monday, 6 November 2023 at 05:30:02 UTC, zoe wrote: I customized object.d in -betterc mode and created NEW templates, with modules I can seemingly create classes without extern(C++) mode, and type conversions in function calls seem to work fine. But when destroy doesn't find a way to call th

Re: Convert String to Date and Add ±N Hours

2023-11-06 Thread Vahid via Digitalmars-d-learn
On Saturday, 4 November 2023 at 19:19:43 UTC, Jonathan M Davis wrote: On Saturday, November 4, 2023 12:11:53 PM MDT Vahid via Digitalmars-d-learn wrote: [...] If you're using D's standard library, you would need to replace the space with a T so that the time format was ISO extended. Then you

Re: How should class objects created in betterC be destroyed

2023-11-06 Thread ryuukk_ via Digitalmars-d-learn
Here is how adam seems to be doing it: https://github.com/adamdruppe/webassembly/blob/731a7033174127c0a6dd4f23eabdb440adab286b/arsd-webassembly/object.d#L650-L681 Specially here: ```D void destroy(bool initialize = true, T)(T obj) if (is(T == class)) { (..) else { // Bypass over

Re: How should class objects created in betterC be destroyed

2023-11-06 Thread ryuukk_ via Digitalmars-d-learn
Please tag your code accordingly, as is it's unreadable ```D // your code here ``` (tick the "Enable Markdown" too, next to the Send button)

Re: Dlang installer with VSCode broken

2023-11-06 Thread ryuukk_ via Digitalmars-d-learn
Looks like his vscode is outdated, make sure your friend has the latest version installed

Re: Is a shorter statement possible in this case?

2023-11-06 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 5 November 2023 at 18:36:40 UTC, Ctn-Dev wrote: I wrote this earlier: [...] `if` runs when both "One" and "Two" are in the given array as intended, but its conditional statement looks verbose. Is there a more concise way of getting the same result? If sorting the arrays is an opt

Re: DUB: Sometimes generates .di file and sometimes do not.

2023-11-06 Thread BoQsc via Digitalmars-d-learn
To test the behaviour of static library. **program.d** ``` module program; import std.stdio; import library; void main(string[] args) { writeln("func(3) = ", library.func(3)); } ``` **Command Line:** ``` dmd "./program.d" "./builds/library.di" "./builds/library.lib" -ofProgram.exe Progra

Re: DUB: Sometimes generates .di file and sometimes do not.

2023-11-06 Thread BoQsc via Digitalmars-d-learn
In summary this is what it all combined could look like. **dub.sdl** ``` name "dheaders" description "generates .di header file for a static library." authors "public domain" copyright "Public Domain. No rights reserved." license "public domain" configuration "staticLibrary" { dflags "-H

Re: DUB: Sometimes generates .di file and sometimes do not.

2023-11-06 Thread BoQsc via Digitalmars-d-learn
Update: To allow only `.di` (D Header) output: Instead of configuration, it would be more correct to make a new `build type`. ``` buildType "headerFileOnly" { extraDependencyFiles "$PACKAGE_DIR/builds/library.di" dflags "-Hf=$PACKAGE_DIR/builds/library.di" dflags "-o-"