On Wednesday, 4 August 2021 at 16:41:04 UTC, Alexandru Ermicioi wrote:

Since you're using classes consider just declaring an interface that denotes that implementor has this field, it would be much easier to check for it, and easier for compiler since it avoids compile time magic.

I am not sure I am following you regarding this one: you mean coding an interface for the sole-purpose to use traits more easily ? I mean, use it to unambiguously discern whether the required member exists since an interface won't have variables nor anything implementation-related which could confuse the check ?

Like coding:

```d
private interface interfaceTickerCustom1 { ... } /// one-parameter granted private interface interfaceTickerCustom2 { ... } /// two-parameters granted

public class classTickerCustomNYSE : interfaceTickerCustom1 {

   this(
      const dstring lstrSymbolID
      ) {

   }

}

public class classTickerCustomNASDAQ : interfaceTickerCustom2 {

   this(
      const dstring lstrSymbolID,
      const dstring lstrCurrencyID
      ) {

   }

}
```

And then checking for classTickerCustom{EchangeID} with traits for the existence of the interface the class is being tied to ?

Is that what you mean ?

Reply via email to