Embrace the from template?
Mike Franklin
slavo5150 at yahoo.com
Fri Aug 24 11:25:07 UTC 2018
On Friday, 24 August 2018 at 06:41:35 UTC, Jonathan Marler wrote:
> One idea is we could add this template to `object.d`. This
> would allow it to be used from any module that uses druntime
> without having to import it first. The template itself is also
> very friendly to "bloat" because it only has a single input
> parameter which is just a string, extremely easy to memoize.
> Also, unless it is instantiated, adding it to object.d will
> have virtually no overhead (just a few AST nodes which would
> dwarfed by what's already in object.d). It would also be very
> easy to add, a single PR with 4 lines of code to druntime and
> we're done.
I don't know. It's not a bad idea, but I don't consider it a
major enabler either. It's easy enough to just cut and paste it
to one's arsenal, though I understand the inconvenience of having
to maintain it in multiple projects.
One thing to consider is `from` is a *very* general word, and if
it's placed in object.d it might cause naming conflicts. I'd
like the name to be more specific, but I know how such naming
discussions tend to go.
Mike
More information about the Digitalmars-d
mailing list