I don't know, I have no merge rights to the clisp repository.
> (aref #(0 1) "0")
Condition of type: SIMPLE-TYPE-ERROR
In function AREF, the index into the object
#(0 1).
takes a value 0 out of the range (INTEGER 0 1).
The value should be printed as "0" not 0 (~S versus ~A).
>> (format t "~&~@{~12@A ~S~%~}"
:version (lisp-implementation-version)
:vcs-id (ext:lisp-implementation-vcs-id)
:os (software-type)
:os-version (software-version)
:machine-type (machine-type)
:features *features*)
VERSION "21.2.1"
VCS-ID "c646799145538997d84ed6d8755be7e7837eb7ef"
OS "Linux"
OS-VERSION "6.0.0-6-amd64"
MACHINE-TYPE "x86_64"
FEATURES (:WALKER :CDR-1 :CDR-5 :LINUX :FORMATTER :CDR-7 :ECL-WEAK-HASH :LITTLE-ENDIAN :ECL-READ-WRITE-LOCK :LONG-LONG :UINT64-T :UINT32-T :UINT16-T :COMPLEX-FLOAT :LONG-FLOAT :UNICODE ...)
Would you mind also adding a regression test case which verifies the correct scenario?
Attempting to read 1d9999999999999 causes ECL to hang in a busy loop and allocate memory until it runs out of heap space.
VERSION "21.2.1"
VCS-ID "c646799145538997d84ed6d8755be7e7837eb7ef"
OS "Linux"
OS-VERSION "5.15.0-2-amd64"
MACHINE-TYPE "x86_64"
FEATURES (:WALKER :CDR-1 :CDR-5 :LINUX :FORMATTER :CDR-7 :ECL-WEAK-HASH
:LITTLE-ENDIAN :ECL-READ-WRITE-LOCK :LONG-LONG :UINT64-T
:UINT32-T :UINT16-T :COMPLEX-FLOAT :LONG-FLOAT :UNICODE :DFFI
:CLOS-STREAMS :CMU-FORMAT :UNIX :ECL-PDE :DLOPEN :CLOS :THREADS
:BOEHM-GC :ANSI-CL :COMMON-LISP :FLOATING-POINT-EXCEPTIONS
:IEEE-FLOATING-POINT :PACKAGE-LOCAL-NICKNAMES :CDR-14
:PREFIXED-API :FFI :X86_64 :COMMON :ECL)
This helps - thank you!
[1]> (ql:quickload :alexandria)
To load "alexandria":
Load 1 ASDF system:
alexandria
; Loading "alexandria"
[package alexandria]..............................
[package alexandria-2].
(:ALEXANDRIA)
[2]> (defpackage #:foo (:use #:cl) (:local-nicknames (#:a #:alexandria)))
#<PACKAGE FOO>
[3]> (in-package #:foo)
#<PACKAGE FOO>
FOO[4]> (find-package :a)
#<PACKAGE ALEXANDRIA>
@joramschrijver Found one issue with this patch - gensyms are not correctly recognized in :LOCAL-NICKNAMES.
[2]> (defpackage #:foo
(:use #:cl)
(:local-nicknames (#:a #:alexandria)))
*** - EVAL-WHEN: variable #:A has no value
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead of #:A.
STORE-VALUE :R2 Input a new value for #:A.
ABORT :R3 Abort main loop
Break 1 [3]>
The reason is lack of quoting of function arguments in the EXT:ADD-PACKAGE-LOCAL-NICKNAME call:
FOO[6]> (macroexpand-1 '(defpackage #:foo (:use #:cl) (:local-nicknames (#:a #:alexandria))))
(EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE)
(SYSTEM::%IN-PACKAGE "FOO" :NICKNAMES 'NIL :USE 'NIL :CASE-SENSITIVE NIL :CASE-INVERTED NIL)
(USE-PACKAGE '("COMMON-LISP") "FOO")
(DOLIST (SYSTEM::MAPPING (EXT:PACKAGE-LOCAL-NICKNAMES "FOO"))
(EXT:REMOVE-PACKAGE-LOCAL-NICKNAME (CAR SYSTEM::MAPPING) "FOO"))
(EXT:ADD-PACKAGE-LOCAL-NICKNAME #:A #:ALEXANDRIA "FOO") (FIND-PACKAGE "FOO")) ;
Is it possible for you to make a new commit on top of your branch? I'll cherry-pick it on top of the Roswell fork at https://github.com/roswell/clisp/ so ros install clisp-head fetches it.
Perfect, thank you!
What else is required to merge this upstream and make a new release?
It's getting hard to keep on working with CLISP, since more and more CL code depends on package-local nicknames, and keeping that software working on CLISP requires keeping and downloading a separate PLN-less branch for it.
Found via https://github.com/ruricolist/serapeum/pull/109
Attempting to multiple-value-call a (lambda (one two) ...) with (values 1 2 3) does not signal a program-error.
ECL (Embeddable Common-Lisp) 21.2.1 (git:c646799145538997d84ed6d8755be7e7837eb7ef)
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2013 Juan J. Garcia-Ripoll
Copyright (C) 2018 Daniel Kochmanski
Copyright (C) 2021 Daniel Kochmanski and Marius Gerbershagen
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.
Top level in: #<process TOP-LEVEL 0x55c5648bbf80>.
> (declaim (optimize safety))
((OPTIMIZE SAFETY))
> (compile nil '(lambda () (MULTIPLE-VALUE-CALL (LAMBDA (ONE TWO) (LIST ONE TWO)) (VALUES 1 2 3))))
;;; OPTIMIZE levels: Safety=3, Space=0, Speed=3, Debug=0
;;;
;;; End of Pass 1.
#<compiled-function 0x55c565112ac0>
NIL
NIL
> (funcall *)
(1 2)
No error is signaled in safe code, which is in violation of CLHS 3.5.1.3.
The same behavior occurs in code compiled with default safety.
Would you welcome a patch that adds the functionality from https://github.com/sbcl/sbcl/commit/9dcaef6100feae2f99b8b524d2ee702789eaf38f into ECL? The commit message and tests should be the most interesting parts for you.
Commit message, copied over for posterity:
Neither the standard nor the MOP specify what happens when an error is
signaled in U-I-F-R-C or U-I-F-D-C and control is transferred outside.
This may result in half-baked instances which, respectively, already
have their structure or class changed, but whose newly added slots are
not yet initialized. There is no good way to "fix" the instances afterwards
since, for all purposes, SBCL considers them to be "updated" even though
their slot values are undefined.
This commit modifies the existing behavior in functions
%OBSOLETE-INSTANCE-TRAP and %CHANGE-CLASS by effectively rolling back
the transaction of updating an instance or changing its class if
U-I-F-{R,D}-C does not exit normally but via a nonlocal exit.
The new behavior is actually useful because the programmer can fix
their U-I-F-{R,D}-C code up and either attempt to access the instance
again (to trigger the update process) or call CHANGE-CLASS on it again.
Tests:
It seems that the change could be done in https://gitlab.com/embeddable-common-lisp/ecl/-/blob/4da8ca54b60e373cf8f344601e19daabbac25437/src/clos/change.lsp#L148-180 by saving the old instance stamp and contents, and then adding an UNWIND-PROTECT form, which, in case of a non-local exit, could restore the old state of the instance.
(Edit: I would like to add a tag "feature" to this issue, but I don't seem to have the permission to do that.)
What else is required to merge this upstream and make a new release?
Moved from https://gitlab.common-lisp.net/ecl/ecl/-/issues/2
(prog1 (values 1 2 3)) is supposed to return only the primary value.
Possible fix at https://gitlab.com/embeddable-common-lisp/ecl/-/blob/develop/src/lsp/evalmacros.lsp#L233-239:
(defmacro prog1 (first &rest body &aux (sym (gensym)))
"Syntax: (prog1 first-form {form}*)
Evaluates FIRST-FORM and FORMs in order. Returns the value of FIRST-FORM."
(if (null body) `(values ,first)
`(LET ((,sym ,first))
; (DECLARE (:READ-ONLY ,sym)) ; Beppe
,@body ,sym)))
ECL data:
VERSION "20.4.24"
VCS-ID "UNKNOWN"
OS "Linux"
OS-VERSION "5.9.0-2-amd64"
MACHINE-TYPE "x86_64"
FEATURES (:WALKER :CDR-1 :CDR-5 :LINUX :FORMATTER :CDR-7 :ECL-WEAK-HASH
:LITTLE-ENDIAN :LONG-LONG :UINT64-T :UINT32-T :UINT16-T
:COMPLEX-FLOAT :LONG-FLOAT :UNICODE :DFFI :CLOS-STREAMS
:CMU-FORMAT :UNIX :ECL-PDE :DLOPEN :CLOS :THREADS :BOEHM-GC
:ANSI-CL :COMMON-LISP :FLOATING-POINT-EXCEPTIONS
:IEEE-FLOATING-POINT :PACKAGE-LOCAL-NICKNAMES :CDR-14
:PREFIXED-API :FFI :X86_64 :COMMON :ECL)
Thanks for the review and merge.
The function SB-BSD-SOCKETS:GET-PROTOCOL-BY-NAME did not signal an error when it was unable to find a protocol. This is fixed now and an error of type UNKNOWN-PROTOCOL, with an accessor named UNKNOWN-PROTOCOL-NAME, is being signaled. These two names are also exported from the package SB-BSD-SOCKETS.
A test case is added.
Several other test cases are fixed with regard to :NO-ERROR clauses inside HANDLER-CASEs.
Michał "phoe" Herda (bb40da9f) at 13 Nov 18:45
Fix GET-PROTOCOL-BY-NAME with unknown protocols
MOP is a complicated beast, so no worries about that - perhaps someone else will be able to contribute an functional equivalent to the above.
ENSURE-GENERIC-FUNCTION is the functional variant of DEFGENERIC, so it's the easier part; DEFMETHOD has no direct functional variant, but it is possible to make an instance of the STANDARD-METHOD class and then ADD-METHOD it to the generic function.
https://gitlab.com/eql/EQL5-Android/-/blob/master/utils/EQL5-symbols.lisp#L956-959
;; no way to avoid EVAL here (excluding non-portable hacks)
(eval `(defgeneric ,lisp-name (object &rest arguments)))
(eval `(defmethod ,lisp-name ((object qt-object) &rest arguments)
(%qinvoke-method object :qt ,qt-name arguments))))))))
Have you considered using MOP mechanics instead? ENSURE-GENERIC-FUNCTION and ADD-METHOD over MAKE-INSTANCE 'STANDARD-METHOD should work without the use of the Lisp evaluator.
What else is required to merge this upstream and make a new release?