Subject: Re: Macros OR, AND
From: Erik Naggum <erik@naggum.net>
Date: Mon, 19 Nov 2001 01:59:43 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3215123981399435@naggum.net>

* Frode Vatvedt Fjeld
| This seems to me a very bad idea, as the transient magic mode of
| operation enables a "transient-extent" (efficient) kind of allocation of
| the values. If I understand you correctly, those multiple-value objects
| would need to be consed at every function return, almost like python's
| bad excuse for multiple values.

  I have no idea whether you understood me correctly or not, because I
  cannot figure out what you are talking about.  I think you may have
  missed an "instead of" or something.

| I (also) find it slightly strange that cond must coerce test-form returns
| to single-values.

  Huh?  This is very strange language.  It really helps to understand you
  if you used the common language of the standard.   (That is another good
  reason for a community standard as its focal point of agreement.)  It is
  specified to test and return the primary value.

| Seeing as cond is defined to be a macro, I suppose that is the reason; a
| cond written in terms of if and let would need to use m-v-list to support
| multiple-values.  However, if cond was a special operator, I believe
| implementing a multiple-values returning cond would be non-problematic
| for most implementations.  I have implemented a cond special operator,
| and in fact the requirement to return a single value from test-forms is
| just a nuisance, it would be easier to return all the test-forms values.

  Whether you implement it as a macro or a special operator does not affect
  the internal implementation.  A symbol in the common-lisp package defined
  to hold a amacro does not have to be expanded by the compiler if it can
  do smarter things directly, it only needs to be defined as a macro to
  make user-defined code walkers see only a known and predefined set of
  special operators.  You could clearly define a cond that held onto the
  multivalue return vector, if that is how they were implemented, and set
  up to return it if there were no body-forms.

| But then again there may have been (other) good reasons why cond was
| selected to be a macro and if a special operator, I don't know (but I'd
| like to..)

  It was probably selected as a macro because it easier to code-walk if
  than cond.  The implementation is free to do whatever it pleases as long
  as the semantics of the form is maintained.

///
-- 
  Norway is now run by a priest from the fundamentalist Christian People's
  Party, the fifth largest party representing one eighth of the electorate.
-- 
  Carrying a Swiss Army pocket knife in Oslo, Norway, is a criminal offense.