pure, safe and generalized attributes

Knud Soerensen 4tuu4k002 at sneakemail.com
Sat Apr 5 08:59:11 PDT 2008


David Wilson wrote:
> 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.
> 
Yes, if you only read the part of my post that you have cited
then there is no point of implementing it.

That why I write the you can do that with comment as well.

The real power comes when you utilise the compiler to ensure
the transitivity constraint of the attribute, something most revision
control system can't do and something I think will be very helpful when
dealing with big code bases and/or big teams.









More information about the Digitalmars-d mailing list