freenode/#lisp - IRC Chatlog
Search
18:52:29
Xach
i think dribble is the vestige of a more powerful, supportive system that could not be wedged into CL
19:22:07
jasom
FWIW when I used vi and only used slime as a debugger/repl, asdf:reload-system was my friend.
20:19:08
aeth
Hmm, it looks like one part of this one loop needs a really complicated GOTO for performance reasons so 8 things can share one implementation. Oh wait, I can just use a local function closure. Thanks, Sussman and Steele.
20:28:24
aeth
Paris? Everyone knows the capital of Lisp in France is Bordeaux because that's where they make the Lisp threads that they then export to the rest of the world.
20:33:34
aeth
Fun fact: they picked Bordeaux because it's a port city so it's easier to export the libraries that way.
20:36:34
no-defun-allowed
"I can't live without it, I just love it! Oh my gosh I don't even buy pipes with other SBCL instances anymore. If you're gonna create your threads or any mutexes, you'll be out of your mind not to own one of these. All I can say is Bordeaux! Threads!" ~Vince Offer on bt
20:43:18
no-defun-allowed
I thought of another optimization to speed up CL-as-an-emulator-translator too, you could try to lift registers out of the register array and hopefully they'd go into machine registers.
22:01:38
newbie1
hi all, Given that use-foldr consumes a (listof Nat): (define (use-foldr L) (foldr myfun "some-str" L)) What is the contract for myfun ? What is the contract for use-foldr ? can someone guide me?
0:30:21
griddle
Does anyone know of a good reading source for how lisp JIT compilers or ahead of time compilers work? I'm mostly interested in how scoping is implemented
0:33:19
Bike
The most obvious way is that the (lambda (y) ...) produces a "closure", which stores the binding of x along with the function.
0:37:53
griddle
and you'd have some kind of feature to lookup information in that structure? Or would you know ahead of time where in the structure that value lives
0:47:14
aeth
griddle: Naively, there could just be a defstruct to create a structure-object for every scope except the global one. Gensym its name to avoid the problem with redefinition.
0:47:21
jasom
griddle: In a compiled implementation, a lexical binding is just a mapping from an identifier to a location (i.e. lexical bindings do not need to exist in a meaningful way at runtime, only at compile time).
0:47:59
aeth
(I say structure-object because they're simpler and they can have inline accessors, or something like that. i.e. the location is known to the compiler at compile time)
0:48:23
Bike
i think if griddle doesn't know what a closure is they might be unfamiliar with defstruct.
0:49:02
griddle
I've implemented a lisp interpreter in the past, I'm just looking into how things like lexical scoping is done in a JIT if you can define different variable names at runtime
0:49:10
jasom
what usually happens is compilers have an expensive binding implementation that works in all cases and lives on the heap, but then a fast binding implementation for when a variable is never closed over (or is only closed over by lambdas that don't escape the heap).
0:49:53
jasom
griddle: for the most part, compiled implementations of lisp do not allow manipulation of lexical bindings at runtime
0:50:52
jasom
dynamic bindings have a defined lifetime at runtime, and those can be accessed via symbol-value.
0:52:23
griddle
yeah in past I've just had a really slow implementation with a recursive scope lookup of dynamic bindings
0:53:16
jasom
griddle: for variables that are never closed over, the value can be stored in a register. For variables that are closed over by lambdas that don't escape the dynamic scope, it can be the stack. For variables that are closed over by lambdas that might escape the dynamic scope, they must be stored on the heap.
0:53:44
jasom
griddle: I think you have dynamc and lexical backwards. Dynamic bindings are trivial to implement with global variables and unwind-protect.
0:56:55
aeth
jasom: Absolutely (re: expensive and fast implementations). The variable isn't even guaranteed to exist unless (debug 3)
0:57:22
aeth
On the plus side, that means that there's no (runtime) cost to naming intermediate steps if you want to
0:58:07
jasom
griddle: if you're familiar with compilers for less dynamic languages, all the approaches used there for temp allocation work just fine for any variables that are never closed over.
1:02:57
verisimilitude
Well, I enjoy the colorful phrasing RMS used, comparing the stack to a government agency.
1:03:17
verisimilitude
Put simply, treat the stack as a stack until it can no longer be treated as a stack, in which case it was never really a stack at all.
3:06:13
jcowan
I understand the idea of conditions with restarts, such that the condition-catcher can choose which restart to invoke, do a snippet of code set up by the signaler, and then either return or do a non-local exit
3:34:50
jcowan
Bike: I was thinking of restart-bind and friends, the ones that push the restarts into the dynamic environment
3:35:28
Bike
well, probably restart-case expands to restart-bind, actually. the condition association is a separate thing.
3:36:20
Bike
in sbcl at least, with-condition-restarts just puts the condition on a list stored within the restart.
3:37:52
Bike
usually handler-bind and resetart-bind just shove the thing on an internal dynamically bound list
3:41:05
Bike
you can do an ASSERT, and when an ssert fails it'll pop up the debugger and ask for new values to use
3:42:34
no-defun-allowed
if i'm destructuring in a loop for clause, can i give the destructured values of-types?
4:49:58
jcowan
I push some restarts on the stack and invoke some code that eventually calls assert. The user, or I on the user's behalf, chooses a restart, its code is executed, and the assert returns. But presumably the caller of the assert was doing that because some assumption that it depends on is being violated, and what is the caller to do when unexpectedly he gets control again?
4:50:44
Bike
i think you're misunderstanding something. control won't return from the assert unless the restart was set up in the assert.
4:51:13
Bike
if you have like, (restart-case (... (assert ...) ...) (foo ...)) and select the foo restart when the assert fails, control returns from the restart-case. the assert is abandoned.
4:53:35
Bike
with restart-bind you can have a restart that doesn't transfer control like that or at all, but i honestly have no conception of why anyone would want that, so i can't help there.
4:57:59
verisimilitude
You may be interested in the similarities between Common Lisp condition handling and PL/I and Multics, jcowan, if that's something you already find interesting.
5:13:18
jcowan
It appears to be plain exception handling with resumption semantics, like Scheme or Mesa (both of which I have used). But restarts seem to be only in CL and Dylan.