[Issue 9065] Please consider adding these std.traits
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Nov 26 08:13:10 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9065
--- Comment #14 from Manu <turkeyman at gmail.com> 2012-11-26 08:13:04 PST ---
(In reply to comment #12)
> (In reply to comment #11)
> > Okay, I've worked my templates a little more, consider these:
> [snip]
>
> 1. I would never agree with isFunction. They introduce huge confusion but has
> no benefit. Blending traits about type and symbol is not a purpose of
> std.traits.
You would never agree with a std.traits to wrap is(x == function)? Why?
It confuses everyone. Nobody expects that overload of meaning.
> 2. isEnum should be separated to isEnumType and isManifestConstant (with better
> name). Blending traits is very poor design.
I've never heard this term 'manifest constant' before today.
Here's a line of code:
enum i = 10;
I (and I presume any sane person) would say "that's an enum!".
I appreciate there is a distinction between an enum type and an enum value, but
they are both called enums, and I doubt any non-D-compiler-developer would
presume otherwise.
I don't care if they are separated, just that the terminology should make
sense.
> And, there is no use case. if you propose an enhancement, you should show one
> or more use cases in order to claim its usefulness.
I work in a studio on highly sensitive proprietary code. Isolating examples out
of context is often difficult, annoying, and very time consuming. I don't have
the time to convince you in this case. However, if there wasn't a use case,
rest assured I wouldn't be posting here, and I wouldn't be wasting consecutive
days of my time on it. I need to know these things, D doesn't provide this
information; it should.
Perhaps this will help:
foreach(m; __traits(allMembers, something))
{
// What on earth is m?
// I think think you can argue this is unconventional code.
// I need to know all sorts of things about m in this context, and I have
absolutely no prior information.
// 'is' traits shouldn't make me jump through bunches of hoops to gather
information.
}
> (I always doubt the reason like "for the newbie". Increase of language newbies
> is not worth than an increase of the design confusion in the standard library.)
Confusion? Surely you mean simplification?
Having 'function' mean 2 to different things in 2 contexts is confusing. Having
enum mean 2 different things in almost precisely the same context is confusing.
std.traits is meant to simplify my code and save me time. In my experience to
date, it's severely lacking.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list