monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] Re: Making vocab-from-string constructors explicit?


From: Zack Weinberg
Subject: Re: [Monotone-devel] Re: Making vocab-from-string constructors explicit?
Date: Fri, 26 Jan 2007 16:04:16 -0800

On 1/26/07, Graydon Hoare <address@hidden> wrote:
Zack Weinberg wrote:
> I tried to [make vocab-from-string constructors explicit] once
> before.  I found some real, if probably harmless, bugs doing it
> (things being converted to types they honestly weren't) and I
> think it's a great idea, but I gotta warn you that the fallout
> will be immense.  I gave up on it just because it was too much
> work.

Yeah, probably a lot of tedious work, but I'm in favour too.

It occurs to me that it could be done incrementally, by writing in
vocab_macros.hh things like

#define hh_ENCODING(enc) \
 ... \
 class enc { \
 ... \
   VOCAB_EXPLICIT enc(std::string const & s); \
 ...

and then in vocab_terms.hh you have

#define VOCAB_EXPLICIT explicit
... all the vocab that's been converted ...
#undef VOCAB_EXPLICIT
#define VOCAB_EXPLICIT // nothing
... all the vocab that hasn't been converted yet ...
#undef VOCAB_EXPLICIT

Naturally, once all the terms have been converted, we replace
VOCAB_EXPLICIT with plain explicit and get rid of the #defines.  Also,
if this is done, it would probably be best to convert the terms in
strictly the order that they appear in vocab_terms.hh, to minimize
rearrangements of that file.

zw




reply via email to

[Prev in Thread] Current Thread [Next in Thread]