Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-14 Thread thebluepandabear via Digitalmars-d-learn
On Wednesday, 15 February 2023 at 02:14:30 UTC, Mike Parker wrote: On Wednesday, 15 February 2023 at 01:16:00 UTC, thebluepandabear wrote: I think what you could say is that D lacks _encapsulation_ which is also an OOP concept. So D is partially OOP but not fully OOP due to there being no

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-14 Thread thebluepandabear via Digitalmars-d-learn
Time to move on to OCaml programmers telling us D doesn't have floating point arithmetic because there's no `+.` operator. that's not the same thing though, you've created a great false equivalence! Congrats.

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-14 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 15 February 2023 at 02:14:30 UTC, Mike Parker wrote: On Wednesday, 15 February 2023 at 01:16:00 UTC, thebluepandabear wrote: I think what you could say is that D lacks _encapsulation_ which is also an OOP concept. So D is partially OOP but not fully OOP due to there being no

Combining Templates While Minimizing Bloat

2023-02-14 Thread jmh530 via Digitalmars-d-learn
The code below has two `foo` functions that take slices, one accepts a const(T)* iterator and one accepts a generic Iterator with the property that the slice isn't convertible to the first one. The nice thing about this is that if you pass it with a double* or const(double)*, then it doesn't

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-14 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 15 February 2023 at 01:16:00 UTC, thebluepandabear wrote: I think what you could say is that D lacks _encapsulation_ which is also an OOP concept. So D is partially OOP but not fully OOP due to there being no encapsulation in the language. D does not lack encapsulation, it's

Re: How can I easily determine the last charachter of a file?

2023-02-14 Thread Steven Schveighoffer via Digitalmars-d-learn
```d myFile.seek(-1, SEEK_END); ubyte c[1]; myFile.rawRead(c[]); if(c[0] == '\n') // ends in newline ``` -Steve

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-14 Thread thebluepandabear via Digitalmars-d-learn
On Wednesday, 15 February 2023 at 01:15:09 UTC, thebluepandabear wrote: On Tuesday, 14 February 2023 at 15:34:17 UTC, bachmeier wrote: On Tuesday, 14 February 2023 at 10:16:47 UTC, ProtectAndHide wrote: In any case, there is nothing 'picky' about wanting to be able to explicately 'declare' a

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-14 Thread thebluepandabear via Digitalmars-d-learn
On Tuesday, 14 February 2023 at 15:34:17 UTC, bachmeier wrote: On Tuesday, 14 February 2023 at 10:16:47 UTC, ProtectAndHide wrote: In any case, there is nothing 'picky' about wanting to be able to explicately 'declare' a member of my class type as being private. That to me, is what a

Re: Want a module to import from a sister directork; How?

2023-02-14 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 14 February 2023 at 21:55:24 UTC, Adam D Ruppe wrote: On Tuesday, 14 February 2023 at 21:23:26 UTC, ryuukk_ wrote: module name must correspond to its path this is not true. I thought it had to match, that's interesting

Re: Want a module to import from a sister directork; How?

2023-02-14 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 14 February 2023 at 21:23:26 UTC, ryuukk_ wrote: module name must correspond to its path this is not true.

Re: Want a module to import from a sister directork; How?

2023-02-14 Thread ryuukk_ via Digitalmars-d-learn
Glad it worked! I wonder why DMD doesn't just parse the import and follow its path since module name must correspond to its path Does anyone know?

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-14 Thread ProtectAndHide--- via Digitalmars-d-learn
On Tuesday, 14 February 2023 at 15:34:17 UTC, bachmeier wrote: On Tuesday, 14 February 2023 at 10:16:47 UTC, ProtectAndHide wrote: In any case, there is nothing 'picky' about wanting to be able to explicately 'declare' a member of my class type as being private. That to me, is what a

Re: Want a module to import from a sister directork; How?

2023-02-14 Thread jwatson-CO-edu via Digitalmars-d-learn
On Tuesday, 14 February 2023 at 17:56:39 UTC, ryuukk_ wrote: I think you need to do: ``` rdmd MLP.d -I ANN/ ``` Basically you need to tell the compiler where your imported packages are This did the trick. I did not need it when `utils` was the only local import, but I suppose the compiler

How can I easily determine the last charachter of a file?

2023-02-14 Thread seany via Digitalmars-d-learn
Hello Consider the content of a file First line \n Second line data data data data ... last char My goal is to find out whether the last character is a new line or not. Please not, it will be sufficient if this works on Linux. More specifically I want to insert a new

Re: Want a module to import from a sister directork; How?

2023-02-14 Thread ryuukk_ via Digitalmars-d-learn
I think you need to do: ``` rdmd MLP.d -I ANN/ ``` Basically you need to tell the compiler where your imported packages are

Want a module to import from a sister directork; How?

2023-02-14 Thread jwatson-CO-edu via Digitalmars-d-learn
I have the following directory structure: ``` ANN/ ANN/mathkit/ ANN/mathkit/package.d ANN/utils/ ANN/utils/package.d ANN/MLP.d ``` I have the following in "ANN/mathkit/package.d": ```d module ANN.mathkit; //... /// Local Imports /// import ANN.utils; //... ``` I

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-14 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 14 February 2023 at 10:16:47 UTC, ProtectAndHide wrote: In any case, there is nothing 'picky' about wanting to be able to explicately 'declare' a member of my class type as being private. That to me, is what a programmer should expect to be able to do in a language that says it

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-14 Thread thebluepandabear via Digitalmars-d-learn
On Tuesday, 14 February 2023 at 10:16:47 UTC, ProtectAndHide wrote: On Tuesday, 14 February 2023 at 08:15:37 UTC, Kagamin wrote: My point is you know you're just picky. Well.. it seems to me, that your 'point' is to just have a go at me. In any case, there is nothing 'picky' about wanting

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-14 Thread ProtectAndHide via Digitalmars-d-learn
On Tuesday, 14 February 2023 at 08:15:37 UTC, Kagamin wrote: My point is you know you're just picky. Well.. it seems to me, that your 'point' is to just have a go at me. In any case, there is nothing 'picky' about wanting to be able to explicately 'declare' a member of my class type as

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-14 Thread Kagamin via Digitalmars-d-learn
My point is you know you're just picky.