Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

||:xxxx syntax. #674

Open
Gleefre opened this issue Jul 4, 2024 · 3 comments
Open

||:xxxx syntax. #674

Gleefre opened this issue Jul 4, 2024 · 3 comments

Comments

@Gleefre
Copy link

Gleefre commented Jul 4, 2024

When trying to read ||:xxxx, abcl crashes:

(defpackage ""
  (:use #:cl)
  (:export #:exported-symbol))
; => #<PACKAGE >

'||:exported-symbol
'||::unexported-symbol
; EXPECTED => ||:EXPORTED-SYMBOL  and  ||::UNEXPORTED-SYMBOL
; OR :EXPORTED-SYMBOL  and :UNEXPORTED-SYMBOL

Instead abcl crashes:

java.lang.IndexOutOfBoundsException: fromIndex: 1 > toIndex: 0
	at java.base/java.util.BitSet.checkRange(BitSet.java:369)
	at java.base/java.util.BitSet.get(BitSet.java:648)
	at org.armedbear.lisp.Stream.readToken(Stream.java:1150)
	at org.armedbear.lisp.Stream.processChar(Stream.java:596)
	at org.armedbear.lisp.Stream.readPreservingWhitespace(Stream.java:558)
	at org.armedbear.lisp.Stream.readPreservingWhitespace(Stream.java:567)
	at org.armedbear.lisp.Stream.read(Stream.java:501)
	at org.armedbear.lisp.Stream$15.execute(Stream.java:2456)
	at org.armedbear.lisp.Symbol.execute(Symbol.java:828)
	at org.armedbear.lisp.LispThread.execute(LispThread.java:951)
	at org.armedbear.lisp.top_level_45.execute(top-level.lisp:371)
	at org.armedbear.lisp.Symbol.execute(Symbol.java:805)
	at org.armedbear.lisp.LispThread.execute(LispThread.java:910)
	at org.armedbear.lisp.top_level_46.execute(top-level.lisp:385)
	at org.armedbear.lisp.LispThread.execute(LispThread.java:930)
	at org.armedbear.lisp.top_level_47.execute(top-level.lisp:407)
	at org.armedbear.lisp.CompiledClosure.execute(CompiledClosure.java:89)
	at org.armedbear.lisp.Symbol.execute(Symbol.java:795)
	at org.armedbear.lisp.LispThread.execute(LispThread.java:892)
	at org.armedbear.lisp.top_level_48.execute(top-level.lisp:415)
	at org.armedbear.lisp.LispThread.execute(LispThread.java:892)
	at org.armedbear.lisp.Interpreter.run(Interpreter.java:361)
	at org.armedbear.lisp.Main$1.run(Main.java:48)
	at java.base/java.lang.Thread.run(Thread.java:1623)

Tested on abcl 1.9.2 (latest release)

See also s-expressionists/wscl#63 about the general ambiguity of the ||:xxxx syntax.

@easye
Copy link
Collaborator

easye commented Jul 6, 2024

Confirmed as failing in abcl-1.9.3-dev.

Two bugs here (or a bug and a feature):

  1. Fixing the reading of such sequences as to not to crash

  2. Deciding whether to interpret the reading of ||:xxxx as the symbol xxxx in the package named "" (SBCL, CCL) or as the keyword :xxxx (ECL, CLASP, CLISP)

@Gleefre
Copy link
Author

Gleefre commented Jul 6, 2024

About the 2nd point.

IIUC the standard says that ||:xxxx should be read as a keyword. (See a longer explanation in the WSCL issue.)

However, reading it as a symbol in package named "" could be a useful extension, since it is the only candidate for reading such a symbol. Furthermore, not defining such an extension would lead to losing print-read consistency.

Note also that a third possible resolution -- defining "" to be a global nickname for the keyword package, as Allegro CL does -- is not standard compliant. (EDIT: Although strictly speaking, reading it as a symbol in the package named "" is not standard compliant as well...)

@crmsnbleyd
Copy link

can we go forward with implementing it in the CCL/SBCL way? ||:EXPORTED-SYMBOL makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants