freenode/lisp - IRC Chatlog
Search
5:13:41
drmeister
Well, this makes a bit more sense. Because in trying to fix the bootstrapping process I decided to try and cut out reloading setf.lsp again.
5:14:13
drmeister
So if the behavior of SETF isn't completely defined - then this sort of thing might happen.
5:17:48
drmeister
So: (debug-boot " (get-setf-expansion '(class-id class) ENV) -> ~a~%" (macrolet ((hack (form &environment e) `',(get-setf-expansion form e))) (hack '(class-id class))))
5:17:57
Bike
"Within the body of macrolet, global setf expander definitions of the names defined by the macrolet do not apply; rather, setf expands the macro form and recursively process the resulting form. "
5:20:01
Bike
if you like, you can do (defmacro cmacroexpand-1 (form &environment e) `',(macroexpand-1 form e)) and skip the macrolet
5:22:21
Bike
get-setf-expansion takes an environment argument the same way macroexpand does, and by default uses the global environment, same way as macroexpand
5:22:58
drmeister
I want to find out where and why the broken bootstrapping code is different from the working code
5:23:54
drmeister
In particular, the broken code fails on: (with-early-accessors (+the-standard-class+) (setf (class-id class) name))
5:27:17
drmeister
I'm going to back up - and go back to the original bootstrapping sequence for bclasp.
5:40:08
drmeister
aclasp defines a few structs with: (defstruct (compiler-message (:type vector)) (prefix "Note") (format +note-format+) message source-pos-info top-level-form form)
5:41:26
drmeister
I use :type vector because before clos is running I can't use defclass and defstruct with CLOS uses defclass.
5:42:40
Bike
this doesn't seem like it should involve anything like class-id, then, seeing as there's no class involved.
5:42:56
drmeister
bclasp is screwing up when it loads the defstruct definition again overtop of the existing one.
5:43:33
drmeister
No - sorry to hit you with whiplash - but I think the class-id issue was because I was avoiding loading this earlier code - that just caused another problem.
5:44:30
drmeister
aclasp loads that defstruct into the interpreter and then compile-file's it and loads it again - that seems to work fine.
5:45:24
drmeister
bclasp loads aclasp (which defines that defstruct) and then compiles and loads the definition AGAIN.
5:50:16
Bike
okay, so it tries to do (subtypep vector (or list vector)), presumably to make sure the defstruct is valid
5:50:19
drmeister
This is a problem that has come up several times that I've tried to improve the bclasp compiler - the bootstrapping always fails on the first defstruct
5:52:30
drmeister
I'm about to put some code in to print debugging messages when I bind a dynamic variable to T
5:53:47
Bike
well, here's a dumb idea: i think that defstruct doesn't take a subtype of vector, it only takes literally vector, list, or (vector some-element-type)
5:57:05
Bike
so more like (or (eq type 'list) (eq type 'vector) (and (consp type) (eq (car type) 'vector)))
5:58:27
drmeister
(#+clasp(or (eq type 'list) (eq type 'vector) (and (consp type) (eq (car type) 'vector))) #+ecl(subtypep type '(OR LIST VECTOR))
6:09:52
drmeister
I wonder though if I shouldn't be looking at the root cause - why 'CONS isn't recognized properly
10:01:05
larsen
arduo: if you're looking for an italian Lisp channel, I'd like to resurrect #lisp-it (currently no traffic, but it is not completely desert)
13:36:51
specbot
Potential Numbers as Tokens: http://www.lispworks.com/reference/HyperSpec/Body/02_caa.htm
13:46:24
lieven
last time I looked at this stuff I was working out how to recover from (setf *read-base* 26)
13:51:55
beach
As I recall, Maclisp already had the dot. And (again as I recall) the default base on Maclisp was 8.
14:44:04
knobo
varjag: cl-jpeg has a todo item to "Add progressive JPEG support in decoder". But how about encoding it?
15:04:48
phoe_
(defmacro age (person &optional (default ''thirty-something)) `(get ,person 'age ,default))
15:05:30
phoe_
it would be more like, single-quoted, and the expansion would be `(get ,person 'age ',default)
15:08:39
phoe_
this is the page of GET - and this DEFMACRO smells of some ancient ways of defining accessors
15:11:25
jurov
phoe_: i found this http://www.lispworks.com/documentation/HyperSpec/Issues/iss055_w.htm
15:12:11
jurov
which says about :number lol "Benefits: Programmer expectations that any useful behavior can be portably relied upon in this pathological case should be soundly trounced."
15:13:13
ogamita
phoe_: double quotes in default values for macro arguments is not strange, because macro arguments are source code!
15:13:47
ogamita
phoe_: on the other hand, the fact that it seems unnatural to you is a hint it should be written as a function, not as a macro. ;-)
15:13:48
phoe_
One quote is for evaluating the source code, second quote is for evaluating the function argument.
15:14:49
ogamita
(defmacro age (person &optional (default ''thirty-something)) `(get ,person 'age ,default)) (macroexpand-1 ' (age p (setf last-default-used 42))) #| --> (get p 'age (setf last-default-used 42)) ; t |#
15:16:29
flip214
ogamita: with the macro as it is, DEFAULT will get evaluated always. just like with the function.
15:17:01
ogamita
Reify the person! (defun make-person () (cons 'person nil)) (defun age (p &optional (default 'thirty-something)) (get (cdr p) 'age default)) (defun (setf age) (new-age p &optional default) (declare (ignore default)) (setf (get (cdr p) 'age) new-age))
15:19:16
ogamita
flip214: with (setf getf) can change a nil into a list. (defun (setf …) …) cannot do that, you need a define-setf-expander.
15:20:05
ogamita
phoe_: : on the other hand, with get, we have already an object, since get works on symbols, so there's no point in using the macro, (defun (setf age) (new-age p &optional d) (declare (ignore d)) (setf (get p 'age) new-age)) works nicely.
15:21:46
ogamita
Since macros are allowed, they tend to use them for setf, since a single form would define the while accessor.
15:23:11
flip214
I'm not sure about the effects on code size (because of inlining vs. being to optimize things away)...
15:24:24
flip214
phoe_: I'm trying to form an opinion whether using such macros in examples like this is a good idea
15:52:57
phoe_
shka_: https://github.com/sbcl/sbcl/blob/7644df292389a51a653dff68cc82d1cc121fd9b6/src/code/time.lisp
16:18:38
shka_
i wanted to get around 1/10 lookup performance of built in hash-table of sbcl, i got it, i am happy
16:37:41
d4ryus
Hi, is there a way to check how many bytes i can read off a stream (iam using usocket socket-streams)? because read-sequence blocks if my buffer size is bigger than the amount of available bytes.
16:39:02
d4ryus
I guess i could loop with LISTEN and read off one byte each time, but that sounds horrible performance wise :D
16:50:04
ym
Trying to build last sbcl from git on OpenBSD I get "./src/runtime/sbcl[1]: ELF: not found" and "./src/runtime/sbcl[2]: syntax error: `(' unexpected" messages. Google says nothing. Am I doing something wrong?
17:12:45
clintm
shka_: is the code you're referring to re. hash-table available somewhere? Sounds like I could learn a lot from it.