2,146 karma · joined April 30, 2018
https://rauhl.com/
https://gigamonkeys.com/book/beyond-exception-handling-condi... is a nice introduction; https://news.ycombinator.com/item?id=24867548 points to a great book about it. I believe that Smalltalk ended up using a similar system, too.
> It would need to be the case that code that doesn’t want to handle errors (like Max’s simple website) doesn’t have any error handling code, but it’s easy to add, and common patterns (e.g. “retry this inner operation N times, maybe with back off and jitter, and then fail this outer operation, either exiting the program or leaving unaffected parts running”) are easy to express
Lisp’s condition system can handle that! Here’s a dumb function which signals a continuable error when i ≤ 3:
(defun foo ()
(loop for i from 0
do (if (> i 3)
(return (format nil "good i: ~d" i))
(cerror "Keep going." "~d is too low" i))))
If one runs (foo) by hand then i starts at 0 and FOO signals an error; the debugger will include the option to continue, then i is 1 and FOO signals another error and one may choose to continue. That’s good for interactive use, but kind of a pain in a program. Fortunately, there are ways to retry, and to even ignore errors completely.If one wishes to retry up to six times, one can bind a handler which invokes the CONTINUE restart:
(let ((j 0))
(handler-bind ((error #'(lambda (c)
(declare (ignore c))
;; only retry six times
(unless (> (incf j) 6)
(invoke-restart 'continue)))))
(foo)))
If one wants to ignore errors, then (ignore-errors (foo)) will run and handle the error by returning two values: NIL and the first error.I just have my terminal emulator spin up tmux when it starts, and I start my terminal emulator from my desktop, so it always runs in a clean environment.
That conflicts with the standard Emacs binding to move to the beginning of the current line. Many years ago, I switched to C-z instead, on the theory that it is really easy to type C-z C-z when I really want to suspend whatever is currently running.
Pity that (AFAICT) terminals have no concept of Super and Hyper (USB doesn’t know about Hyper, either, but at least X11 does).
Oddly enough, I was recently thinking of using RFC 822 messages with CommonMark bodies and MIME attachments as a way to store blog entries on disk, so I was considering this exact problem earlier this week (small world!). RFC 2046 specifies multipart messages, RFC 2392 specifies URI schemes for linking from the body of the message to other parts; and RFC 7763 specifies the text/markdown MIME type. There’s already a ton of tooling out there which deals with MIME, so one needn’t reinvent the wheel.
Maybe it was this paper: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC10619792/
The authors’ statement that ‘unlike hallucinations, confabulations are not perceived experiences but instead mistaken reconstructions of information which are influenced by existing knowledge, experiences, expectations, and context’ is pretty compelling.
OTOH, I do think that now that it has shown the way, there is room for both improvement and replacement.
Mechanical watches. I came very close to getting into so-called ‘smart’ watches awhile back, but decided that would have been a pretty foolish waste of my money. Quartz would be more accurate, of course, but I like the sweeping hands and the clockwork.
No affiliation with it, just been happily reading and sharing it for years.
Like XML, Kubernetes does a lot of cool things which were not common before it came around (unlike XML, I think K8s actually manages to improve on the state of the art a bit, too). But just as XML was largely replaced by JSON, I am really excited to see what replaces Kubernetes.
I have a very custom desktop UI based on a tiling window manager (WM); I tend to run it with one or two windows per screen, so that I can focus. I have a suite of synchronised colour schemes between the WM, my editor, my browser (with custom styles for commonly-used sites), my terminal, my PDF reader and my screen locker, so I see one unified colour theme across everything I do on a computer (with separate themes for work and personal computers, so I instantly know what context I am in). I have as few distractions as possible from the work I am doing. I have a fairly consistent set of keybindings across my environment, with custom keybindings for custom work.
Since it’s written in Common Lisp, I can dynamically reprogram my WM as it runs. What I mean is that I can connect to it from my editor and open a REPL; I can define, replace and debug live code in the running instance. It’s not quite as powerful as a real Lisp machine would be, but it’s better than any other desktop environment I’m aware of.
My Compose key setup is much more powerful than macOS’s Option key. I have a pair of true Hyper keys dedicated specifically to my own cross-application tooling, unused by any specific program.
I believe that switching to macOS, Windows, GNOME, KDE or any other setup would be a step back, or at the very least require a significant investment of time and effort to begin to approach parity.
Then there is the issue of freedom. Just about every line of code I run is free software, which I may inspect, learn from, debug and change. It’s not there to make Apple more money.
Then there is the issue of privacy. Apple claim to care about privacy, but with free software I can actually examine code to see if it does anything I don’t want it to do, and I can hire someone to do that for me, or rely on others I trust who have done that. You can’t do that with proprietary software.
The developers of GNU/Linux and the other software are more aligned with my own interests, wants, needs and desires than the developers of macOS are. It’s not perfect alignment, of course (Mozilla is a good example where improvement really is needed, as are the systemd developers), but on the whole the free software community are reasonably well-aligned with me.
I care about privacy, freedom, customisation and productivity. When I use my system, it does what I want it to do and nothing (or at least very little …) else. It gets out of my way and enables me to be effective in my job and in my computer-based hobbies, and gets out of my way so that I have time for my non-computer-based hobbies and the rest of my life.
GNU/Linux and other free software afford me much more privacy, freedom, customisation and ultimately productivity than does macOS.
FWIW, I have a spare Windows laptop, just over a year old, whose WiFi does not recover upon waking from sleep about eleven times out of a dozen.
OTOH, I have had both Windows and Linux laptops which have gotten uncomfortably warm when ‘asleep.’ And right now I have a Linux laptop which very rarely hangs on sleep and turns into space heater, not even turning off the monitor but becoming completely unresponsive.
Sleep is apparently a lot trickier a feature than it looks.
No worries, it’s a great article and I’m glad folks are reading it!
That strikes me as an excellent idea: it’s a pretty small tool, but it is useful and has just enough complexity to test the language and its standard library. Note, however, that I have not done so myself!
I don’t know how many mechanical watches really will last a lifetime, but they will easily last longer than a so-called ‘smart’ watch.
Six years ago I seriously considered purchasing a ‘smart’ watch. Eventually I realised that they were just another money sink and attention leash, and put the money into a couple of automatic watches instead. I still have them, and wear them regularly. Had I bought an Apple or Android watch, I would have replaced it multiple times by now.
That’s the plus side. The minus side is that I don’t wear one of those two every single day because … I gotten bitten by the watch bug, and now I have a pile of other watches, and I wear those too! I still think that I am ahead of the game, though.
BTW, I write ‘smart’ watch because I don’t think they are really that smart; if anything, they should be called unwise watches, because they are an unwise expenditure of resources, money and attention. Also they just don’t look good. I predict that in thirty years we’ll look back on them much as we do digital watches: as a fad.
Heh, I did that when I was a kid. I was so proud of myself, right up until I learned how bad it was.
If only there were some way for the tech world at large to learn that sort of lesson.
Excel & Emacs: two things starting with E which let anybody program anything.
For a blog? I disagree, because the point of a blog is to read the author’s comments, not those of third parties.
> Comments are non-interactive text, there's no justifiable reason why I should need JS to read them.
I kinda agree. The issue is that it is very rare to find a static site generator which can interface with a dynamic comment storage. To be honest, I don’t know that one exists, although of course it is completely possible. I can understand as a pragmatic matter why someone might have a static blog, want to add comments and not be willing to run his own dynamic comment system, esp. if that would entail writing said system.
All that being written, it would be awesome to have a static site generator which were called by a hook in a dynamic comment server. I actually would like to write one someday!
I also evaluated Python and Lua. As others have noted, Python appears to be a right royal pain to embed. I actually had more experience with Lua prior to that project, but that experience leads me to believe that Lua is, generally, the wrong language.
Looking back on the project, I would not hesitate to do the same thing again, ideally as open source so that other Go projects can embed a scripting language. It got the job done, and did it well. Non-programmers on our team were able to write both configuration and logic successfully & productively, and apparently enjoyed the experience. Tcl itself ended up being a pleasure to use. While I personally would have enjoyed something like Embeddable Common Lisp, I think that would have been to much to ask of the rest of the team.
Interestingly, the four languages Lua, Python, Tcl and Lisp each can be said to take one idea and run with it. Lua is everything-is-a-hash-table (well, almost everything); Python is everything-is-an-object; Tcl is everything-is-a-string; and Lisp is everything-is-a-list (well, in theory: in practice it is really everything-is-an-object). I don’t know if this says anything deep about scripting languages, but it is at least interesting — right?
I propose that rather than ‘Web applications’ these be called ‘browser applications,’ because they are applications that run within the browser runtime. It is basically a coincidence (and a convenience) that they happen to rely on the same technology used for the Web.
What I don’t understand is why folks write browser applications for things that the Web platform already handles well. The Web is pretty cool! Not perfect, but then nothing is.
Looking back, it’s a remarkable delusion: mankind went from pictures to pictograms to text, not in the reverse. The career path everyone expected (mentioned elsethread: go from a junior guy-who-writes-lines to an architect guy-who-draws-pictures) doesn’t really make sense. If anything, while a high-level architectural document needs to have some diagrams, even more than that it needs to have text: text to describe the problem being solved, the context, the potential solutions and the reasons to choose one solution over the rest. Likewise, it’s striking how many PowerPoint slides could be effectively replaced with short point papers … but that’s a discussion for another time.
I am not 100% sure of why the industry had this wrong-headed idea, as I was too young at one point in time and too junior at another to really have good context. Maybe it was the rise of GUIs which led folks to think, ‘gosh, if pictures can enable folks to use a computer easily, then they will enable folks to program a computer easily!’ Or maybe it was the unfortunate habit non-experts have of not really understanding an expert’s field. As I recall, it also had a very strong correlation with the rise of OOP.
Sure, but one could still implement a Turin-incomplete language in S-expressions. It would be more readable and more succinct, too.
This strikes me as nice:
(parsing-matrix
(if (or (= (var "credentialData" "rapidSarsCov2PCRTest" "testResult") "negative")
(= (var "credentialData" "covid19Vaccination" "hasVaccination") "negative"))
"valid"
"invalid"))Probably. It has been nearly twenty years after all!
> I remember seeing stuff about CL21 a while back...
That was mostly one guy’s thoughts, and didn’t meet with universal approval.
Here are this guy’s thoughts:
- Retain case sensitivity. Remove case-folding. Use lower-case for all symbols in the common-lisp package. Basically, Allegro’s modern mode is the right mode.
- Improve, don’t eliminate, pathnames. Standardise their semantics for Unix and Unix-like systems. Bonus points to integrate URLs and pathnames, although … that way may lie madness.
- Expand the standard. In 1994 Common Lisp was derided for being a huge language, but compared to languages like Go or Python the library portion of the standard is pretty small. It is probably time to add some TCP & UDP primitives. It is time to settle on some concurrency primitives. And then there are the higher-level things 21st-century programmers take for granted: HTTP clients and servers, Base64, that sort of thing. Maybe specify them in separate optional packages for smaller environments?
- Consider CLOSing all the things. Caution: this could be a terrifically bad idea, but …
- Consider breaking backward compatibility and settling on one argument order to rule them all. (nth 1 list) and (elt list 1) is a wart. Switching to lower-case raises the possibility of retaining the entire COMMON-LISP package for backwards compatibility here …
I don’t think that HTML emails are really an improvement: full-fledged HTML engines bring in too many opportunities for exploits and privacy loss. They definitely add capability, but at too high a cost IMHO.
In general, I think that our industry would benefit from asking ‘can we?’ less and instead asking ‘ought we?’ more.
Have you considered emacs with notmuch and the Gnus renderer? It displays most HTML emails well, and when it doesn’t then a browser is just a quick ‘. b’ away. And of course there’s no need to integrate an external editor, because it’s integrated within the editor!
As a plus, it is simply amazing how quickly one can search local email.