Re: Unqualified class name

2021-08-21 Thread Jeremy T. Gibson via Digitalmars-d-learn
On Saturday, 21 August 2021 at 18:45:07 UTC, jfondren wrote: On Saturday, 21 August 2021 at 17:33:51 UTC, Jeremy T. Gibson wrote: is there a simple way to get the unqualified name of a class at runtime without having to pass it through std.format? `typeid(class).name` always yields the full cl

Re: Unqualified class name

2021-08-21 Thread Jeremy T. Gibson via Digitalmars-d-learn
On Saturday, 21 August 2021 at 18:27:34 UTC, Ali Çehreli wrote: return __traits(identifier, typeof(this)); That works perfectly! Thanks. =)

Unqualified class name

2021-08-21 Thread Jeremy T. Gibson via Digitalmars-d-learn
I saw this thread -- https://forum.dlang.org/post/hdkvezicxfvehbtvj...@forum.dlang.org -- which works at compile time (although templating seems like overkill for my purpose), but is there a simple way to get the unqualified name of a class at runtime without having to pass it through std.form

Re: Any way to create derived classes from Exception with canned messages?

2021-07-31 Thread Jeremy T. Gibson via Digitalmars-d-learn
On Saturday, 31 July 2021 at 11:30:06 UTC, Adam D Ruppe wrote: On Saturday, 31 July 2021 at 08:25:56 UTC, Jeremy T. Gibson wrote: Now, https://github.com/dlang/druntime/blob/master/src/object.d clearly expresses that the constructors of Exception are @nogc. That doesn't mean your constructors

Any way to create derived classes from Exception with canned messages?

2021-07-31 Thread Jeremy T. Gibson via Digitalmars-d-learn
Is there any way to go about making derived Exception classes which produce a passed error message plus a hard-coded annotation string provided by the derived class, allowing me to use both a consistent error message suffix plus a programmer-specified error message? I'm running into a problem