@api: One attribute to rule them All

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 6 00:16:29 PST 2015


On Mon, 05 Jan 2015 21:14:58 +0000
Zach the Mystic via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

> Hello everybody. My name is Zach, and I have a suggestion for the 
> improvement of D. I've been looking at the following stalled pull 
> request for a while now:
> 
> https://github.com/D-Programming-Language/dmd/pull/1877

heh. i did a little hack based on this patch: autoinference is turned
on only for `private auto`. i also added a bunch of UDAs to control the
process: `@inferattr` (can be applied to any function), `@notinferattr`,
`@canthrow`, `@impure` and `@gc` (to control inference).

any explicit attribute on function will block inference too.

as druntime and phobos has no `private auto` which is not templated or
without explicit attribues, it compiles fine. and for my code i have
some control.

this feature can be poorly designed, but as it doesn't conflict with
most of the existing code, i'm happy with it. one should be carefull
with templates calling private functions with inferred attributes (it
breaks linking -- for obvious reason), but it's ok for me. `private
auto` is so ugly that it will rise my alarm level anyway. i mean
"function returning 'auto' is suspicious".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150106/4f5b7fab/attachment.sig>


More information about the Digitalmars-d mailing list