pure, safe and generalized attributes

David Wilson dw at botanicus.net
Fri Apr 4 09:50:35 PDT 2008


On Fri, Apr 4, 2008 at 7:19 AM, Knud Soerensen <4tuu4k002 at sneakemail.com> wrote:
>
>  With all the talk about pure, safed and transitivity.
>  I think the time is right for a discussion about
>  user defined code attributes.
>
>  Code attributes is just meta data for the code.
>  Normally, this meta data is stored in revision systems, databases, in
>  the code comments or just plain left out.
>  But there is some advantages by placing them in the code and letting the
>  compiler take care of them.
>
>  Scott Meyers does a good job of introducing the subject in
>  http://video.google.com/videoplay?docid=-4728145737208991310
>
>  ----
>
>  The simplest use of code attribute I can imagine
>  is a attribute which indicate that this piece of code have been review.
>  It could be defined by.
>  attribute KilroyWasHere;

For all that I'd love to see something like .NET attributes in D, if
it means people starting to mark functions and fields with
[BugFix(1234)] or [ReviewedBy("me")] then count me out! Source files,
i.e. the data structures you feed to a compiler,  really isn't the
place for adding support for ticket tracking or a review process. :)

For the first case, get a revision control system and use its
annotation function (this has the benefit of systematically recording
all changes to every line of code in a file, not just ones some
programmer arbitrarily decided to tag with an attribute). For the
latter case, see something like review-board.org or search Google for
"QA branch". These really aren't good uses of custom attributes at
all.


David.



More information about the Digitalmars-d mailing list