freenode/lisp - IRC Chatlog
Search
19:35:43
jasom
Bike: IIRC SICL only uses an HIR to CL translator for a small subset when bootstrapping, and then the new runtime does the rest?
19:37:46
jasom
oh, neat; I'll have to look at both of those. The existence of HIR to CL seems to imply that it can handle cases where code is not stored on a user-accessible heap at least.
19:40:15
jasom
The SICL standard library might rely on e.g. "give me the range of PCs for which this function is executing" for e.g. debugging or conditions.
19:42:20
jasom
well there is lisp and then there is lisp. Plenty of lisp code in the SBCL library makes assumptions about how the runtime works, for example.
19:43:07
jasom
but it sounds like it is worth me learning more about SICL at this point, so thanks for answering...
19:43:10
Bike
it's hard to actually do that, but that's more because of the standard not being modular than because the SICL code relies on internal representations
19:44:04
jasom
There's not any obvious kernel lisp implementation that is the right basis for building a full CL implementation
19:44:50
jasom
ACTION always thought it might be interesting to implement CL in one of the smaller scheme standards just for the sake of portability.
19:45:24
jasom
It's not obvious that e.g. R4RS is a good kernel language for lisp, but you can run R4RS scheme on just about anything these days.
19:49:53
Bike
well, i think the point i want to make is that HIR is high level enough that it doesn't involve implementation details at all, except maybe how big fixnums are. and even then if you don't have inline definitions that won't come into play
19:51:43
jasom
but it does seem like it would be hard to do something like CLiCC with SICL since it expects to be hosted in the final runtime (except when bootstrapping), right?
19:52:46
Bike
that's not a property of the LLVM-IR language. you could have a C backend, compile things into SOs and then dlopen them
19:53:25
jasom
CLiCC can statically compile a subset of common lisp to portable C. https://www.cliki.net/CLiCC
19:54:07
jasom
it's distinct from the KCL family in that it is intended for writing static application code that will be compiled once AOT rather than incrementally compiled and loaded.
19:54:42
Bike
SICL, the implementation, is not intended to do that. beach is all about an interactive system
19:54:57
Bike
I see no reason you couldn't do that in Cleavir, but I don't think that's any interesting property of the IR
1:34:41
aeth
standard in the sense that it's in the standard, while there's no create-TAB tab completions for me
2:47:37
pjb
White_Flame: in the CL package, there's no function name prefixed by create-, but there are prefixed by make-.
3:47:12
PuercoPop
jasom: are you asking about SICL because you want to compile to JS? I remember you tried to get Eclipse CL to compile under ecmascripten
4:58:51
beach
jasom: As Bike said, you can translate HIR to basically any language. But you need a Common Lisp runtime to run it.
5:14:01
beach
jasom: The HIR to Common Lisp translator uses only a small subset of Common Lisp as its target language, because HIR is such low level. The full Common Lisp language is still available as source in order to generate the HIR.
5:36:22
beach
PuercoPope: I could use the full language if I had to, because I execute the HIR code inside a host Common Lisp system. However, the HIR instructions have a kind of natural translation to a small subset of Common Lisp. At the top level, there is a big TAGBODY where each label represents the start of a basic block.
5:37:25
beach
PuercoPope: So it's not that it has to be a subset, which is why I never bothered to define it precisely.
6:09:08
PuercoPope
beach: More than the operators the datatypes could be troublesome. CL supports for example bit-vectors, which I would think one would want to avoid having to implement in the target language
6:12:24
beach
PuercoPop: I really haven't given it any thought since the purpose of SICL is not to have a target language other than native machine code.
6:25:36
buhman
beach: I came up with https://gist.github.com/buhman/06a39c80623eb5d07ec593fd5715c221 which I think has correct behavior for all insertion cases, but I'm also not pleased with the code cleanliness
6:27:43
buhman
(node-insert) can correctly build https://upload.wikimedia.org/wikipedia/commons/e/eb/Insert_%27toast%27_into_a_Patricia_trie_with_a_split_and_a_move.png from a (make-node #f '()) root
6:54:59
didi
So I'm wondering: I have a function (FN) that consumes a static object (made of ordinary lisp objects) to produce an object. As it consumes a static object, this computation can be made during compilation. I see 3 ways of doing it: 1. define a macro that returns a computed object (defmacro mfn (x) (fn x)); 2. define a dispatch macro character that do the same thing as the macro; and 3. use #. to compute the object in read time #.(fn
7:01:13
gilberth
didi: When that is a function and should be function, I would consider a compiler macro.
7:08:04
didi
gilberth: I got the idea from languages (like Python and Racket) that define a special syntax for regular expressions.
7:08:05
gilberth
I have no idea of the nature of the arguments passed to your FN function. But a compiler macro also could bail out and say "Sorry, compiler I cannot do this at compile time, seek to invoke the function at runtime, please."
7:09:54
gilberth
As I said, I have no idea, what your function does. When it turns an external representation into some internal representation though, a reader macro would be fine. Like I used #u"http://foo.com/blah" in my URL library or #/a and #"foo" in my runes library.
7:11:56
didi
gilberth: Indeed. There is no need for secrecy. It reads a regular expression representation and returns an object that is used for matching, just list PPCRE's parse-tree.
7:16:06
gilberth
I always hesitate to define new syntax. Because it easily conflicts with other libraries and you hae issues, that you need to ensure that the read table is set up correctly for files using the stuff. These days. I was fond of reader macros 20 years ago, though.
7:18:03
gilberth
IMHO a macro like (foo (fancy-iteration (or "a" "b"))) would be fine. For completeness you could also have a FOO*, which evaluates the argument. Or: You define a FOO function, which then needs the argument quoted and go with a compiler compiler macro and ask for CONSTANTPness and bail out otherwise by returning the &whole form.
7:19:32
gilberth
Not having the option to build a FOO with an evaluated argument would be bad though. See parenscript for instance. We recently had that discussion right here.
7:20:42
didi
gilberth: Agreed. The function exists and I won't get rid of it. Like I said, I remembered the special syntax for regular expressions and thought it would be a neat optimization for constant regexps.
7:24:35
gilberth
It could be as simple as (define-compiler-macro fn (x &whole w) (if (constantp x) `(load-time-value (fn ,x)) w))
7:31:47
didi
Heh, my ignorance of load time vs. compile time vs. run time has finally showed its ugly head.