import issue?

2023-11-22 Thread DLearner via Digitalmars-d-learn
Please, Why does: ``` // Test module Ex_mod struct SA { int SAIntFld1; int SAIntFld2; } bool AddEle(ref void* StartPtr, SA PayLoad1) { import core.stdc.stdlib : malloc; struct Ele { SA PayLoad; Ele* EleNxtPtr; Ele* ElePrvPtr; } Ele*ElePtr; Ele*

Re: import issue?

2023-11-22 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
You have two ``SA`` structs, each in different encapsulations. Each of them are different, even if they have similar members. In D types that look the same do not combine, they are distinct. You can see this by comparing the mangling of each. ``pragma(msg, SA.mangleof);``

Re: import issue?

2023-11-22 Thread DLearner via Digitalmars-d-learn
On Wednesday, 22 November 2023 at 16:11:03 UTC, Richard (Rikki) Andrew Cattermole wrote: You have two ``SA`` structs, each in different encapsulations. Each of them are different, even if they have similar members. In D types that look the same do not combine, they are distinct. You can see th

Re: import issue?

2023-11-22 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 23/11/2023 5:34 AM, DLearner wrote: Is the encapsulation issue resolved if the struct itself is held in another module, and imported from that module into both the 'main' and 'Ex_mod' files? Each module is its own encapsulation unit. As long as you are using the same distinct type in both

Re: import issue?

2023-11-22 Thread DLearner via Digitalmars-d-learn
On Wednesday, 22 November 2023 at 16:51:54 UTC, Richard (Rikki) Andrew Cattermole wrote: On 23/11/2023 5:34 AM, DLearner wrote: Is the encapsulation issue resolved if the struct itself is held in another module, and imported from that module into both the 'main' and 'Ex_mod' files? Each modul

Doubt about type Inference on templates

2023-11-22 Thread Antonio via Digitalmars-d-learn
Just for fun, I'm trying to implement an alternative base library to avoid template/mixin/static/traits code with only one objective: make "intelliSense" code analyzers tasks easier. I need "Generics"... but D has not generics: I use templates in the "simplest" possible way I.E.: ```d inte

Re: Doubt about type Inference on templates

2023-11-22 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 22 November 2023 at 17:53:15 UTC, Antonio wrote: Basically, it doesn't know witch version of ```filter``` to use, because it is inferring `i=>i%2==0` is `void` ?!?!?! ``` !()(IIterable!int, void) ``` If I explicitly write `(int i)=>i%2==0`, it compiles correctly again. **Is it

Re: cannot find source code for runtime library file 'object.d'

2023-11-22 Thread thinkunix via Digitalmars-d-learn
denis via Digitalmars-d-learn wrote: On Monday, 20 November 2023 at 07:50:22 UTC, thinkunix wrote: denis via Digitalmars-d-learn wrote: ``` $ zypper install dmd $ dmd main.d Error: cannot find source code for runtime library file 'object.d'     dmd might not be correctly installed. Run 'dmd