freenode/#lisp - IRC Chatlog
Search
23:13:50
jasom
aeth: The way they are usually implemented is that :foo will be resolved to a pointer, but every time you have :foo appear in your code it gets resolved to the *same* pointer, so you can compare just by checking if the pointers are equal (no need to dereference them).
23:15:04
White_Flame
and if GC moves the :FOO symbol object on the heap, all pointers referring to it will be updated during stop-the-world
23:15:07
jasom
Bike: there are reasons to resolve symbols to an index in a table rather than a pointer, and it involves moving GC and hash-tables.
23:16:58
White_Flame
are the issues with symbols + GC + hashtables any different than normal objects + GC + hashtables? Presuambly you're talking about EQ hashtables
23:19:35
jasom
an eql hashtable that isn't indexed by a symbol or a number would be rare (maybe character?)
23:21:31
White_Flame
composite + interning -> eql hash table; composite -> equalp hash table I guess
23:22:44
jasom
right, and symbols are the most commonly interned object, so it might make sense to optimize the case of symbol hash tables.
23:23:25
White_Flame
maybe "interning" might be the wrong word here, but given (1 30 :foo), canonicalizing that to a specific EQ-able instance of that list, using that as a key
23:23:28
jasom
if you hash other composite objects like an equalp hash table, then your implementation is still correct, and you don't need to do any rehashing on GC
23:24:26
White_Flame
the one weakness I often hit is the lack of a caching structure for the hash of a composite
23:25:42
White_Flame
so all of this drives me towards implementing my own application-specific key & hashtable implementations :-P
0:08:54
cobax
Why is Lisp image-based? Why did it start this trend? What was this feature trying to solve?
0:14:19
aeth
cobax: Faster development time. There are other ways, but they came much later afaik. And most involve an IDE.
0:16:28
jasom
cobax: once you have a dynamic environment and automatic memory management, the idea kind of falls out naturally; I'm not sure if smalltalk or lisp did it first.
0:21:24
cobax
from stack overflow I found this bit, and I wonder if this was part of the motivation:
0:21:26
cobax
"There were at one time Prolog systems that saved "working memory" as disk images. It used to be common practice, especially when the OS system calls didn't do a good job with compression and memory-management of special data structures, which is why LISP and Smalltalk did it too."
0:24:58
cobax
Also, where can I read about what entails an "image" and how it is usually implemented, and a minimalist implementation of a lisp-with-image, for example?
0:25:03
jasom
cobax: old applications would do something similar; a document was actually just a memory dump of the data structures the application used.
0:25:21
cobax
I have Queinnec's book and many others but Queinnec doesn't touch on the image-based aspect of Lisp and it is otherwise very rarely discussed
0:25:55
aeth
Recompiling a graphical application while it is running and immediately seeing the changes is a magical thing. (Except, of course, that doesn't always work even in CL. Changes won't always be reflected. It depends somewhat on the architecture.)
0:25:57
jasom
cobax: usually there is a header and some metadata on top; most implementations also support some way of specifying functions to call upon startup too.
0:25:58
cobax
jasom: that is interesting, I wonder what best ways they found to keep the heap, in order to facilitate its serialization
0:26:28
jasom
cobax: if a compacting GC of some sort is used, you run that first and then the whole world is in contiguous memory
0:27:13
cobax
jasom: that makes sense to me, but I am still looking for some papers or hard reading. for instance, it's a bit magical that lambdas can be serialized, among other things
0:28:05
cobax
or does Lisp achieve ease-of-persistence because code is data? and so when it serializes the heap it's just plain old lisp code?
0:28:21
cobax
I have so many books on lisp compilers, they never cover this part, and it's fascinating
0:29:56
cobax
AeroNotix: I have all of Nils Holm's books, I have many old books on old Lisps, and many of the new ones such as "Interpreting Lisp" by Knott
0:31:19
cobax
so if anyone can point me to some good reading on image-based language implementation I'd appreciate it
0:33:32
no-defun-allowed
You are at a dead end of a dirt road. The road goes to the east. In the distance you can see that it will eventually fork off.
0:33:46
no-defun-allowed
The trees here are very tall royal palms, and they are spaced equidistant from each other. There is a shovel here.
0:39:45
no-defun-allowed
anyways, how could you write a long string with lots of embedded #"s in them?
1:42:12
White_Flame
cobax: it's always fun to read old Lisp machine manuals, you can get a sense of the scope of the utilities they had
1:45:20
johnjay
AeroNotix: ah ok. when the world renowned expert in X doesn't understand X that well
2:20:49
no-defun-allowed
(the hypothetical fight is an important question cause obviously whoever would win in a fight knows more about lisp and the two are correlated)
2:20:50
aeth
no-defun-allowed: I'd personally say the HyperSpec and anything covered by a de facto standard portability library (MOP, bordeaux-threads, CFFI, etc.)
2:25:03
no-defun-allowed
still of course xahlee knows everything about lisp and emacs and we must follow his intellectual thought
2:30:04
no-defun-allowed
for a while i thought emma-__ (mod of /r/emacs) and another emma (devout vim user) were the same person
2:44:13
AeroNotix
johnnymacs: a y combinator is a way to implement recursion using anonymous functions
2:47:05
johnnymacs
I do not know if in a non lazy langauge it will stack overflow. I also do not know if it has a clause for termination.
2:48:09
AeroNotix
johnnymacs: you're in #lisp, which is for Common Lisp. Common Lisp isn't (by default) lazy.
2:48:30
AeroNotix
secondly, the clause for termination is up to the functions being passed to and initially called by, the y-combinator.
2:49:07
johnnymacs
As long as there possibly is a clause for termination this answers my second question. My first question remains unanswered.
2:49:32
jcowan
When using symbols at run time, rather than to hold the values of globals, is it normal to use the symbol-value and symbol-function slots for anything?
2:50:10
johnnymacs
Are you saying that because common lisp does not require this that the y combinator will stack overflow?
2:50:35
johnnymacs
So the y combinator will only overflow if the function passed to it will cause an overflow.
2:50:39
AeroNotix
I am saying to write portable Common Lisp you cannot expect a program which requires TCO to work properly, to work properly.
2:51:20
jcowan
johnnymacs: But if you go over to the Scheme side of the Force, you don't have that problem. -)
2:51:45
White_Flame
if you look at the docs of your implementation, particularly around optimization declarations, you should see if they can enable it or not
2:52:31
White_Flame
if it's supported, it's usually at some speed level setting, not necessarily a separate declaration
2:52:32
AeroNotix
I really hate answers like this tbh. I wish we could all just agree that SBCL is the shiznit and all to use that
2:53:46
jcowan
I can understand not supporting it in a particular implementation, but why would support be selective in systems that do support it?
2:53:57
AeroNotix
jcowan: what do you even mean btw? I've been mulling it over since you posted it but I don't get why you mentioned "rather than to hold the values of globals"
2:54:17
AeroNotix
jcowan: I've never understood selective support either. I've brought it up a few times in here
2:54:32
jcowan
iow symbol slots hold the value of defun, defmacro, defparameter, etc, and at run time you can discover those values.
2:54:33
AeroNotix
The standard makes no recommendation either way on TCO, which makes it *even worse*
2:54:59
jcowan
But symbols can also be used as a pure data structure, in which case the p-list helps you associate auxiliary information with each symbol.
2:55:27
jcowan
You also have the symbol-value and the symbol-value slots: is it usual to use them in such applications?
2:56:43
jcowan
AeroNotix: The Java argument not to support it is that people want full stack traces, and stack traces are hard in the presence of TCO
2:57:05
jcowan
otoh, it's not uncommon to have hundreds of lines of stack trace in Java exceptions: who looks at those?
2:58:03
jcowan
If foo is global, then #"foo is (symbol-function 'foo) and foo is (symbol-value foo).
2:58:26
jcowan
But here I am talking about the use of symbols as pure data structures, not as part of the implementation of global variables.
2:59:35
AeroNotix
jcowan: do you mean to fill those slots with garbage only your program understands?
3:00:28
jcowan
Technically the function slot has to be filled with a function, but I don't know if anyone enforces that or not.
3:00:42
White_Flame
the only 3 fully accessible slot from the spec seem to be symbol-function, symbol-plist, and symbol-value
3:01:10
White_Flame
so the macro binding, etc, probably aren't directly available via normal/portable code
3:01:57
jcowan
but I don't know why you say symbol-name (and symbol-package for that matter) are not accessors
3:02:24
Oladon
Anyone have any suggestions for finding something similar to https://bugs.launchpad.net/sbcl/+bug/1654550 in Weblocks, where it's breaking something with the MOP somehow, but I'm not sure what method(s) it's defining that are breaking things? It's not the specific example in the link; that appears to have been fixed (based on grep), but I'm still getting that weird unknown pointer error, and I'm not sure the best way to track down the culp
3:04:00
White_Flame
"accessor" means you can read & write. "function" just means you can call it and it does something & returns something
3:04:59
White_Flame
there's nothing in the spec that requires symbols be objects with slots. It could create an integer per symbol, and have separate arrays for some symbol-* interfaces, and do other thigns with others
3:05:32
jcowan
I'm thinking about writing a symbol-and-package system for Scheme for runtime only. Of course it doesn't have to conform to CL, but I don't want to make it *gratuitously* different.
3:05:34
White_Flame
but yes, most will likely be structs, with some overrides to optimize NIL being both a symbol and sort of a cons cell
3:05:34
AeroNotix
Oladon: a bare sbcl shell doesn't exhibit the same behaviour. There's something missing from that bug report
3:06:10
Oladon
AeroNotix: They fixed that specific bug, but if you quickload weblocks and then try to make-instance something, you'll get the unknown pointer
3:06:28
jcowan
Still, it sounds like I can leave out all the machinery around the value and function slots; if you want those things, put properties on the p-list.
3:06:43
White_Flame
aeth: coming from 6502 home computer land, that was a very common data organization method, as you didn't have easily flexible full 16-bit pointers
3:07:07
Oladon
It looks like they do have an :around method defined on initialize-instance with ((obj composite)) as the first arg... wonder if that'd do it.
3:07:11
White_Flame
right, that's why I said "sort of a cons cell", so CAR/CDR of NIL can easily return NIL without type checks
3:07:16
jcowan
Historically NIL was stored at address 0 as a cons whose car and cdr slots pointed to 0, and punned with a symbol
3:07:53
jcowan
so e.g. the first two slots of a symbol were name and package, say, and then the logic for getting the name and package of NIL was special cased
3:09:00
White_Flame
aeth: btw, symbols probably also allocate an integer offset for themselves for a thread-local binding table, so you're not totally wrong
3:09:03
Oladon
AeroNotix: Nah, but seriously, I like a lot of its ideas, and in theory it should still run...
3:09:30
AeroNotix
Oladon: I'm playing with a few ideas in the repl now but don't expect much, I don't care about weblocks at all.
3:11:22
White_Flame
aeth: in SBCL, accessing a special variable means dereferencing a TLS offset from the symbol structure, reading that entry from the thread-local table, if that's unbound then hit the symbol-value slot of the symbol object itself
3:11:32
AeroNotix
Though, :around :before :after methods, as you suggested sounds like a sound place to start your debugging
3:11:57
Oladon
Yeah, just not sure where to go from there. So they've got an :around method on initialize-instance... now what? :)
3:13:48
Oladon
Eh, this is unlikely to be it... it's on a specific type of weblocks class: https://github.com/skypher/weblocks/blob/master/src/widgets/composite.lisp#L14
3:14:37
AeroNotix
https://github.com/skypher/weblocks/blob/master/src/widgets/composite.lisp#L4 always a good sign
3:16:22
Oladon
Just inspected #'print-object, and it looks like there /is/ a method being defined... but my grepping didn't find it D:
3:38:28
Xach
mfiano: is http://report.quicklisp.org/2018-09-11/failure-report/cl-sdl2-ttf.html#sdl2-ttf the same thing?
3:56:16
AeroNotix
Xach: there's no reason mfiano couldn't have tested all systems in quicklisp with the new release
3:57:45
AeroNotix
jcowan: the yo was just to tag you if you were interested in the outcome of mine and Oladon's pms
4:16:55
no-defun-allowed
https://matrix.org/_matrix/media/v1/download/matrix.org/VcDpibRxlVLRuDDvzEyxBMQO
4:25:17
beach
no-defun-allowed: When I lived in Auckland for a year, there were around 5 lispers within a radius defined by a 3-hour flight. Here in Europe, there are hundreds.
4:35:39
no-defun-allowed
when i lived in melbourne for 17 years, there were around 2 lispers within a radius i didn't really measure
4:47:37
drmeister
Hey - are there any lispers who use 'buildbot'? It's a Python continuous integration system. I just figured it out for building a Clasp CI system. I'm interested in comparing notes.
5:17:47
beach
MAKE-METHOD-LAMBDA says that the METHOD argument may be uninitialized. It doesn't say that about the GENERIC-FUNCTION argument, but it says that it might not be the generic function that the method will be used with, so I don't see what information MAKE-METHOD-LAMBDA could use about that generic function, other than its class.
5:19:15
beach
If I am allowed to pass an uninitialized generic function to MAKE-METHOD-LAMBDA I can solve the problem indicated by Pascal Costanza's article.
5:20:57
beach
For DEFGENERIC, the file compiler can just store the GENERIC-FUNCTION-METHOD-CLASS and the METHOD-CLASS arguments with the name of the generic function in the compile-time environment.
5:38:05
no-defun-allowed
okay bad idea time: it'd be interesting if CONSTANTLY could return multiple values
5:38:32
no-defun-allowed
so basically (defun constantly (&rest values) (lambda (&rest ignored) (multiple-value-list values)))
5:52:31
mfiano
Xach: Seems to be. For some reason library authors think it is good practice to assume transitive dependencies will always be present instead of writing a proper system definition.
5:54:18
mfiano
So that makes all 3 third-party cl-sdl2 addon libraries at fault assuming a dependency specified in cl-sdl2's :depends-on list will always be present. Impressive.
5:54:53
mfiano
Sadly I do not have commit access to repositories outside of the lispgames GitHub organization to fix that one.
5:58:21
mfiano
With cl-sdl2-ttf, it is even worse. It is directly calling trivial-garbage functions itself.
7:49:18
shrdlu68
shka_: Sorry, got disconnected. I haven't tried your btrie yet, but I tried cl-container's trees and the performance was sub-par to hashtable.
8:26:55
shka_
shrdlu68: simply make node with make-bit-trie, then use setf at-bit-trie to populate it
8:59:06
shrdlu68
shka_: Am I doing it right? https://gist.github.com/shrdlu68/6a4e624f3562c2bb81474827bb59edd3
9:17:56
minion
j`ey: Cleavir: A project to create an implementation-independent compilation framework for Common Lisp. Currently Cleavir is part of SICL, but that might change in the future
9:18:43
j`ey
I see in the example it uses sbcl, so Im not sure what cleavir does before?/after? SBCL
9:18:48
beach
j`ey: Basically it is a compiler. But since every implementation has its way of compiling things, it must be possible to customize it.
9:19:27
j`ey
(cleavir-hir-interpreter:interpret-hir (cleavir-sbcl-environment::compile-cleavir '(lambda () (+ 32 10))))
9:25:39
minion
.(run-program "rm" '("-rf" "")): An error was encountered in lookup: Parse error:URI "https://www.cliki.net/.(run-program%20\"rm\"%20'(\"-rf\"%20\"\"))?source" contains illegal character #\" at position 38..
9:26:55
beach
j`ey: That is up to the implementation to decide. Currently, Cleavir first converts the Common Lisp code to an AST and then the AST to HIR (High-level Intermediate Representation). Then it runs some optimizations on that code. The rest is pretty much up to the implementation.
9:29:45
beach
The compiler book mentions MIR which is pretty standard. HIR has the interesting characteristic that all objects manipulated are Common Lisp objects. Address calculations are not exposed.
9:29:55
dim
beach: I guess you have a disassemble like function that outputs the optimized HIR? I kind of like poking into those levels of abstractions from the REPL ;-)
9:30:06
no-defun-allowed
Clang/LLVM uses an IR which is distinct from the C it consumes and the assembler it emits
9:38:42
beach
That's why I wrote the visualizer. We used Graphviz, but it was impossible to follow even a slightly complicated graph.
9:39:26
beach
Plus, it was tedious to use. Generate dot, translate it to (say) PDF, start the PDF viewer.
10:06:13
beach
j`ey: At the moment, yes. But I intend to supply highly customizable translators to MIR and machine code.
10:07:23
j`ey
a few years ago I looked at clasp quite a bit, but I've forgotten all the details now :(
10:12:34
beach
Yes, this past summer karlosz worked on a GSoC project to write a Cleavir-based compiler for CLISP.
10:15:27
j`ey
https://github.com/robert-strandh/SICL/blob/master/Code/Evaluation-and-compilation/defmacro-defmacro.lisp#L3 :D
10:28:19
makomo
curl: i don't think that's specific to racket. it's just a particular representation of horn clauses (i think)
10:29:01
makomo
horn clauses are a specific thing from logic -- why would racket have something like that built-in
10:30:02
makomo
well then, what horn clause that list represents depends on how you're representing/encoding those horn clauses within your program
10:30:06
curl
I'm supposed to implement a function which decides whether a given horn clause is satisfiable
10:33:26
beach
j`ey: It was too confusing. I imported too much stuff from the host, so I couldn't keep track. I got "no applicable method" errors instead of "unknown function" errors.
10:37:10
beach
j`ey: I am going to have lunch guests in a few minutes. I'll be back in a couple of hours.