Overloads not returning appropriate info. [Field reflunkory]
Alex
AJ at gmail.com
Tue Apr 9 20:49:17 UTC 2019
On Tuesday, 9 April 2019 at 18:56:58 UTC, H. S. Teoh wrote:
> On Tue, Apr 09, 2019 at 06:33:21PM +0000, Seb via
> Digitalmars-d-learn wrote:
>> On Tuesday, 9 April 2019 at 16:30:53 UTC, Alex wrote:
>> > On Tuesday, 9 April 2019 at 14:59:03 UTC, Adam D. Ruppe
>> > wrote:
>> > > [...]
>> > I didn't say the language. The point with the language is
>> > that it could have built in semantics to do reflection in a
>> > inform way(__traits is somewhat uniform but messy and then
>> > one has std.traits which then makes it not uniform).
>> >
>> > [...]
>>
>> Have you considered writing a DIP?
>
> I think the original intent was that __traits was supposed to
> be low-level, implementation-specific calls into the compiler,
> while std.traits is supposed to be the user-friendly syntactic
> sugar built on top that user code is supposed to use.
>
> Unfortunately, it turned out that people prefer using __traits
> directly instead, and std.traits hasn't quite been keeping up
> with new __traits (e.g., AFAIK __traits(compiles) does not have
> a std.traits equivalent), and is also less familiar to many
> people, so now we have a mishmash of code sometimes using
> __traits and sometimes std.traits.
>
That may be the case but I recently saw some one here say "All
the roads to hell are paved with good intentions", which isn't
hyperbole. The better the initial plan the better things will
turn out. Planning is the key to success, without it there is
only luck.
My point has been and is that there is a better way that is more
natural. I make no claims about anything else. It may be a cop
out to say something that is a tautology but I make the claim as
an emphasis that I believe that it is more true in this case than
others. i.e., D's traits are PITA. Ok, they are not as bad as
some things but I know they can be better since I have used other
languages that have far more logical reflection(such as C#) than
D.
Because D has such an extensive meta programming language(the
best I've seen for procedural) it needs a well thought out and
natural reflection scheme. traits works but the more I use it the
more I believe it could have been done better. It's one thing to
use it here and there, but when you use it everywhere the issues
multiply.
I think the library I through together at least demonstrates a
much more natural way(and it was just a first attempt without any
planning). I imagine something much better could be created with
some proper planning and teamwork. My impression though is few
people here actually care about such things.
More information about the Digitalmars-d-learn
mailing list