Subject: Re: UT_Pair car and cdr
From: Dom Lachowicz (dominicl@seas.upenn.edu)
Date: Thu May 31 2001 - 21:23:41 CDT
Sorry, Mike for CC'ing you but my mail *still* isn't going through, much to my
dismay. Please forward this to the list if it doesn't get through.
Ok, everyone here has some valid points. It's important to notice design
patterns and similarities used by languages, whether that language be Lisp,
C++, Java, etc... each has its own ways of generally solving any specific
problem set. Many of these patterns are shared between languages.
However, C++'s STL has an analog of our UT_Pair - it's std::pair. Lisp's car
and cdr are a great analogy to use here, but no better (and arguably much
worse) than std::pair. Seeing that we are a C++ app, we should strive to fit in
with the C++ mantra and design patterns and other such conventions.
Mike or Pat, please change car and cdr to match std::pair's impl (1st && 2nd).
If you're feeling ambitious, code in a version which is implemented on top of
the STL. Look at UT_Vector for an example of how to do this.
What's in a name? A lot, actually.
Take care,
Dom
Quoting Mike Nordell <tamlin@algonet.se>:
> Patrick Lam wrote:
> [Mike informing of the C++ way]
> >
> > I don't like first and second. I think we should keep 'car' and
> > 'cdr'. Irrational? Yes. So what?
>
> Perhaps if we start to think about other maintenance programmers down
> the
> road...
>
> AbiWord is implemented in C++. As such, I'm not especially humble in my
> opinion that we should use established C++ conventions. Like has nothing
> to
> do with it.
> When in Rome...
>
> To me it seems like plain obfuscation to call the two elements of a pair
> "car" and "cdr". These TLAs has absolutely no meaning in C++, not to
> mention
> the fact that they are *completely wrong* to use in a "pair". Those
> other
> maintenance programmers will also ask this question again and again. Is
> that
> a Good Thing? Even in the light that using "first" and "second" would
> remove
> all shadows of a dubt?
>
> I hope this answers your "So what?".
>
> /Mike
>
>
>
This archive was generated by hypermail 2b25 : Fri Jun 01 2001 - 17:28:39 CDT