Re: __traits() to get parameter details only ? ... hasMember looks up everything within

2021-08-05 Thread someone via Digitalmars-d-learn
On Thursday, 5 August 2021 at 15:23:24 UTC, Ali Çehreli wrote: As I understand it, @property is discouraged by the community. That's what I say here: http://ddili.org/ders/d.en/property.html#ix_property.@property I knew I have read it somewhere ... thanks for the clarification Ali !

Re: __traits() to get parameter details only ? ... hasMember looks up everything within

2021-08-05 Thread Ali Çehreli via Digitalmars-d-learn
On 8/4/21 7:21 PM, someone wrote: > somewhere I read > Ali saying there's nothing wrong implementing properties the old-way via > functions because @property has nothing special about it but I can't > state where I read what I am stating so take it with a grain of salt. As I understand it, @prop

Re: __traits() to get parameter details only ? ... hasMember looks up everything within

2021-08-04 Thread someone via Digitalmars-d-learn
On Thursday, 5 August 2021 at 01:47:36 UTC, Alexandru Ermicioi wrote: On Wednesday, 4 August 2021 at 22:28:53 UTC, someone wrote: Is that what you mean ? Not really. I was assuming you were talking about @property methods, and if so you could declare such cases: ``` interface HasMutableLstr

Re: __traits() to get parameter details only ? ... hasMember looks up everything within

2021-08-04 Thread Alexandru Ermicioi via Digitalmars-d-learn
On Wednesday, 4 August 2021 at 22:28:53 UTC, someone wrote: Is that what you mean ? Not really. I was assuming you were talking about @property methods, and if so you could declare such cases: ``` interface HasMutableLstrSymbolId { @property lstrSymbolId(); @property lstrSymbolId(string id

Re: __traits() to get parameter details only ? ... hasMember looks up everything within

2021-08-04 Thread someone via Digitalmars-d-learn
On Wednesday, 4 August 2021 at 22:22:29 UTC, Adam D Ruppe wrote: On Wednesday, 4 August 2021 at 22:01:21 UTC, someone wrote: No. I didn't know it ever existed :( It is good to look at the source code implementations of some of those things too. Most are built out of language features and som

Re: __traits() to get parameter details only ? ... hasMember looks up everything within

2021-08-04 Thread someone via Digitalmars-d-learn
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

Re: __traits() to get parameter details only ? ... hasMember looks up everything within

2021-08-04 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 4 August 2021 at 22:01:21 UTC, someone wrote: No. I didn't know it ever existed :( It is good to look at the source code implementations of some of those things too. Most are built out of language features and some of it is simpler to use directly (and some of it are pretty tri

Re: __traits() to get parameter details only ? ... hasMember looks up everything within

2021-08-04 Thread someone via Digitalmars-d-learn
On Wednesday, 4 August 2021 at 16:41:04 UTC, Alexandru Ermicioi wrote: On Wednesday, 4 August 2021 at 15:08:24 UTC, someone wrote: However, __traits(hasMember, ...) checks for the existence of anything labeled lstrCurrencyID within the class (eg: unrelated variables with same name; not gonna h

Re: __traits() to get parameter details only ? ... hasMember looks up everything within

2021-08-04 Thread someone via Digitalmars-d-learn
On Wednesday, 4 August 2021 at 20:13:53 UTC, Steven Schveighoffer wrote: On 8/4/21 11:08 AM, someone wrote: Have you looked at [std.traits](https://dlang.org/phobos/std_traits.html) at all? It does a lot of stuff, including giving you parameter names and types. No. I didn't know it ever exi

Re: __traits() to get parameter details only ? ... hasMember looks up everything within

2021-08-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/4/21 11:08 AM, someone wrote: However, __traits(hasMember, ...) checks for the existence of anything labeled lstrCurrencyID within the class (eg: unrelated variables with same name; not gonna happen, but, I like to code it the right way); so, question is: is there any way to search the pa

Re: __traits() to get parameter details only ? ... hasMember looks up everything within

2021-08-04 Thread Alexandru Ermicioi via Digitalmars-d-learn
On Wednesday, 4 August 2021 at 15:08:24 UTC, someone wrote: However, __traits(hasMember, ...) checks for the existence of anything labeled lstrCurrencyID within the class (eg: unrelated variables with same name; not gonna happen, but, I like to code it the right way); so, question is: is there

__traits() to get parameter details only ? ... hasMember looks up everything within

2021-08-04 Thread someone via Digitalmars-d-learn
I have the following chunk of code that needs to conditionally instantiate existing classes (at compilation time) named classTickerCustom{ExchangeID} with one or ... two parameters (if any); eg: ```d /// securities trading on exchange primary currency; eg: USD ... = new classTickerCustomNYSE(