freenode/lisp - IRC Chatlog
Search
20:01:51
dbotton
I see it, just taking some getting used to. Is like wearing sandals after a life time of formal shoes
20:02:06
_death
what constitutes a "good reason" is something to be learned and is situation-specific
20:02:44
phoe
I guess that you could (deftype typed-function ...) and check the lambda list in a SATISFIES predicate internally
20:07:32
phoe
I just realized that TCLCS could be used as kind of a tutorial for building libraries in Common Lisp
20:08:02
phoe
if we can build a condition system from scratch then we could build other sorts of code from scratch too
20:08:34
phoe
dbotton: usually one doesn't program this defensively in CL because the feedback loop is tiny and one can test code as it is written in the REPL
20:09:19
phoe
if you DECLARE TYPE then SBCL treats it as an assertion and will warn you if it detects a type mismatch somewhere in your code
20:12:22
_death
dbotton: I am reminded of https://www.xach.com/naggum/articles/3103318695270771@naggum.no.html (and the subsequent messages in the thread)
20:13:55
dbotton
I see that, making the transition not so easy, but already pushing to always look from the perspective of the data no the container
20:14:45
phoe
it means that "you shouldn't do that" in Lisp is usually merely a suggestion, whereas in other languages "you shouldn't do that" could cause your code to not even compile
20:15:26
phoe
that is the case with e.g. modifying slots; there's no real "private" or "protected" modifiers like in Java or C++
20:15:37
Josh_2
if you want to make sure a function receives the expected type you can use the macro (check-type .. ) I use it quite a bit
20:18:03
dbotton
(I really wish had started with list 10 or 20 yrs ago... maybe though was not mature enough then to appreciate)
20:21:30
dbotton
getting beyond the idea of never placing programming logic in an exception already a shock
20:23:23
pve
I'm not sure the tooling was that bad even before 2010, I still remember being blown away by Marco Baringer's slime video in like 2006 or something
20:25:43
phoe
shka_: actually you can't do that portably because ERROR is not required to be a standard-class
20:28:03
aeth
shka_: it's so you can use the condition system internally even before you have standard classes
20:30:32
Bike
under the hood it doesn't work much like C++ or anything (ask me about clasp! or don't, this part of it sucks) so there's a lie-to-children aspect
20:30:57
dbotton
but outside of that seems like handler-bind has some usage not related to exceptions at all
20:32:27
dbotton
that is my point, no one is going to avoid it like the exception systems of every other language
20:32:36
phoe
SIGNAL is a way of saying "hey, if you have dynamically provided me any code that matches this symbol, I will run it for you"
20:34:01
phoe
but yes, if you want or need to reinvent the handler subsystem for any reason then it's easy to do so
20:34:56
shka_
i would rather call a generic function then play around with different ways of selecting restarts
20:38:08
dbotton
_death from that post "if you want the compiler to smack you in the face if you do it anyway, I'd say you have an attitude problem that needs readjustment" - I wonder what that says about me...
20:40:33
phoe
shka_: conditions are more or less extension points; they're equivalent to generic functions, especially with this approach that beach and scymtym have been using recently, e.g. inside eclector
20:40:58
phoe
where you have a client of sorts as an argument to each GF, and you can specialize on it to add your own functionality
20:41:13
phoe
and then you have a *client* dynavar that you can rebind to turn this functionality on or off
20:41:18
_death
dbotton: also check his next message in the thread (the one mentioning epistemological assumptions)
20:43:10
shka_
phoe: in theory yes, but in practice i find them usually worse option for the extension
20:44:21
phoe
if it's conditions, then to be honest, so do I - the GF approach is cleaner wherever you know what your code should do at a given moment
20:45:44
scymtym
i found the condition system uniquely suited to this: https://github.com/scymtym/more-conditions#tracking-and-reporting-progress-of-operations
20:48:19
shka_
overall, i think that condition system is pretty much specialized tool that can be pressed into service for other tasks
20:48:45
phoe
the condition system is handy when your code doesn't have full information about how it should act
20:48:57
scymtym
shka_: sure, but i didn't find the complications from threads problematic in practice. more like a cost paid once for being able to report progress of operations from anywhere in the code (and having the same code work fine if progress notification are not handled)
20:49:12
phoe
if you don't have really exceptional situations then standard control flow is enough in all cases, by definition
20:52:01
shka_
i just propose to skip the extra crust for things that are not exceptional situations
20:53:01
phoe
sure, the only real practical advantage there is that HANDLER-CASE and SIGNAL are already built-in so you don't need to define your own dynavar and use it
20:54:28
dbotton
is seems a bit more readable then a dynavar but that could be because I am not used to seeing it
20:56:03
dbotton
I think this shows the colossal failure of trying to translate c/ada/pascal etc -> lisp they are way to different
20:57:08
dbotton
I still keep adding notes to myself, but there is clearly reason no one has done a simple chart like between c <-> pascal etc
21:00:30
shka_
cl is actually not that difficult to learn, and the only major obstacle is that it is different
21:03:58
dbotton
I obviously am getting the basics, but mastery like all things takes time, and changing the pattern of software design is the more difficult part
21:05:17
dbotton
_death "I actually think C++ is ideal only for programmers without any ethics." ..... ugh....
21:07:06
dbotton
This has been one of those moments between those two posts and today to realize that I just flew to a foreign land and foreign customs and "patients grass hopper" said to me by some ancients many times
21:09:18
p_l
phoe: Scheme is literally, at its base, a language you're supposed to learn in one university lecture
3:59:42
beach
scymtym: I like the idea of using conditions for reporting progress. Never thought about that.
7:48:44
beach
phoe: It's your fault. Because of your message about the book, I now can't get the song by the Who "I'm free" out of my head.