UFCS for D
Nick Sabalausky
a at a.a
Thu Mar 29 18:57:38 PDT 2012
"Steven Schveighoffer" <schveiguy at yahoo.com> wrote in message
news:op.wbyg2ywyeav7ka at localhost.localdomain...
>
> For builtin types (such as arrays or numbers), there wouldn't be a module
> that the type was defined. However, object.di is imported by everything,
> so extensions could be put in there.
>
Wait, What? Weren't you strongly *opposed* to this last week when I
suggested it for empty()?
I'm not trying to be an ass about it. Just not sure if you changed your
mind, or I'm missing something, or what.
> One misleading suggestion from the article however, it's not very easy to
> create non-friend non-member functions using UFCS, considering that every
> function in a given module is a friend. In order to do this, you would
> need a helper module for each module that wants to define such non-friend
> functions. Given the above proof, the helper module would also have to be
> imported by the main module.
>
Yea, that occurred to me, too. <wishful musing>I've been starting to think
more and more that the "everything in a module is a friend" was a mistake,
and that we should have instead just had a "module" access specifier like we
have "package".</wishful musing>
More information about the Digitalmars-d-announce
mailing list