freenode/#sicl - IRC Chatlog
Search
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
16:07:11
Bike
and i think the reason for that is that the chain of exceptions is stored in the __cxa_exception object instead of the non-language-specific object
16:08:46
Bike
and the other problem is this wouldn't actually improve performacne because exceptions would stillb e slow. right. can't forget that
16:11:00
Bike
shinmera's idea of only using C++ exceptions if there are actually relevant C++ frames would probably be best for performance
16:31:28
phoe
the current exception handling proposal should not really be modified because it needs to get delivered for C++ people
16:32:03
phoe
my proposal is mostly orthogonal to exception handling because it mentions non-local control flow, and therefore it should be processed as a separate wasm proposal
16:32:38
phoe
I'll edit my post to take this into account, run it by this person and by Ioanna, and then think of how to go forth with it
18:53:24
phoe
it would be even better to have a full blown CL in WASM compiling into more WASM and capable of loading it
21:09:46
mseddon
phoe: that's great news! if there's any way I can help support this proposal, let me know!
21:12:48
mseddon
to be fair I am actually quite out of the loop on the status of the current exception handling proposal. I should probably swing by and see how that looks...
23:03:32
Bike
ecl can compile lisp to C and doesn't use C++ exceptions, right? sounds like a good choice
23:10:46
phoe
funny thing: a proper control flow proposal will be required to correctly handle C's longjmp