freenode/#sicl - IRC Chatlog
Search
8:37:41
splittist
I was struck by this line (from a book I haven't read) on a topic that is often touched on here: "We write ethically when, as a matter of principle, we would trade places with our intended readers and experience the consequences they do after they read our writing."
8:42:42
splittist
The consequences I am experiencing from reading code I wrote 12+ months ago are alternating feelings of "I was so smart back then" and "How could I have been so dumb"...
9:25:44
heisig
Its snowing outside, and several people at my work have chosen Common Lisp for solving this year's adventofcode programming challenge.
9:26:41
beach
Oh, that's great news, about Common Lisp, that is. Not so much about the snow. I had my dose the first 28 years of my life.
9:30:25
beach
A bit there, but especially in Västerås where I lived the last 3 years of my time in Sweden.
9:43:35
phoe
mostly because they have a proposal introducing exception handling into WebAssembly that maps in like 10% to how Common Lisp does non-local control flow
9:44:37
phoe
so I will need to play the unfortunate role of an ultimate newcomer whose first real contribution is "uhh guys I think you're doing it wrong"
9:47:21
heisig
Sounds good. But you should try not to annoy people, but to engage in a constructive discussion. So maybe no actual flipping of the table :)
9:47:38
scymtym
make sure to change your avatar to https://catonmat.net/blog/wp-content/uploads/2008/12/john-mccarthy-programming-wrong.jpg
9:48:14
phoe
I hope that in that block of text I make some constructive points that are not too hostile
9:48:33
frodef
Seems to me exception handling is a crucial element of software systems, and where CL excels.
9:49:19
beach
frodef: The point that phoe is making is that all that can be implemented with the right control-flow primitives.
9:49:57
frodef
beach: of course, it's not magic, anything can be implemented with the right primitives :)
9:50:33
beach
OK, so the point is that it is way better to have a few simple primitives (as Common Lisp does) than a complicated mechanism that can not be used for anything else.
9:50:46
frodef
phoe: not entirely sure I know "the C++/Java/Python sense" enough to understand your point exactly.
9:52:55
beach
We are still using Unix-like operating systems, despite the fact that we knew how to do it better 50 years ago.
9:52:59
frodef
just a few days ago I installed eclipse and tried some java. Right away I got the boilerplate try .. finally stuff to deal with statically checked exception handling. It's so sad.
9:53:48
beach
We are still programming as if we have access to the bare machine, with all the problems that implies, like silly linker technology, silly shared libraries, security problems, etc.
9:56:38
frodef
right, where a "process" pretty much simulates a bare machine, because that was what you needed to share resources in the 70s.
10:00:12
beach
phoe: I hope you succeed. If so, that would be some major progress, not just for Common Lisp, but for other languages as well.
10:01:31
beach
phoe: Speaking of which, the problems that Clasp face by using C++ exceptions as the mechanism for unwinding the stack are significant.
10:02:04
heisig
phoe: I also hope you succeed. You should emphasize that plain THROW has almost zero potential for being improved upon in the future.
10:03:12
phoe
heisig: could someone from the Clasp team support me with that? Like, make a writeup of these issues that I can then refer to?
10:08:49
splittist
phoe: this sentence seems to be missing some words towards the end: "Various programming languages implement the above semantics in varying ways and not all of them."
10:15:43
beach
It is the fact that, in order to implement Common Lisp unwinding, the only mechanism in LLVM is C++ exceptions.
10:16:19
beach
It sounds like the problem is that C++ does unwinds and that they need to handle those in Common Lisp.
10:21:20
beach
And now there is a "that" missing or you need to start the phrase with something other than "faces".
10:24:37
beach
English is better written with short-ish sentences. My French colleagues use the French style of long phrases when they write in English, and it quickly becomes incomprehensible.
10:37:46
phoe
thanks for the review, I'll take this further on my own now - submit this for an informal mail review, add Clasp content, and then post the public proposal
15:30:58
drmeister
We did get around a lot of problems with C++ unwinding - mostly by avoiding it as much as possible. Bike can give you more details.
15:32:20
drmeister
I would applaud you and if you want us to come in and provide some more voices we could.
15:33:10
phoe
it appears that the wasm exception handling proposal has been stirring for a few years and the first PoCs of it are already implemented
15:33:11
drmeister
Bike has put a lot of thought into the unwinding needs of Common Lisp. The WebAssembly people are probably going to do something that looks like throw/catch without guidance.
15:33:38
phoe
the other thing is that this implementation seems to miss the point because CL needs control flow, not exception handling
15:34:32
phoe
not public just yet - Ioanna mentioned that there are some private builds of SpiderMonkey with this kind of exception handling implemented in the WASM engine
15:34:48
Bike
i'm sorry i don't have a coherent replacement idea in mind. what i did for the cleavir IR may be too far for wasm people
15:35:45
drmeister
We are able to work with C++ exception handling in clasp - but we have gone to a lot of work to use it only in the most exceptional cases. Mostly because it's implemented really poorly - it's extremely expensive to throw exceptions, especially in multithreaded code for really stupid reasons.
15:45:46
drmeister
Bike: Would it be possible to implement a more general mechanism that might not be perfect but would be more useful than C++ exception handling?
15:46:29
Bike
what i've realized is that part of the reason the high-level mechanisms with C++ types and shit are used is because the compiler actually needs to know that stuff to generate exception tables
15:47:03
Bike
a "good" mechanism might involve some complex system for generating "language specific data areas" and stuff, which itanium nominally supports
15:48:42
Bike
the use of terminate is C++ semantics. we would have to fix the C++ standard, which might be a little out of scope.
15:48:57
Bike
...it might be possible to generalize the itanium ABI a bit, but that's not much less difficult.
15:49:45
phoe
I'll allow myself to ask the most silly/daring question that I've asked in all of December
15:52:00
Bike
yeah. i mean, implementing C++ exceptions in terms of Lisp handler-case would mean try/catch blocks being compiled as binding *handler-clusters*, or whatnot
15:52:00
drmeister
Phoe - clasp has to interoperate with C++ - so we can use C++ libraries and have C++ function stack frames interleaved with Common lisp stack frames.
15:52:31
phoe
drmeister: yes; but as long as you compile these C++ files yourself then you're fine. the only issue is libraries that you don't compile yourself.
15:52:33
Bike
which obviously would entail somehow hijacking what the C++ compiler is doing, or else mandating that C++ authors use some custom BEGIN_HANDLER_CASE macro instead of try/catch
15:53:26
Bike
see the really annoying thing here for me is that the C++ Itanium exception system is SUPPOSED to allow interleaving C++ and other code and provide a general way to use exceptions between languages
15:54:34
Bike
anyway, yeah, if we put restrictions on how the C++ code we used is written and/or compiled we could do more stuff
15:55:23
Bike
well, ok. i mean that's a restriction in the sense of "you have to use our hacked compiler to build your code"
15:55:24
phoe
that is possible because the C++ frontend for LLVM is free software; the question is how feasible it is
15:55:52
Bike
i dunno, maybe. llvm is already set up to allow a few different ways of doing exceptions.
15:56:11
phoe
well then, provide yet another exception provider that utilizes handler-case semantics
15:56:51
drmeister
Yeah - they added Microsoft Windows exception handling - that was a very different beast. But that required an enormous amount of effort.
15:57:43
Bike
exceptions is... i think the llvm people haven't seriously considered how to go beyond C++ in this aspect
15:57:58
Bike
most other parts of the system work fine for our purposes. exceptions are basically crap
16:06:41
Bike
if i remember correctly the problem i hit was that foreign exceptions can't... nest? like you can't throw a non-C++ exception while handling one
16:06:48
Bike
"Nested foreign exceptions, or rethrowing a foreign exception, result in undefined behaviour. " yeah, that