@safe(bool)

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 22 08:50:52 PDT 2017


On Tuesday, August 22, 2017 09:11:13 Steven Schveighoffer via Digitalmars-d 
wrote:
> On 8/21/17 9:20 PM, Jonathan M Davis via Digitalmars-d wrote:
> > Regardless, it means that I would need to run a tool to figure out which
> > attributes actually applied to a function rather than just reading it
> > like I could do now. And the fact that this is can be done with UDAs
> > right now is _not_ a plus. I can understand wanting to reduce the
> > number of attributes being manually applied to functions, but I think
> > that hiding them with aliases and/or combined attributes is a
> > maintenance nightmare and would argue that it's just plain bad
> > practice.
>
> Not for or against the DIP, but this is already the case, due to block
> attributes. I have to search around the file to find out whether pure:
> is at the top, etc. In fact, I've made recommendations many times on PRs
> to add an attribute to a function, to find out it's already handled at
> the top.
>
> I would think documentation generation should solve the issues.

Honestly, I tend to be against block attributes for this very reason, but at
least with block attributes, you can grep/search the file and find the
information. With this DIP, you potentially have to go looking in other
libraries to figure out which attributes actually apply, and you have to
track down every attribute on a function just to figure out whether a
built-in attribute applies to it. And I bet the documentation generation (at
least as it stands) would just put the custom attributes on there and not
translate them to their constituent attributes. But even if it put all of
the attributes on there individually, honestly, I think that it's a huge
negative if I have to run the documentation generation to figure out what
some code is doing. IMHO, I should be able to read the code and see what
it's doing without running extra tools or searching through several other
projects. Sometimes (particularly with more complicated code where you have
to understand other functionality to understand the stuff in front of you),
life doesn't work that way, but that should be the goal. And aliasing and
combining attributes goes completely against that goal. Stuff like block
attributes already harm it, but at least they're localized.

- Jonathan M Davis



More information about the Digitalmars-d mailing list