freenode/#lisp - IRC Chatlog
Search
13:54:42
lottaquestions
Hi all, I inserted a breakpoint in a function using (break), and it worked as expected. However, once I was done with the breakpoint, I deleted it from the code and recompiled the whole buffer, C-c C-k, and the breakpoint kept being hit. I tried other options like M-x slime-eval-region, and even C-c C-c to compile the toplevel form, but the
13:57:31
lukego
maybe the function object was captured with #'foo? in that case seems tricky, have to work out where the reference would be stashed
13:58:29
lukego
maybe recompile the cl-ppcre:regex-replace-all usage in case that has expanded into code that captured the old definition?
13:58:43
lukego
you need to rerun th at code that does #'foo and make it tak the new function object
13:59:13
lukego
(and consider changing it to just 'foo if you want to indirect through the symbol to always use the current function definition in the future)
14:00:30
lukego
if you're in the debugger maybe you can patch the function object in the stack frame but that's beyond my ken..
14:02:46
lukego
another fun solution would be to hit the BREAK, get a reference to the old function object in the inspector, and then rewrite the heap to replace all pointers to the old function object with the new one. but I don't know how to do that either :) likely sbcl has some internal API for it..
14:07:09
lottaquestions
yeah, that would be fun. I know how to do somewhat similar things in gdb and C, and woudn't mind getting to the same skill level with sbcl
14:32:51
trittweiler
Clearly slime needs an interactive hex-editor of the dissasembly of function objects :)
14:33:41
trittweiler
lukego: Are you aware of sbcl's 20th birthday celebration in vienna in roughly 2 weeks, and if so, are you going to join?
14:40:40
lukego
I'm totally tying myself in knots with this ql2nix problem now. I've made a new version that hopefully works, but it seems to be failing with the same error, and much earlier than makes sense, so I'm wondering if the new "working" one is trying to bootstrap from the old broken one for some reason
14:50:23
lukego
oh, I see, I'm an idiot :). I have been working in *shell* instead of a real shell and now I remember that I started this Emacs session in a shell environment that had the broken lisp setup. So I've been fighting that old version while thinking I'm fighting the new one. (isn't nix-shell great?)
15:07:36
lukego
Xach: Thanks! Just now what I want to do is force each system in a Quicklisp bundle to be loaded. That's because some packages need to do extra init on the first load and I want that to happen now (before I copy them onto a read-only file system.) Is groveling system-index.txt for names to pass to REQUIRE a reasonable solution?
15:09:27
phoe
lukego: remember that some systems may fail to load if their foreign dependencies are not loaded.
15:10:28
lukego
I'm able to declare foreign libs as dependencies here so long as I can identify them. (McCLIM is complaining it can't find truetype fonts but I'm putting that to one side for now.)
15:11:36
lukego
somehow feels dirty to (intern (string-upcase (pathname-name (pathname line-from-system-index.txt))) :keyword) but this is not the time to be squeamish..
15:28:12
pjb
lukego: you don't need to call pathname, it's called automatically by pathname-name when given a namestring.
15:28:49
pfdietz
In twitter I am told that writing seven lines of CL is "on the verge" of reimplementing the language. The things one learns.
15:30:54
lukego
it it too onomatopoeiac to write (loop for /some/system.asd = (read-line in nil) ...) ?
15:48:33
Xach
phoe: pfdietz's suggestion to use *macroexpand-hook* to work around a problem with code that can't be directly modified was met with "well then i may as well rewrite common lisp"
15:57:25
Xach
lukego: i don't know exactly how i feel about loop variables that look like pathnames but i am feeling something
16:12:01
Shinmera
So a brief test shows that a top-level invocation of a declaration defined with cltl2:define-declaration does not actually get invoked at all on SBCL. If I use the same declaration as part of a function definition it does get invoked. Am I missing something or is that expected behaviour?
16:16:03
Bike
cltl2 doesn't seem to mention this specifically, but it refers to it in the context of augment-environment, which wouldn't be used with a proclamation.
16:17:45
Bike
not based on my quick reading here, but if it did work for proclamations too that seems fine
16:18:26
Bike
i don't know if sbcl is prepared to do that, though. looking at the implementation, user declarations augment the lexenv, but that's not where proclamations go
16:20:46
Shinmera
To give context: I'd like to register functions to be automatically invoked when a change happens elsewhere in my system. Being able to use a declaration for that would have been really nice.
16:21:23
Shinmera
But given that I can't do proclamations, nor get the function name from a declaration being expanded, the only way to do it would be annoying for the user.
16:22:30
Bike
well, i think you could change implementations to have it work for proclamations, if only because cltl2 is used infrequently enough that they won't mind modifications
16:24:28
Shinmera
I don't think I'm patient enough to lobby for that to happen, nor to implement it myself.
16:56:52
pfdietz
I like *macroexpand-hook*. Using it to layer changes onto a code base, without changing that code, can be quite useful. Rejection made me sad. :(
20:43:00
Bike
i'm talking about uh, slide 7-1. i don't understand what it would mean for assert and MAXLIMIT to compose. i mean if nothing else is assert is taking a form that has a MAXLIMIT form in it, it's not a direct composition, but what would a direct composition mean then if you have compound forms
20:48:46
LdBeth
Until 7-1 it’s all about introduction to new comers. Jump ahead to 8 to see what is macro compose
21:10:50
copec
Some people aren't particularly fond of Graham's writing style: http://www.paulgraham.com/onlisp.html
21:17:50
copec
I've never actually found myself really needing continuations for anything, but they are awesome.
21:18:42
LdBeth
copec: nope, paul graham only talks CPS and macro individually. Combining CPS and macro has become interests only after 2000 in Daniel Friedman’s article
21:19:41
copec
I read it a decade ago, but iirc he builds up a macro system for continuations in CL, although I can't recall if it is actually CPS
21:22:35
LdBeth
copec: https://www.semanticscholar.org/paper/Writing-Macros-in-Continuation-Passing-Style-Hilsdale-Friedman/752575dc24b2bb6e74ee6146df71860e10e3aee9
21:24:20
LdBeth
Here’s the article. It makes a disclaimer that On Lisp implements call/cc with macro but not to be confused with the notation of cps style macro
22:10:23
jmercouris
I assume therefore that most of the functions and implementation is implemented in CL
22:11:06
jmercouris
so my question is, what is the minimum amount of functions you need to write to bootstrap a CL implementation?
22:11:42
phoe
you can generate the whole binary from Lisp, including what is currently generated from C as the "kernel"
22:12:08
phoe
which includes directly interfacing with the OS using Lisp, writing the required assembly using Lisp, actually assembling it using Lisp, doing GC using Lisp and so on
22:13:37
jmercouris
I don't see how that's possible, ultimately something has to go through the Potato compiler
22:13:43
Xach
jmercouris: in the 80s, there was a plan to separate the spec into "blue pages" and "yellow pages", where "blue" was the core, and "yellow" was built on that core, where blue was much smaller and yellow was all the convenience stuff.
22:13:47
sjl_
The number for Shen is 46. http://shenlanguage.org/OSmanual.htm I'd imagine CL would probably need a bit more.
22:14:58
Xach
jmercouris: beach has recently been working on things along those lines, in a researchy sense, and drmeister in a practical sense
22:15:13
phoe
but these are not 100% compatible with each other and all have been customized and maintained differently
22:15:22
sjl_
http://www.shenlanguage.org/shendoc.htm#The%20Primitive%20Functions%20of%20K%20Lambda is a better link for the Shen Kl core
22:17:05
jmercouris
how could one make a most portable language that can be bootstrapped really easily?
22:17:29
jmercouris
from what I understand, this is a topic of significant research, so I'm not expecting a hard answer here
22:18:35
phoe
in case of CL, it's complicated - CL is a sizeable language even when it comes to its basics upon which the rest can be built
22:18:42
Xach
Anyone making a "new" lisp these days has a lot of public domain source code they can reuse that is relatively portable, but it's not neatly divided into core+library.
22:20:39
phoe
CATCH/THROW and TAGBODY/GO are obvious control flow operators that are hard to construct otherwise
22:20:42
drmeister
jmercouris: It's been ready for distribution as a Common Lisp implementation for several months.
22:21:19
phoe
jmercouris: obviously it is, yes - the list of all symbols of CL package is public and we can align them into a directed graph that shows what can be implemented using what.
22:22:12
jmercouris
how could we align them into a directed graph without manually trying to implement all of CL in all of CL?
22:23:17
jmercouris
that's the thing though, can those functions be further reduced to a set of functions?
22:23:46
jmercouris
for example, could I write only 3 functions in potato that can be combined to produce all the "primitives" I need?
22:24:33
jmercouris
what if we slightly extended our spec with a couple of Lisp functions, could we get away with only two Potato functions?
22:25:51
jmercouris
drmeister: how did you decide what to implement in C++ for Clasp? I see it is a much bigger proportion of C++ than SBCL is C
22:26:22
Xach
it's a nice read on thinking about how to determine if something is "more primitive" than something else.
22:27:00
drmeister
We need to bootstrap from a C++ compiler. So I wrote whatever I needed to bootstrap in C++ until I can start using Common Lisp code during the booting phase.
22:27:20
drmeister
I also cribbed a lot from ECL - so if ECL implemented something in C I tended to implement that thing in C++.
22:28:07
White_Flame
jmercouris: I think your "I want to implement CL on top of Potato" is a bit off. You don't need to build CL on top of Potato. You can implement CL directly talking to the asm interfaces of the OS, bypassing Potato
22:28:48
jmercouris
White_Flame: I'm not trying to implement CL ontop of Potato, this is a purely theoretical conversation
22:29:17
White_Flame
jmercouris: right, but SBCL for instance isn't "built on top of C" inasmuch as it only uses C for some bootstrapping and low level runtime support
22:29:41
White_Flame
compiled CL functions in SBCL are not C functions, so I would say that does not count as "built on top of C", as it's no longer C that's running
22:33:17
White_Flame
things that I would consider "built on top of C" would be a C-based interpreter, a macro/function suite that allows you to program in the sublanguage from right within C, which expands to C code, or a Lang->C converter a la ECL
22:38:17
copec
Essentially all of the compilation to machine code (Or internal object code I suppose you could say) is done by CL based code, only the interface between that and the OS is in C
22:38:56
White_Flame
and technically that C layer is unnecessary, just easier to do it that way in a OS with a C API
22:41:03
copec
You could say they all trace their lineage back to a lisp image that was bootstrapped from ASM
22:42:43
phoe
copec: oh right, https://www.pvk.ca/Blog/2014/03/15/sbcl-the-ultimate-assembly-code-breadboard/
22:42:49
White_Flame
CL functiosn themselves have no C involved. But the API to hit the OS goes through C
22:44:33
copec
well, the internal assembler is used by all the code, but the CL code to build SBCL initially is run by the host CL implementation
22:49:10
copec
You might like https://github.com/clasp-developers/clasp/wiki/The-Build-Process jmercouris
22:50:13
logicmoo
one trick i am doing in WAM-CL is coding soemthning in prolog by hand.. hten translating ECL lisp src to Prolog to replace what i wrote in prolog by hand.. eventually will have no hand written Prolog code
22:52:50
copec
I asked beach if they had a strict subset of CL that SICL was implemented with, but the answer is nay. So it can be really confusing until you remember that once it has compiled itself enough times, the less optimized code gets replaced
22:58:14
copec
SICL is CL written in CL using all the modern knowledge of implementing a CL, according to my understanding
22:59:09
copec
Clasp is essentially enough of a CL written in C++, using the LLVM libs, to build SICL
23:21:18
copec
Also, Clasp has C++ objects working with a dynamic garbage collecting memory allocator, and drmeiste is a chemistry guy, not a cs guy
23:25:36
edgar-rft
Structure and Interpretation of Chemistry Programs (still to be written by drmeister)
23:40:14
pjb
jmercouris: sbcl shares some with cmucl. ecl shares some with kcl. ccl shares some with mcl.
23:42:00
pjb
jmercouris: there's no defined or unique kernel to CL. beach's programming sicl using the whole CL. You could theorically implement a CL using only the 35 special operators. Or just lambda. It's a silly question with no answer.