Re: Which TOML package, or SDLang?

2023-01-30 Thread Daren Scot Wilson via Digitalmars-d-learn
On Monday, 30 January 2023 at 17:54:15 UTC, H. S. Teoh wrote: XML is evil. Agreed! I'm going with TOML, community package. It's working, so far.

Assign to Array Column

2023-01-30 Thread Paul via Digitalmars-d-learn
Greetings, for an array byte[3][3] myArr, I can code myArr[0] = 5 and have: 5,5,5 0,0,0 0,0,0 Can I perform a similar assignment to the column? This, myArr[][0] = 5, doesn't work. Thanks!

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

2023-01-30 Thread thebluepandabear via Digitalmars-d-learn
Why do you want a type? I want a type because it gives clear context as to what family the method(s) belongs to, and helps make the code more idiomatic and easy to understand.

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

2023-01-30 Thread thebluepandabear via Digitalmars-d-learn
On Monday, 30 January 2023 at 21:50:03 UTC, thebluepandabear wrote: Use a struct and put `static:` after the opening brace. That's what GC is in core.memory. Using a `struct` for a purely static type would still allow the user to create instances of that `struct`. To bypass that, you'd have

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

2023-01-30 Thread thebluepandabear via Digitalmars-d-learn
Use a struct and put `static:` after the opening brace. That's what GC is in core.memory. Using a `struct` for a purely static type would still allow the user to create instances of that `struct`. To bypass that, you'd have to disable the default constructor -- that then becomes ugly,

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

2023-01-30 Thread Nick Treleaven via Digitalmars-d-learn
On Friday, 20 January 2023 at 11:28:23 UTC, thebluepandabear wrote: ``` final abstract class Algo { void drawLine(Canvas c, Pos from, Pos to) { .. }; } ``` This solution seems like a bit of a hack, which is why I don't like it. Interesting solution if you put `static:` in there.

Re: Which TOML package, or SDLang?

2023-01-30 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jan 30, 2023 at 03:59:52PM +, Adam D Ruppe via Digitalmars-d-learn wrote: > On Monday, 30 January 2023 at 15:37:56 UTC, Guillaume Piolat wrote: > > Why not XML? :) It has comments, you can use backslashes too. > > no kidding, xml is an underrated format. XML is evil. Let me qualify

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

2023-01-30 Thread Ali Çehreli via Digitalmars-d-learn
On 1/29/23 22:09, RTM wrote: > On Saturday, 28 January 2023 at 23:19:35 UTC, ProtectAndHide wrote: > >> That is, you can do OOP without classes > > How so? OOP is about putting objects (data) and behavior (functions) together. > Every OOP definition includes classes OOP is possible in C, which

Re: Which TOML package, or SDLang?

2023-01-30 Thread Adam D Ruppe via Digitalmars-d-learn
On Monday, 30 January 2023 at 15:37:56 UTC, Guillaume Piolat wrote: Why not XML? :) It has comments, you can use backslashes too. no kidding, xml is an underrated format.

Re: Which TOML package, or SDLang?

2023-01-30 Thread Guillaume Piolat via Digitalmars-d-learn
On Monday, 30 January 2023 at 06:38:46 UTC, Daren Scot Wilson wrote: I just realized - it's been ages since I've dealt with config files, beyond editing them as an end user. I work on existing software where someone else made the choiced and wrote the code, or it's a small specialized project

Re: Which TOML package, or SDLang?

2023-01-30 Thread Mathias LANG via Digitalmars-d-learn
On Monday, 30 January 2023 at 06:38:46 UTC, Daren Scot Wilson wrote: So, which package do I use for TOML? I find these three: * toml-foolery (Andrej Petrović) * toml-d, or toml.d (oglu on github) at ver 0.3.0 * toml, (dlang community on github) at ver 2.0.1 I'm guessing from version numbers

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

2023-01-30 Thread RTM via Digitalmars-d-learn
On Monday, 30 January 2023 at 08:20:21 UTC, ProtectAndHide wrote: But there is always 'an ugly way' to do it too: http://www.cs.rit.edu/~ats/books/ooc.pdf Yep, but it’s not OOP per se, just a form of lowering. First CPP implementation was a cross-compiled one.

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

2023-01-30 Thread ProtectAndHide via Digitalmars-d-learn
On Monday, 30 January 2023 at 06:09:56 UTC, RTM wrote: On Saturday, 28 January 2023 at 23:19:35 UTC, ProtectAndHide wrote: That is, you can do OOP without classes How so? Every OOP definition includes classes (encapsulation + inheritance). I didn't say you should do it, just that you can