Re: dmd 2.099 regression: unittest -checkaction=context and import std.regex cause lots of undefined references

2022-11-17 Thread Gavin Ray via Digitalmars-d-learn
On Monday, 14 November 2022 at 20:37:12 UTC, kdevel wrote: On Monday, 14 November 2022 at 17:08:38 UTC, Gavin Ray wrote: Just came here to say I hit the same bug, here's my import list: * https://issues.dlang.org/show_bug.cgi?id=19937 object._d_assert_fail linker error if compiling with

Can I start a process 'std.process.spawnProcess' with a different process group id other than the parent id?

2022-11-17 Thread Mina via Digitalmars-d-learn
Doing my research, the only option I see is by using 'setpgid' from 'core.sys.posix.unistd' and setting the foreground process using 'tcsetpgrp' from the same module, but I don't know how to go about doing that with the 'std.process.spawnProcess', I'm writing a shell and the purpose of this is

Re: Need Advice: Union or Variant?

2022-11-17 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Nov 17, 2022 at 10:16:04PM +, jwatson-CO-edu via Digitalmars-d-learn wrote: > On Thursday, 17 November 2022 at 21:05:43 UTC, H. S. Teoh wrote: [...] > > struct Atom { > > F_Type kind; > > union { // anonymous union > > Atom*

Re: Need Advice: Union or Variant?

2022-11-17 Thread jwatson-CO-edu via Digitalmars-d-learn
On Thursday, 17 November 2022 at 21:19:56 UTC, Petar Kirov [ZombineDev] wrote: On Thursday, 17 November 2022 at 20:54:46 UTC, jwatson-CO-edu wrote: I have an implementation of the "[Little Scheme](https://mitpress.mit.edu/9780262560993/the-little-schemer/)" educational programming language

Re: Need Advice: Union or Variant?

2022-11-17 Thread jwatson-CO-edu via Digitalmars-d-learn
On Thursday, 17 November 2022 at 21:05:43 UTC, H. S. Teoh wrote: Question: **Where do I begin my consolidation of space within `Atom`? Do I use unions or variants?** In this case, since you're already keeping track of what type of data is being stored in an Atom, use a union:

"Little Scheme" and PL Design (Code Critique?)

2022-11-17 Thread jwatson-CO-edu via Digitalmars-d-learn
I just pushed a D implementation of "[Little Scheme](https://mitpress.mit.edu/9780262560993/the-little-schemer/)", which is a limited educational version of [Scheme](https://en.wikipedia.org/wiki/Scheme_(programming_language)), to [GitHub](https://github.com/jwatson-CO-edu/SPARROW). _Here I

Re: Need Advice: Union or Variant?

2022-11-17 Thread Petar via Digitalmars-d-learn
On Thursday, 17 November 2022 at 20:54:46 UTC, jwatson-CO-edu wrote: I have an implementation of the "[Little Scheme](https://mitpress.mit.edu/9780262560993/the-little-schemer/)" educational programming language written in D, [here](https://github.com/jwatson-CO-edu/SPARROW)". It has many

Re: Need Advice: Union or Variant?

2022-11-17 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Nov 17, 2022 at 08:54:46PM +, jwatson-CO-edu via Digitalmars-d-learn wrote: [...] > ```d > enum F_Type{ > CONS, // Cons pair > STRN, // String/Symbol > NMBR, // Number > EROR, // Error object > BOOL, // Boolean value > FUNC, // Function > } > > struct Atom{ >

Need Advice: Union or Variant?

2022-11-17 Thread jwatson-CO-edu via Digitalmars-d-learn
I have an implementation of the "[Little Scheme](https://mitpress.mit.edu/9780262560993/the-little-schemer/)" educational programming language written in D, [here](https://github.com/jwatson-CO-edu/SPARROW)". It has many problems, but the one I want to solve first is the size of the "atoms"

Re: How do you return a subclass instance from a base class method?

2022-11-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/16/22 11:25 PM, Daniel Donnelly wrote: I have SubclassOf derived from PosetRelation.  For any poset relation, the transitivity law applies, however, I'd like to return the correct type: ```    PosetRelation transitivity(PosetRelation R, PosetRelation S)    {   if (R.op == S.op)   

Re: How do you return a subclass instance from a base class method?

2022-11-17 Thread MorteFeuille123 via Digitalmars-d-learn
On Thursday, 17 November 2022 at 06:48:13 UTC, Daniel Donnelly, Jr. wrote: On Thursday, 17 November 2022 at 05:21:05 UTC, MorteFeuille123 wrote: On Thursday, 17 November 2022 at 04:25:13 UTC, Daniel Donnelly, Jr. wrote: [...] You can use TypeInfoClass: [...] I don't get it - you never

Re: Is defining get/set methods for every field overkill?

2022-11-17 Thread Dukc via Digitalmars-d-learn
On Thursday, 17 November 2022 at 04:39:35 UTC, thebluepandabear wrote: I am debating whether or not I should add getter methods to these properties. On one hand, it will inflate the codebase by a lot, on the other hand -- in other languages like Java it is a good practice D has far less need

Re: Is defining get/set methods for every field overkill?

2022-11-17 Thread matheus via Digitalmars-d-learn
On Thursday, 17 November 2022 at 04:39:35 UTC, thebluepandabear wrote: ... It's not a lot of code that has been added but if you have a class with say 10 different fields, adding getter methods would definitely increase the code size by a lot, so what are you guys thoughts on this? Food for

Re: Is defining get/set methods for every field overkill?

2022-11-17 Thread thebluepandabear via Digitalmars-d-learn
(and will never need) that controlled access. Thanks. BTW the code is not Java, it is 100% D.

Re: Is defining get/set methods for every field overkill?

2022-11-17 Thread via Digitalmars-d-learn
On Thursday, 17 November 2022 at 04:39:35 UTC, thebluepandabear wrote: I am creating a TUI library and I have a class with the following constant fields: ``` class Label : Renderable { const string text; const TextAlignment textAlignment; const Color color; this(Dimensions