On Thu, Feb 25, 2010 at 11:13 PM, Petr Rockai <[email protected]> wrote:

> Hi,
>
> Ganesh Sittampalam <[email protected]> writes:
> >>> hardcoded "_darcs/pristine.hashed" is not a good standard, IMO
> >> Dunno. It's easier to write this way and it can't be changed most of the
> >> time (only when we break backward compatibility) and is easy to grep
> >> anyway. It also avoids an extra lookup when reading the code.
> >
> > I think we need to have a separate discussion on darcs-users to establish
> the
> > standard one way or another.
>
> it seems we need a decision whether we should use some sort of
> abstraction over "_darcs/foo" (like a global constant, darcsdir and
> concatenation, or something a little smarter or whatever).
>
> Personally, I don't see a *pragmatic* reason to have this
> abstraction. It neither saves any space/typing nor is it useful to make
> things easier to change coherently (which are the two usual reasons for
> abstracting things). On the other hand, it might make reading source a
> little harder ("what exactly does that constant mean?" ...).
>

One of the pragmatic reasons I can think of off the top of my head is that
using a named constant allows static analysis.  It's easy to type something
like "_dracs/pristine.hashed" or "_darcs/pirstine.hashed" which is a typo
that won't be caught until testing.  Combine that typo with a branch that is
rarely executed and it's likely to wind up in an end user's hands.  Whereas,
dracsdir would be caught at compile time regardless of our test suite.

Another reason to prefer using a named constant here is the DRY principle.
 Which I personally think is valuable on a code base as large as darcs.

http://en.wikipedia.org/wiki/Don't_repeat_yourself

I don't think we need to go to extremes over this, but it seems like a "wise
practice" and one we shouldn't intentionally violate.

Jason
_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to