freenode/#lisp - IRC Chatlog
Search
9:08:53
beach
So at least I convinced myself that the previous example with B1 B2 U1 U2 is not a problem.
9:09:39
beach
The "unwinder", i.e. the procedure that executes the steps of section 5.2 is basically executed as a result of a function call.
9:11:13
beach
If U2 executes the unwinder again, that second invocation will end with a non-local jump to B1, and the first invocation of the unwinder will be automatically eliminated.
10:29:56
isBEKaml
How can I define optional arguments with default values in defuns? as an example: (defun factorial (n (acc 1)) ...) ?
10:32:22
White_Flame
acc = defaults NIL. (acc 1) = defaults 1. (acc 1 acc-p) = the acc-p boolean tells you if the caller actually included that parameter or not
10:32:40
White_Flame
the latter, because (factorial 3 1) is ambiguous as to whether the 1 was passed or defaulted
10:32:59
isBEKaml
White_Flame: yeah, I vaguely remembered seeing something like that in PG's ANSI CL book
10:33:34
White_Flame
also, there's #clschool for basic questions, a lot of responses will get advanced here
10:34:28
isBEKaml
thanks, I have worked around my failing memory with labels in that factorial function now
12:03:40
beach
To me, it is looking more and more like the authors of the standard had some very concrete implementation of the dynamic environment in mind, and that they tried to avoid such a concrete description in the standard, in favor of some more abstract language. The net result is a loss of precision, and also some contradicting terminology.
12:05:00
beach
I am currently trying to recover that concrete description. And then I will try to find a better way of turning it abstract so that no precision is lost. I am not sure that I will be able to do that though.
12:15:29
beach
It is interesting how one can think that one knows a language pretty well, but then when one tries to create an implementation of it, one discovers several holes in one's knowledge about it. And some holes in the specification of it as well.
12:37:15
ralt
a simple single-threaded event loop using only lisp and some small cffi wrappers is not too hard to do
13:46:41
Xach
i used it to do async dns and async http to have bounded response times for a web app.
13:52:17
ralt
Xach: yes, that's my point, a custom single threaded one is fairly straightforward once you have epoll
13:53:45
Xach
i cheated and didn't use the system resolver, just parsed resolv.conf and did direct networking myself. which does not work in all situations but did for me.
14:05:56
dlowe
I have no idea how this got called grovelling - maybe it's basically a form of giving up and begging other languages to do things
16:20:45
beach
Here is another question: Suppose we have a dynamic environment with entries C1 B C2 U, where C1 and C2 are CATCH entries with the same tag (say C), B is a BLOCK entry and U is an UNWIND-PROTECT entry. C1 is the oldest and U is the most recent. Now we do a RETURN-FROM B. So C2 is "abandoned". Then we run the cleanup forms in U. Suppose that U does a (THROW C). Is this operation invalid because C2 has been "abandoned", or is C1
16:25:34
beach
(catch 'c (block b (catch 'c (unwind-protect (return-from b) (throw 'c (values)))))) or something like that.
16:27:26
Bike
the clhs page for throw says it goes to "the most recent outstanding catch". I think interpreting "outstanding" to mean "not abandoned" is reasonable, and there's nothing to force the abandonment of C1, which is not an intervening exit point
16:28:12
Bike
also "the cleanup clauses of an unwind-protect see the same dynamic bindings of variables and catch tags as were visible when the unwind-protect was entered" in 5.2.
16:28:34
Bike
...well, i guess that kind of contradicts the intervening points invalidated thing, doesn't it
16:29:10
beach
I am wondering whether this is the exact example shown in the THROW dictionary entry.
16:30:51
Bike
No in that case the initial throw is to the same catch that the second throw ends up in - invalidation isn't relevant. i think.
16:34:08
Bike
i still don't really get the point of the "intervening exit points are invalidated" thing. the committee issue makes it seem like the point was to make it easier for implementations but that doesn't seem to actually be true
16:48:39
beach
Bike: I think that it will be harder for some implementations with their chosen strategy. But then, they let the implementation choose by making it undefined behavior.
17:11:25
proto
I can't figure out what makes functional programming better or even worth to use, rather than imperative programming. Functional programming restricts and establishes some guarantees, but this could easily be established with imperative programming languages as well.
17:13:05
dlowe
it's functional in that functions are first class objects, but it has iteration and global variables and stuff
17:16:22
edgar-rft
because in Common Lisp you can *combine* imperative, functional, OOP. whatever style in *one* program
17:17:20
dlowe
You can, but the fact that you might screw it up means that your cognitive load is not reduced so much
17:17:29
shka_
but oh my god, writing large systems this way is impractical and i don't think i know anyone that does that
17:19:37
shka_
proto: try passing void* as explicit closure every time and you will quickly loose your mind
17:20:23
shka_
also, you can't just (lambda (x) (+ x y)), you will have to define function elsewhere, and then the state, and then initialize the state…
17:22:51
proto
shka_: give me the simplest example of a closure, and why they are far superior to a simple struct with methods.
17:26:27
proto
No. I don't that at all. I am just applying doubt to obtain certainty and understanding.
20:23:34
jmercouris
the advantage of a closure? honestly, I find it really rarely comes up in my workflows
20:23:51
jmercouris
that could just be a product of how I think though, maybe others find themselves using them much more frequently
20:25:04
jmercouris
there are those contrived usages that I see occassionally to illustrate how clever they are, but I don't find them applicable oft