Language extension / "behavior"
Duane Rettig
duane at franz.com
Tue Jan 24 17:36:18 UTC 2023
--------
Date: Tue, 24 Jan 2023 12:23:36 +0000
From: =?utf-8?Q?Daniel_Kochma=C5=84ski?= <daniel at turtleware.eu>
Hey,
> You seem to be asking for opinions. I do think adding keyword
> args is fine. I believe Franz does this, and it works well.
> This is certainly an established practice - another example is
> make-hash-table (and weakness arguments). That said it is
> annoying to quote two arguments, i.e
(make-hash-table #+ICL :weakness #+ICL :key
#+OPK :key-weakness #+OPK t)
It is indeed annoying, and the #+allegro additions to this code might
include either `:values :weak' or `:weak-keys t'. The use of any of
these extensions, however, makes the program non-portable, as is also
documented in the spec. I do like Pascal's solution later in this
thread. which brings programs using these extensions back into the
category of "portable".
Make-hash-table is a good example of extensions being a Good Thing.
For our next version we've added an :implementation keyword, which
allows you to roll your own hash-table implementation using
excl:def-hash-table-implementation (and then naming it in the
make-hash-table call). The thing about hash-table extensions is that
they are _fun_!
Another aspect of extensions is the ability to extend existing
keywords. This is also demonstrated in Allegro CL by the :test
keyword, which is specified to have values that are designators for
cl:eq, cl:eql, cl:equal, and cl:equalp. But our extension allows you
to specify any test you want, which of course thus requires yet
another make-hash-table keyword :hash-function (which the user
specifies to generate their own hash code).
I agree with most of the comments in this thread. As an implementor,
I would say that without the ability to extend keywords, we would be
severely limited in what we could offer you. It comes, of course,
with a level of responsibility for the user to keep their programs as
portable as possible, but of course if you want to stick with one
implementation it really doesn't matter. But that's the main goal of
the spec, when it comes down to it.
Best regards,
Daniel
--
Daniel Kochma=C5=84ski ;; aka jackdaniel | Przemy=C5=9Bl, Poland
TurtleWare - Daniel Kochma=C5=84ski=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | www.tur
=
tleware.eu
"Be the change that you wish to see in the world." - Mahatma Gandhi
--------
More information about the pro
mailing list