libera/#commonlisp - IRC Chatlog
Search
18:52:17
agm
hello everyone. you may be interested in a common lisp interpreter that i'm writing. it's written in c89 and i'm making good progress. it's called alisp and it's hosted at https://savannah.nongnu.org/projects/alisp
20:57:17
agm
an_origamian[m]: well, i try to make it as clean and well designed as possible. also, i plan to add native compilation for x86_64 in the future. i think having a variety of free implementations is a good thing
7:13:16
agm
beach: I use reference counting for garbage collection. i try to steer away from garbage collection, because it brings random freezes, while refcounting is more predictable
7:14:08
agm
beach: c89 is more portable, so you can bootstrap in many platforms. that's the same approach as emacs: a c core and then lisp
7:15:22
agm
beach: that's true of classic refcounting, but there's a published algorithm that also collects loop, maybe i will implement some variation of it
7:17:46
agm
beach: see https://www.cs.ru.nl/~marko/research/pubs/1988/IR88-10CyclicProof-incl-fig.pdf about the algorithm
7:20:22
agm
agm: well, it's an interesting challenge, and maybe i can add true native compilation that neither clisp and ecl have
9:15:55
agm
it also depends on how common reference cycles are in typical big lisp programs. i'd be interested in such a measurement
9:18:18
agm
can package be excluded from garbage collection? after all, there's an explicit delete-package function in CL
10:04:37
agm
beach: the examples you made are tipically global objects, so they don't need collection, unless you redefine them (which sometimes happens in interactive programming)
7:43:00
agm
soundmodel: I'm writing a CL implementation that doesn't use strict GC, but an enhanced reference counting, so there are no random pauses. it's at https://savannah.nongnu.org/projects/alisp. it's still incomplete, but it shows that it can be done
13:07:52
agm
i just read the consistency rules about symbols (http://clhs.lisp.se/Body/02_cf.htm). in my interpretation, they mean that even if a symbol carries no information (eg not exported, no binding, no plist), an implementation can't free it, because the next time it is read it must be the same symbol. is this correct?
18:25:25
agm
this is probably basic, but does MAKUNBOUND only delete dynamic bindings? sbcl seems to work that way, but clhs doesn't say so, while it talks about global environment in FMAKUNBOUND
12:38:35
agm
in ANSI CL, type declarations are promises and it is undefined behavior if they are broken. SBCL often treats declarations as assertions (even checking them at runtime) but this is buggy according to the manual https://www.sbcl.org/manual/#Declarations-as-Assertions
12:44:19
agm
well, i think that I hit some of those bugs in the past, when I relied on type declarations (as assertions) to aid in debugging. at least that was my impression
16:10:10
agm
i see that (let ((x 0)) (declare (special x)) (let ((x 1)) x)) evaluates to 1 in common implementations, but I don't get why. the inner binding is surely lexical, but the inner reference should fall under the declaration and so be special, evaluating to 0 in my understanding
11:27:37
agm
can an implementation add new subtype relations to the standard ones? as an extreme example, can it make integer a subtype of cons?
11:00:29
agm
how does a destructuring lambda list like (&rest (foo)) works? I don't get what ends in foo and when it fails
15:51:20
agm
ansi cl says that an implementation can treat standard macros as special operators (that is builtins), but it must provide an alternate definition as a lisp macro. why that requirement? do people truly need to expand standard macros, except for learning purposes?
11:02:45
agm
hello! today i'm puzzled by yet another behavior: if I run (defparameter foo 0) and then (let ((foo 1)) (makunbound 'foo) foo), I unsurprisingly get an unbound variable error. but evaluating foo afterwards produces 0! why?
14:07:29
agm
if foo has a setf expansion, then (setf (foo a) b) first evaluates the value forms and binds the result to the temp variables, then evaluates b and assigns the result to the store variable, in that order right?
14:14:19
agm
i find the order of evaluation somewhat implied in http://clhs.lisp.se/Body/05_aab.htm, but not abundantly clear
9:42:08
agm
about floating-point numbers, ANSI CL mandates negative epsilon constants, but I can't find any resources about them, only about usual (positive) epsilon. can someone help? floating-point is a world in itself, as usual
14:16:56
agm
smlckz: in C, product types are structs. maybe you can use CL's structures for that purpose
9:27:00
agm
the clhs entry of RESTART-BIND has wrong syntax, there's a missing asterisk right? in fact, cltl2 is correct at https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node341.html
9:41:54
agm
this list of errata https://www.cliki.net/ANSI%20Clarifications%20and%20Errata seemingly does not report it
17:17:17
agm
jcowan: the characters marked as "undefined*" are explicitly reserved to the user, so those marked as "undefined" can only mean "free to use for the implementer or the user"
10:13:13
agm
every time that the clhs describes an argument to a macro as (for example) "a symbol; evaluated" it really means "an object that must evaluate to a symbol", right? that's obvious enough, but I would prefer a clearer wording
10:16:12
agm
well, that could be an improvement. in current wording, a newbie might think that type checking is applied to the form, not to the result of the form
10:26:05
agm
today I met this wording in DO-SYMBOLS. it says that package must be "a package designator; evaluated". the stricter meaning would mean you can't pass any form that produces a string or a package object, like ,(car (list-all-packages))
13:47:08
agm
on sbcl and clisp, if I evaluate (defparameter a '#1=(b #1#)) and then (setq a (cdr a)), a stack overflow follows. is traversing a circular list disallowed by the standard? I don't think it should
13:57:56
agm
oh, it's just a matter of *print-circle*. my setq tries to print the result and it loops forever
7:28:05
agm
if you're in the repl, once you set that variable you can't read other forms, i think...
21:20:19
agm
i don't understand something about iteration control with destructuring in LOOP: if I evaluate (loop for (i . j) in nil initially (write i)) in sbcl, I get an output of NIL, but how can I or J be bound if nil can't be destructured in (i . j)?
13:46:19
agm
why does ,(handler-bind ((condition (lambda (e) (print 'ah))) (simple-condition (lambda (e) (print 'oh)))) (signal "w")) print both AH and OH? clhs 9.1.4 says "if the handler declines, no other handler established by that form will be considered for possible invocation"
14:07:54
agm
yeah, I agree, elsewere it says that other handlers established in the same form are disabled only while executing each, not after
12:30:47
agm
beach: while it's true that a macro function receives the whole macro form as first argument, including the macro name, I don't think it's reasonable to check it
17:24:05
agm
macro expansion happen in the lexical environment where the macro was defined or the one in which it is expanded? that's not entirely clear to me by clhs 3.1.2.1.2.2, it just says "current"
18:15:01
agm
I see that many of you are not entirely satisfied with debugging tools of free CL implementations. soon I will add breakpoints and stepping to my implementation (https://savannah.nongnu.org/p/alisp), I hope you'll give it a try!
19:49:44
agm
scymtym: you're right. the struct symbol_name is an implementation detail that is only visible in C. it allows reading objects one line at a time, a feature that i wanted even if it is not strictly needed
7:41:17
agm
beach: yes, just evaluate "(defun foo () (bar)) (defmacro bar ())". the compiler assumes that any unknown compound form is a function call, see the first point in clhs 3.2.2.3
19:25:28
agm
nij-: LOOP identifies its keywords through the symbol name, so you can also use keywords like :FOR, :ACROSS, etc.
6:52:46
agm
someone mentioned kons-9; that project looks interesting, but it's not been updated for a while: do you know about it?
19:31:21
agm
metsomedog: that's not a surprise; APPLY calls the function once with all the arguments, REDUCE calls the function with the first two args, then with the result and with the third arg, and so on
12:12:08
agm
one consequence of the simple loop syntax is that (LOOP (PRINT (EVAL (READ)))) is an actual valid definition of the READ-EVAL-PRINT-LOOP or REPL hehehe
15:22:46
agm
hello everyone, on a recent sbcl evaluating (print-object "hi" *standard-output*) returns #\" to me, does anyone know why? on clisp it returns the string "hi"
11:57:22
agm
hello everyone, what does the standard say about redefinition of non-standard condition classes? I can't find anything
14:27:24
agm
SummerEmacs: if you use C-x C-e to evaluate, then you are invoking emacs' interpreter, which means you are programming in elisp