I'm wondering why the Common Lisp standard defines "define-condition"
and not "defcondition"?
Is there's a convention for using "define-*" rather than "def*"
for function names?
--
Frederic Brunel
Frederic Brunel <···············@in-fusio.com> wrote:
> Is there's a convention for using "define-*" rather than "def*"
> for function names?
My impression is that:
a) If the name is truncated use def.
b) If the name contains slashes use define.
This leaves untrancated names without slahes - like condition - without a
clear guideline, and then it's presumably down to aesthetics.
A stronger version would be to say "use define if and only if the name
contains slashes", which is nice in the sense that it always tells you
what to do, and doesn't go wrong -- but it also won't produce results
identical with CL itself, since you'd end up with defcondition.
However if there is true consensus to be found, my suspicion is that it
centers around:
"What ever you do, don't ever do def-*."
Then again, there are plenty of packages that violate this out there, some
of them quite prominent. ;-)
Cheers,
-- Nikodemus
Frederic Brunel wrote:
> I'm wondering why the Common Lisp standard defines "define-condition"
> and not "defcondition"?
>
> Is there's a convention for using "define-*" rather than "def*"
> for function names?
My guess is:
- If you are writing code during the 60's and 70's, use "def*".
- If you are writing code during the 80's and 90's, use "define-*",
unless you're sentimental.
Pascal
--
Pascal Costanza University of Bonn
···············@web.de Institute of Computer Science III
http://www.pascalcostanza.de R�merstr. 164, D-53117 Bonn (Germany)
1st European Lisp and Scheme Workshop
June 13 - Oslo, Norway - co-located with ECOOP 2004
http://www.cs.uni-bonn.de/~costanza/lisp-ecoop/
Pascal Costanza <········@web.de> writes:
> Frederic Brunel wrote:
>> I'm wondering why the Common Lisp standard defines "define-condition"
>> and not "defcondition"? Is there's a convention for using "define-*"
>> rather than "def*"
>> for function names?
>
> My guess is:
>
> - If you are writing code during the 60's and 70's, use "def*".
> - If you are writing code during the 80's and 90's, use "define-*",
> unless you're sentimental.
When the revolution came the convention has changed to
"do-define-*-please". the caller should be prepared to
"now-why-should-i?" condition though.
--
gr{oe|ee}t{en|ings}
artm
Artem Baguinski wrote:
> Pascal Costanza <········@web.de> writes:
>
>
>>Frederic Brunel wrote:
>>
>>>I'm wondering why the Common Lisp standard defines "define-condition"
>>>and not "defcondition"? Is there's a convention for using "define-*"
>>>rather than "def*"
>>>for function names?
>>
>>My guess is:
>>
>>- If you are writing code during the 60's and 70's, use "def*".
>>- If you are writing code during the 80's and 90's, use "define-*",
>> unless you're sentimental.
>
>
> When the revolution came the convention has changed to
> "do-define-*-please". the caller should be prepared to
> "now-why-should-i?" condition though.
>
I think we should go the INTERCAL way.
(please define foo (x y) ....)
That would make us lispers kinder :)
Cheers
--
Marco
Marco Antoniotti <·······@cs.nyu.edu> writes:
> I think we should go the INTERCAL way.
>
> (please define foo (x y) ....)
>
> That would make us lispers kinder :)
I assume lovers of extended loop will love this please form too.
(please not !)
--
__Pascal_Bourguignon__ http://www.informatimago.com/
There is no worse tyranny than to force a man to pay for what he doesn't
want merely because you think it would be good for him.--Robert Heinlein
http://www.theadvocates.org/
Pascal Costanza <········@web.de> writes:
> My guess is:
>
> - If you are writing code during the 60's and 70's, use "def*".
> - If you are writing code during the 80's and 90's, use "define-*",
> unless you're sentimental.
Well, very few people applies this rule...
--
Frederic Brunel
In article <··············@in-fusio.com>,
Frederic Brunel <···············@in-fusio.com> wrote:
> Pascal Costanza <········@web.de> writes:
>
> > My guess is:
> >
> > - If you are writing code during the 60's and 70's, use "def*".
> > - If you are writing code during the 80's and 90's, use "define-*",
> > unless you're sentimental.
>
> Well, very few people applies this rule...
I think it's actually more like:
If it's expected to be used frequently, use "def*". If it's less
commonly used, use "define-*".
Thus, we have DEFMETHOD and DEFGENERIC, but DEFINE-METHOD-COMBINATION.
Another variation is to use DEF* for a simple API, DEFINE-* for a more
complex one, as in DEFSETF vs. DEFINE-SETF-EXPANDER.
--
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Pascal Costanza wrote:
> Frederic Brunel wrote:
>
>> I'm wondering why the Common Lisp standard defines "define-condition"
>> and not "defcondition"?
>> Is there's a convention for using "define-*" rather than "def*"
>> for function names?
>
>
> My guess is:
>
> - If you are writing code during the 60's and 70's, use "def*".
> - If you are writing code during the 80's and 90's, use "define-*",
> unless you're sentimental.
I thought the convention was define-* for more than one word
(define-compiler-macro) and def* otherwise (defmacro). define-condition
seems to be the only exception to this in the hyperspec. Why that is so,
I have no idea.
Dirk Gerrits
PS. last sunday's Cologne Lisp meeting was great. :)
Frederic Brunel <···············@in-fusio.com> wrote in message news:<··············@in-fusio.com>...
> I'm wondering why the Common Lisp standard defines "define-condition"
> and not "defcondition"?
>
> Is there's a convention for using "define-*" rather than "def*"
> for function names?
Probably because conditions are newer.
You see the same effect in other languages or system interfaces.
For example in POSIX you find things like
pthread_mutex_lock
but in the ancient C library you have
strpbrk
You could ask, why pthread_mutex_lock rather than pthrmxlk(). It's
because, like so many Wheel of Fortune players, we'd like to buy a few
vowels. Now that we can afford them.
:)