Attribute inference for auto functions?
Dmitry Olshansky
dmitry.olsh at gmail.com
Tue Apr 16 10:06:05 PDT 2013
16-Apr-2013 19:22, Andrei Alexandrescu пишет:
> There's a discussion that may be of interest to the larger community:
> https://github.com/D-Programming-Language/dmd/pull/1877
>
> Andrei
In the same vane - how about attribute inference for "ordinary" functions?
I recall that just a month ago I had an interesting case - a normal
function inside of a templated struct. The thing is that depending on
some parameters (of struct) it could be safe or not. But it's not a
template itself and its return type is always bool.
In the end I just added an empty CT parameter set making it a template.
Questions are - why are we hell bent on the `auto' return type being a
marker? What are the other good markers out there? Should we pick
anything else for this auto-magic or let the programmer use some
wild-card marker explicitly?
If we let a bunch of arcane rules govern the inference that would be a
failure. On the other hand not doing it where makes sense would be a
failure to realize the benefits of annotations ('cause nobody bothers
adding them explicitly).
--
Dmitry Olshansky
More information about the Digitalmars-d
mailing list