Subject: Re: (cached) named return values?
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 04 Nov 2007 21:18:19 -0600
Newsgroups: comp.lang.lisp
Message-ID: <2Z6dnU8Pzd3mFrPanZ2dnUVZ_qCunZ2d@speakeasy.net>
Ken Tilton  <kentilton@gmail.com> wrote:
+---------------
| Pascal Costanza wrote:
| > I haven't used keywords for returning results yet, so this is just 
| > speculation, but I can imagine that this could be worthwhile...
| 
| Funny, I woke up this morning and decided to challenge you or Rob 
| "Nice!" Warnock to find anywhere in any project (let alone your own 
| code) a usage like the suggested keyword-rich destructuring-bind on a 
| function call. Given that the OP asked for "a good/standard/idiomatic 
| way of doing this"...
+---------------

I haven't used it *yet*, but in my web application server ("appsrv")
there are places where a "keyword-rich destructuring-bind" might be
an improvement over how I *currently* do it, "it" being to destructure
an HTTP query that might have the sub-items of the query in *any* order
and match them up with the requirements of a table whose columns need
to be presented in a fixed order. Right now what I do is stuff the
pairs of "keyword=value" into a hash table, and then extract them
in the needed fixed order. A "keyword-rich destructuring-bind" would
have saved a lot of coding had I thought of it at the time [circa 2002,
when I was first writing serious CL code in anger], but I'm not sure
it would be any more efficient or maintainable. It probably depends
on whether the underlying implementation does anything smarter than
my hash table code.

So please don't be confused by my "Nice!". A "neat hack" is just that.
It's *NOT* necessarily something you want to actually use in production
code. As noted above, using a keyword-rich destructuring-bind or
function call might be a "neat" way to do it, but it also might not
be the best way.


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607