PLN CDR draft: Issue 5

1. Issue 5 (Local nickname shadowing package's own name)

1.1. Description

It is not clear whether it should be allowed to define a local nickname that shadows the name or one of the global nicknames of the package that it is defined in.

1.2. Examples

(defpackage #:foo
  (:use)
  (:nicknames #:bar)
  (:local-nicknames (#:foo #:cl)
                    (#:bar #:cl)))
; => continuable error  (sbcl, ccl, abcl)
; => error  (lispworks)
; => ok  (ecl, acl, clasp)

1.3. Current behavior

sbcl, ccl, abcl: A correctable error is signaled by defpackage.

lispworks: An error is signaled by defpackage. A correctable error is signaled by add-package-local-nickname.

ecl, acl, clasp: No errors are signaled.

1.4. Proposal ALLOW-WITH-STYLE-WARNING

It should be allowed to use the name or one of the global nicknames of the package as a local nickname, but a style warning might be issued.

1.4.1. Rationale

Such local nicknames are not likely to break anything. Even though they can be a bit confusing, this alone does not warrant an error to be signaled.

Moreover, on all implementations it is possible to obtain such nicknames, even if on some of them invoking the continue restart is required. This suggests that cost of adoption is very low.

1.5. Proposal DISALLOW-WITH-CORRECTABLE-ERROR

Attemts to create such a nickname should result in a correctable error being signaled. The continue restart can be used to create the nickname anyway.

Author: Gleefre

Created: 2024-07-07 Sun 13:22