freenode/#lisp - IRC Chatlog
Search
13:16:37
jmercouris
Any way to change the initform of a slot in a class, after the class has been eval'd?
13:17:59
jmercouris
beach: what if I just want to specify that one slot-value? can I use change-class?
13:18:45
jmercouris
the use case, is, a user changing the initform of a slot of a class that they have not defined
13:19:52
beach
jmercouris: If the user did not define the class, the user has no business altering it.
13:20:07
jmercouris
well, I am allowing them to do it, that's the idea, allowing them to customize how the class starts up
13:21:13
jmercouris
okay, here's the very concrete problem: we want buffer specific variables in Next
13:21:44
Bike
global variables are definitely preferable to redefining a class at runtime, which is what you're talking about here
13:22:46
Bike
if you want to let a programmer customize your class what you usually do is let them define a subclass.
13:23:06
Bike
and then you'd want some kind of mechanism so that the rest of the code will instantiate their class instead of your default class, i guess.
13:27:49
heisig
jmercouris: Another option is to add a mandatory 'client' argument to all your generic functions. Its value is initially provided by the user and then passed along.
13:29:45
jmercouris
and then make a thin veneer over defclass to emit global vars for speciallly marked slots
14:40:10
fivo_
Why does (read-from-string "(let ((a '#1=(10 . #1#))) (nth 42 a))") result in infinite recursion and when I evaluate the expression in the REPL it runs fine?
15:27:58
pjb
(read-from-string "(let ((a '#1=(10 . #1#))) (nth 42 a))") #| --> (let ((a '#1=(10 . #1#))) (nth 42 a)) ; 37 |#
15:51:06
sjl_
also, if you're pasting more than 2-3 lines at once, it's generally better to use a pastebin. freenode rate limits so after the first couple of lines they start to slowly trickle in one-by-one
15:51:48
beach
refpga: The forms are evaluated left-to-right, but the variables are bound "in parallel" for LET.
15:57:15
pfdietz
LET* does the binding interleaved with the evaluation, so VAR1 would be visible in FORM2, etc.
15:58:45
shka_
refpga: btw, if you are feeling stressed, inadequate or otherwise uncomfortable at #lisp there is also channel #clshool
16:17:33
fivo_
I am essentially looking for some read function that would return source-line and column
16:17:34
Bike
fivo_: the line and column info is implementation dependent, if that's what you're asking
16:17:57
Bike
https://github.com/robert-strandh/Eclector is a reader library that you can get source info from
16:20:00
Bike
so like (source-line 'funcall)? that's not in the standard (which doesn't mandate implementations be open source, even) but common tools support similar functionality.
16:24:44
fivo_
Essentially I wanted to know if there is something similar to READ that parses some expression but gives me also other types of information like source-line, column, original package of the symbol.
16:25:56
Bike
if you use the eclector reader, it will give you an object with information about the source positions of _the stuff you read_.
16:27:36
Bike
well, you can try eclector and see. you can get information about the position of the funcall symbol in the code you read, but it won't tell you where the funcall function is defined.
16:33:21
pjb
fivo_: (read-from-string "(toto:funcall #'(lambda (x) x) 1)") #| ERROR: There is no package named "TOTO" . |#
16:38:01
beach
fivo_: I think Bike is on to what you are trying to do. And I think you are confused.
16:42:17
Bike
fivo_: in that case eclector would be helpful. though in this particular case, where you're reading from a string instead of a file, there's not a lot of source info to be had