FieldNameTuple!T and std.traits.Fields!T not empty for interfaces
Jonathan M Davis
newsgroup.d at jmdavisprog.com
Thu Jun 6 21:36:41 UTC 2019
On Thursday, June 6, 2019 2:52:42 PM MDT Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 6/6/19 4:49 PM, Steven Schveighoffer wrote:
> > Oh wait! It's not empty, it has an empty string as a single member!
> > That's definitely a bug.
>
> OK, not a bug, but not what I would have expected. From docs:
>
> "If T isn't a struct, class, or union, an expression tuple with an empty
> string is returned."
>
> I wonder why that behavior is there, certainly it's intentional.
I guess that whoever wrote it did that rather than making it an error so
that they wouldn't have to first check whether they were passing a type that
even made sense. It still seems like an odd decision though. Normally, you'd
just require that an appropriate type be passed.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list