Re: Receiving "pthread_mutexattr_init" during compilation when using FileLogger.

2021-06-07 Thread tastyminerals via Digitalmars-d-learn
On Monday, 7 June 2021 at 10:36:23 UTC, Mike Parker wrote: On Monday, 7 June 2021 at 09:29:08 UTC, tastyminerals wrote: I getting ``` import/core/sync/mutex.d(87,36): Error: `pthread_mutexattr_init` cannot be interpreted at compile time, because it has no available source code ``` compile

Re: Receiving "pthread_mutexattr_init" during compilation when using FileLogger.

2021-06-07 Thread Mike Parker via Digitalmars-d-learn
On Monday, 7 June 2021 at 11:31:13 UTC, tastyminerals wrote: It's interesting how there is no information about class instantiation at module level anywhere in the docs. Even the Ali's book does not explicitly say that you cannot instantiate a class this way. Maybe I totally missed it but

Re: Receiving "pthread_mutexattr_init" during compilation when using FileLogger.

2021-06-07 Thread tastyminerals via Digitalmars-d-learn
On Monday, 7 June 2021 at 11:29:44 UTC, tastyminerals wrote: On Monday, 7 June 2021 at 10:36:23 UTC, Mike Parker wrote: On Monday, 7 June 2021 at 09:29:08 UTC, tastyminerals wrote: I getting ``` import/core/sync/mutex.d(87,36): Error: `pthread_mutexattr_init` cannot be interpreted at compile

Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2021-06-07 Thread Prokop Hapala via Digitalmars-d-learn
thanks, evilrat Anyway I tried dagon in past and I don't see why bother with it, better stick with something that can handle industry standard formats such as FBX, another issue is shaders fused in right in the engine. As an alternative the only thing probably worth checking is godot-d which

Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2021-06-07 Thread evilrat via Digitalmars-d-learn
On Monday, 7 June 2021 at 14:02:14 UTC, Prokop Hapala wrote: Basically I'm desperate do find anything which encapsulates OpenGL calls into some nice D-lang classes to learn from it. I don't really want to use Dagon, nor Godot. What I want is to use it as learning resources fro learning

Re: regarding what seems (to me) unnecessary casts on integer expressions

2021-06-07 Thread russhy via Digitalmars-d-learn
Everything is public by default, and you can't overload and derive from structs so final has no effect there less visual noise: ```D struct gudtPosition { void reset() { pintLeft1 = pintTop1 = pintRight1 = pintBottom1 = 0; } private ushort pintLeft1 = 0; private ushort pintTop1 =

is it possible to have a default property for any given class ?

2021-06-07 Thread someone via Digitalmars-d-learn
Consider the following code: ```d class classComputer { private string pstrName; final @property string name() { return this.pstrName; } final @property void name(in string lstrName) { this.pstrName = lstrName; } this( string lstrComputerName ) { this.pstrName

Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2021-06-07 Thread drug via Digitalmars-d-learn
07.06.2021 17:02, Prokop Hapala пишет: Basically I'm desperate do find anything which encapsulates OpenGL calls into some nice D-lang classes Did you try gfm? specifically its 7th version - [gfm7](https://github.com/drug007/gfm7)? It has nice

Re: is it possible to have a default property for any given class ?

2021-06-07 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jun 07, 2021 at 03:26:27PM +, someone via Digitalmars-d-learn wrote: > Consider the following code: > > ```d > class classComputer { [...] > } > > class classComputers { > >classComputers lhs; >classComputers rhs; > >int opApply(int delegate(classComputers) dg) { ///

Re: regarding what seems (to me) unnecessary casts on integer expressions

2021-06-07 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Jun 05, 2021 at 01:46:45AM +, someone via Digitalmars-d-learn wrote: [...] > As I am writing code today I am encountering a lot of these situations. > > cast(ushort)(this.pintBottom1 - 1) > > My first walkaround for this was intuitive: > > this.pintBottom1 - cast(ushort) 1 /// I

Re: how do i fix this node_dlang error?

2021-06-07 Thread frame via Digitalmars-d-learn
On Monday, 7 June 2021 at 02:33:38 UTC, Jack wrote: What am I missing? If this runs under Windows, there is no dlopen(), maybe a wrapper to LoadLibrary() but this will need to call a DllMain() in the DLL if I am not wrong. Is there a DllMain?

Re: is it possible to have a default property for any given class ?

2021-06-07 Thread Jack via Digitalmars-d-learn
On Monday, 7 June 2021 at 15:26:27 UTC, someone wrote: Consider the following code: ```d class classComputer { private string pstrName; final @property string name() { return this.pstrName; } final @property void name(in string lstrName) { this.pstrName = lstrName; } this(

Re: how do i fix this node_dlang error?

2021-06-07 Thread Jack via Digitalmars-d-learn
On Monday, 7 June 2021 at 17:22:48 UTC, MoonlightSentinel wrote: On Monday, 7 June 2021 at 02:33:38 UTC, Jack wrote: What am I missing? Does your code / `node_dlang` initialize Druntime before calling `writeln`? actually i didnt so I just added: ```d shared static this() {

Re: is it possible to have a default property for any given class ?

2021-06-07 Thread someone via Digitalmars-d-learn
On Monday, 7 June 2021 at 15:55:36 UTC, H. S. Teoh wrote: Thanks for your reply. It was very illustrating. It's very simple. Whenever some non-array object appears on the right side of a foreach() statement, the compiler looks for a method on the object called .opApply. If it exists, the loop

Re: is it possible to have a default property for any given class ?

2021-06-07 Thread someone via Digitalmars-d-learn
On Monday, 7 June 2021 at 16:10:08 UTC, Jack wrote: I think you meant to implement ranges? you can implement in the way you wanted: ```foreach(lobjComputer; lobjComputers)``` ... Thanks for your reply ! I am aware that ranges are one of D's gems, I did take an overview of them last night or

Re: how do i fix this node_dlang error?

2021-06-07 Thread MoonlightSentinel via Digitalmars-d-learn
On Monday, 7 June 2021 at 02:33:38 UTC, Jack wrote: What am I missing? Does your code / `node_dlang` initialize Druntime before calling `writeln`? Try replacing the `writeln` with `puts` (from `core.stdc.stdio`) which doesn't require an initialized runtime.

Re: regarding what seems (to me) unnecessary casts on integer expressions

2021-06-07 Thread someone via Digitalmars-d-learn
On Monday, 7 June 2021 at 12:53:29 UTC, russhy wrote: Everything is public by default, and you can't overload and derive from structs so final has no effect. There less visual noise. Gotcha ! I started using final (and the like) on classes a couple of days ago and I suppose I unconsciously

Re: best approach to code hierarchical classes ?

2021-06-07 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 8 June 2021 at 01:17:05 UTC, someone wrote: On Tuesday, 8 June 2021 at 00:54:41 UTC, someone wrote: Are there alternatives to nested classes for such scenarios ? Self-reply: I created two files for classComputers and classComputer and I replaced the nested-classComputer code

how to enable safeD ? dmd.conf ? dmd switch ?

2021-06-07 Thread someone via Digitalmars-d-learn
https://dlang.org/articles/safed.html https://dlang.org/dmd-linux.html#switches http://ddili.org/ders/d.en/functions_more.html Neither man dmd nor man dmd.conf appear to have a related/switch setting. Does it means safeD is achieved by placing @safe attributes all over the place ? Or is it

Re: how to enable safeD ? dmd.conf ? dmd switch ?

2021-06-07 Thread rikki cattermole via Digitalmars-d-learn
On 08/06/2021 2:47 PM, someone wrote: https://dlang.org/articles/safed.html https://dlang.org/dmd-linux.html#switches http://ddili.org/ders/d.en/functions_more.html Neither man dmd nor man dmd.conf appear to have a related/switch setting. Does it means safeD is achieved by placing @safe

Re: how do i fix this node_dlang error?

2021-06-07 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 8 June 2021 at 00:58:12 UTC, Jack wrote: the dll which I was just build with dub command? how I have a version mismatch if they're the very same file? Electron embeds node and does not use whatever you have on your system. So if there’s a mismatch between the embedded version and

Re: how to enable safeD ? dmd.conf ? dmd switch ?

2021-06-07 Thread Jack via Digitalmars-d-learn
On Tuesday, 8 June 2021 at 03:32:31 UTC, someone wrote: On Tuesday, 8 June 2021 at 02:59:28 UTC, rikki cattermole wrote: SafeD is an old name given to the attributes @safe @trusted @system. I have the Alexandrescu's book on hand so that explains it. There is no switch nor any special

Re: how to enable safeD ? dmd.conf ? dmd switch ?

2021-06-07 Thread someone via Digitalmars-d-learn
On Tuesday, 8 June 2021 at 04:24:38 UTC, H. S. Teoh wrote: Annotate your functions with @safe. https://dlang.org/spec/function.html#function-safety Best Practices: Mark as many functions @safe as practical. ACK

Re: how do i fix this node_dlang error?

2021-06-07 Thread NotSpooky via Digitalmars-d-learn
On Tuesday, 8 June 2021 at 03:04:39 UTC, Mike Parker wrote: On Tuesday, 8 June 2021 at 00:58:12 UTC, Jack wrote: the dll which I was just build with dub command? how I have a version mismatch if they're the very same file? Electron embeds node and does not use whatever you have on your

Re: how do i fix this node_dlang error?

2021-06-07 Thread Jack via Digitalmars-d-learn
On Monday, 7 June 2021 at 20:13:03 UTC, frame wrote: On Monday, 7 June 2021 at 02:33:38 UTC, Jack wrote: What am I missing? If this runs under Windows, there is no dlopen(), maybe a wrapper to LoadLibrary() but this will need to call a DllMain() in the DLL if I am not wrong. Is there a

Asking for D solution

2021-06-07 Thread Alexander Tretyak via Digitalmars-d-learn
Hello. I'm looking for someone who has plenty of experience in the D programming language. I have some task, which I hope will be added to Rosetta Code. This task is based on pqmarkup, and is called pqmarkup-lite. The specialty of this task is formatting characters of pqmarkup {paired

best approach to code hierarchical classes ?

2021-06-07 Thread someone via Digitalmars-d-learn
Consider the following code in what I used nested-classes for the first time within D: ```d import std.string; import std.stdio; class classComputers { classComputers lhs; classComputers rhs; int opApply(int delegate(classComputer) dg) { /// boilerplate code to handle the class's

Re: best approach to code hierarchical classes ?

2021-06-07 Thread someone via Digitalmars-d-learn
On Tuesday, 8 June 2021 at 02:05:27 UTC, Paul Backus wrote: Your module and class are both named `classComputers`, with an `s` at the end. You should change one of the to have a different name so that there's no ambiguity. dmd output: ./dm.d(49): Error: undefined identifier `classComputer`

Re: how to enable safeD ? dmd.conf ? dmd switch ?

2021-06-07 Thread someone via Digitalmars-d-learn
On Tuesday, 8 June 2021 at 02:59:28 UTC, rikki cattermole wrote: SafeD is an old name given to the attributes @safe @trusted @system. I have the Alexandrescu's book on hand so that explains it. There is no switch nor any special behavior now that it has long been added to mainline D. So

Re: how to enable safeD ? dmd.conf ? dmd switch ?

2021-06-07 Thread someone via Digitalmars-d-learn
On Tuesday, 8 June 2021 at 03:54:47 UTC, Jack wrote: better read carefully how the attribute work Good advice. I think I am going too fast. Thank you :)

Re: how to enable safeD ? dmd.conf ? dmd switch ?

2021-06-07 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jun 08, 2021 at 02:47:18AM +, someone via Digitalmars-d-learn wrote: > https://dlang.org/articles/safed.html > https://dlang.org/dmd-linux.html#switches > http://ddili.org/ders/d.en/functions_more.html > > Neither man dmd nor man dmd.conf appear to have a related/switch > setting. >

Re: how do i fix this node_dlang error?

2021-06-07 Thread Mike Parker via Digitalmars-d-learn
On Monday, 7 June 2021 at 22:24:03 UTC, Jack wrote: I think the entry point function is ```void atStart(napi_env env) {}``` so there's no DllMain... DLLMain is not strictly required. It's called by the system loader when the DLL is first loaded into the process. The MainFunction for node

Re: how do i fix this node_dlang error?

2021-06-07 Thread MoonlightSentinel via Digitalmars-d-learn
On Monday, 7 June 2021 at 19:03:44 UTC, Jack wrote: actually i didnt so I just added: ```d shared static this() { Runtime.initialize(); } shared static ~this() { Runtime.terminate(); } ``` but it didn't change anything That doesn't work because `Runtime.initialize()` is

Re: how do i fix this node_dlang error?

2021-06-07 Thread Jack via Digitalmars-d-learn
On Monday, 7 June 2021 at 20:13:03 UTC, frame wrote: On Monday, 7 June 2021 at 02:33:38 UTC, Jack wrote: What am I missing? If this runs under Windows, there is no dlopen(), maybe a wrapper to LoadLibrary() but this will need to call a DllMain() in the DLL if I am not wrong. Is there a

Re: how do i fix this node_dlang error?

2021-06-07 Thread Jack via Digitalmars-d-learn
On Monday, 7 June 2021 at 20:37:19 UTC, MoonlightSentinel wrote: On Monday, 7 June 2021 at 19:03:44 UTC, Jack wrote: actually i didnt so I just added: ```d shared static this() { Runtime.initialize(); } shared static ~this() { Runtime.terminate(); } ``` but it didn't change

Re: best approach to code hierarchical classes ?

2021-06-07 Thread someone via Digitalmars-d-learn
On Tuesday, 8 June 2021 at 00:54:41 UTC, someone wrote: Are there alternatives to nested classes for such scenarios ? Self-reply: I created two files for classComputers and classComputer and I replaced the nested-classComputer code within classComputers with: import classComputers; But it

Re: regarding what seems (to me) unnecessary casts on integer expressions

2021-06-07 Thread someone via Digitalmars-d-learn
On Monday, 7 June 2021 at 14:12:14 UTC, H. S. Teoh wrote: Here's my solution to D's short integer cast-madness: abstract it away in an infectious wrapper type. Your workaround seems interesting. Will look further into the concept in the coming days. I am learning the D-ways and there's so

Re: how do i fix this node_dlang error?

2021-06-07 Thread Jack via Digitalmars-d-learn
On Tuesday, 8 June 2021 at 00:00:50 UTC, Mike Parker wrote: On Monday, 7 June 2021 at 22:24:03 UTC, Jack wrote: I think the entry point function is ```void atStart(napi_env env) {}``` so there's no DllMain... DLLMain is not strictly required. It's called by the system loader when the DLL

Receiving "pthread_mutexattr_init" during compilation when using FileLogger.

2021-06-07 Thread tastyminerals via Digitalmars-d-learn
I getting ``` import/core/sync/mutex.d(87,36): Error: `pthread_mutexattr_init` cannot be interpreted at compile time, because it has no available source code ``` compile time error. One of those D exceptions which doesn't say where it happened in your code so you need to comment out the

Re: Receiving "pthread_mutexattr_init" during compilation when using FileLogger.

2021-06-07 Thread Mike Parker via Digitalmars-d-learn
On Monday, 7 June 2021 at 09:29:08 UTC, tastyminerals wrote: I getting ``` import/core/sync/mutex.d(87,36): Error: `pthread_mutexattr_init` cannot be interpreted at compile time, because it has no available source code ``` compile time error. One of those D exceptions which doesn't say where

Re: How to cross build a RISC-V target betterC code using LDC on x86-64 machine

2021-06-07 Thread Kagamin via Digitalmars-d-learn
https://forum.dlang.org/post/koxqrqqzadfefbgkd...@forum.dlang.org