programmable pathnames proposal

Pascal J.Bourguignon <[email protected]> Tue, 23 Dec 2003 17:40:45 +0100
Newsgroups gmane.lisp.clump
Organization InformatiMago.
Message-ID <[email protected]>
Daniel Barlow writes:
>=20
> (I'm not 100% sure if this is appropriate here, given that it requires
> unportable/reserved-to-the-implementation stuff to implement.  But=20
> I'm looking for opinions on whether it'd be worth implementing, and
> who better to ask than people who might use it)

CLHS 11.1.2.1.2 says:

     Except where explicitly allowed, the consequences are undefined
     if any of the following actions are performed on an external
     symbol of the COMMON-LISP package:
     [...]

We're forbidden to change the meaning of the SYMBOLS that are EXPORTED
from the COMMON-LISP package.

But  we  are not  forbidden  to define  OTHER  symbols  with the  same
SYMBOL-NAME in OTHER packages than COMMON-LISP (see SHADOW).

There should be no problem in defining thusly:

(DEFPACKAGE "COM.INFORMATIMAGO.MODIFIED-COMMON-LISP"
  (:DOCUMENTATION "A Modified Common-Lisp with such and such modification=
s.")
  (:SHADOW "CAR" "CDR")  ;; <<<---- The important part.
  (:USE "COMMON-LISP")
  (:EXPORT "&ALLOW-OTHER-KEYS" "*PRINT-MISER-WIDTH*" "&AUX"
   "*PRINT-PPRINT-DISPATCH* " "&BODY" "*PRINT-PRETTY*" "&ENVIRONMENT"
   "*PRINT-RADIX*" "&KEY" "*PRINT-READABLY* " "&OPTIONAL"
   "*PRINT-RIGHT-MARGIN*" "&REST" "*QUERY-IO*" "&WHOLE" "*RANDOM-STATE* "
   "*" "*READ-BASE*" "**" "*READ-DEFAULT-FLOAT-FORMAT*" "***" "*READ-EVAL=
*"
   ;;...
   "UPGRADED-ARRAY-ELEMENT-TYPE" "WRITE-LINE" "UPGRADED-COMPLEX-PART-TYPE=
"
   "WRITE-SEQUENCE" "UPPER-CASE-P" "WRITE-STRING" "USE-PACKAGE"
   "WRITE-TO-STRING" "USE-VALUE" "Y-OR-N-P" "USER-HOMEDIR-PATHNAME"
   "YES-OR-NO-P" "VALUES" "ZEROP"))
(IN-PACKAGE "COM.INFORMATIMAGO.MODIFIED-COMMON-LISP")

(DEFUN CAR (L) (COMMON-LISP:CDR L))
(DEFUN CDR (L) (COMMON-LISP:CAR L))
;; more needed for (setf car), etc.

;; These CAR and CDR symbols ARE NOT the same
;;  as COMMON-LISP:CAR and COMMON-LISP:CDR.



And then:

(DEFPACKAGE "COM.INFORMATIMAGO.XYZ"
  (:USE  "COM.INFORMATIMAGO.MODIFIED-COMMON-LISP") ;; instead of "COMMON-=
LISP"!
  )
(IN-PACKAGE "COM.INFORMATIMAGO.XYZ")
(DEFUN FOO (L) (COND ((NULL L) NIL)
                     ((ATOM L) (BAR L))
                     (T (CONS (FOO (CAR L)) (FOO (CDR L))))))
;; Not doing what it seems, but then, it's no more COMMON-LISP,=20
;; it's MODIFIED-COMMON-LISP!





=20

--=20
__Pascal_Bourguignon__                              .  *   * . * .* .
http://www.informatimago.com/                        .   *   .   .*
There is no worse tyranny than to force             * .  . /\  (   . *
a man to pay for what he does not                    . .  / .\   . * .
want merely because you think it                    .*.  / *  \  . .
would be good for him. -- Robert Heinlein             . /*   o \     .
http://www.theadvocates.org/                        *   '''||'''   .
SCO Spam-magnet: [email protected]                 ******************