by lisper · 1y ago · 0 comments
https://blog.rongarret.info/2023/01/lisping-at-jpl-revisited...
And, as always, AMA.
never has anything rang truer
HN is how I heard the story many years ago, and I posted it again because (a) It's my favourite story and (b) a discussion elsewhere in HN reminded me of it. So I had to.
Didn't expect it to bubble up on the front page... that says a lot about the enduring quality of your field experience. Thanks for publishing about it!
The typing available in CL, is it like Python type hints in that they don't affect the meaning of a program whatsoever?
https://coalton-lang.github.io/
IMHO this is the Right Answer: types when you want/need them, dynamism when you don't. It seems like a no-brainer to me. I've never understood why so many people think it has to be one or the other. It seems to me like arguing over whether the window on the bike shed should be on the left or the right. If there is disagreement over this, just put in two windows!
What it comes down to is a reconciliation between these two views: https://ncatlab.org/nlab/show/intrinsic+and+extrinsic+views+...
I think the "reliability" you mentioned is "type safety". And I think the dynamicism I sometimes miss in a language with static types is, in a bizarre way, the lack of runtime type errors. If you load a configuration file, necessarily at runtime, but the configuration file has the wrong format, an error should occur. What kind of error? In essence, a type error...
Reusing the type checking machinery at runtime is a benefit to some. At the same time, the possibility of type errors (type unsafety) is a threat to the reliability of programs.
I have trouble wrapping my head around it, but I ultimately want the bikeshed with both windows.
The author makes a number of unfounded claims, including:
> there is huge benefit in throwing away the prototype
This is at odds with:
https://en.wikipedia.org/wiki/Second-system_effect
And this is the problem, in response to which I hereby formulate Ron's Third Law (*): For any position regarding the proper design of a programming language there exists an authoritative-sounding aphorism to support it.
> good type inference ... good language design
This is begging the question. Of course* you want good type inference and good language design. Who in their right mind would advocate for bad type inference and bad language design? The problem is specifying what the word "good" means* here.
---
(*) Ron's first two laws are: 1) All extreme positions are wrong, and 2) The hardest part of getting what you want is figuring out what it is. (The difficulty of defining "good" is a corollary to this.)
And thanks for the "pass" tip for Python. I gave up using Python a few months ago, and ported all my Python scripts to C and ObjC because I just couldn't handle indentation bugs after every refactor. Never realised the solution could be this simple.
Was thinking about this point in the 2002 article.
As a Python user, I could imagine a lot of pain going into "try and compile my Python code" (notably downstream from hashing and operator overloading meaning that I might have to end up shipping the entire Python object model into my binary). But perhaps Common Lisp avoids a lot of that mess by being "just" functions?
(compile-bunny
'(setq x (+ (aref y i) x)))
and it looks just like normal code, but really you are just passing a data structure to the compile-bunny function. The direct equivalent in Python is awful: compile_bunny(['setq', 'x', ['+', ['aref', 'y', 'i'], 'x']])
but you can build up a pretty decent EDSL in Python for this sort of thing with operator overloading, similar to what Sympy does: x.set(y[i] + x).compile()
That looks a lot more like normal Python code, but getting it working is a bigger hassle than in more conventional Lisps where you can just quote whatever S-expression. (Of course, your compiler has to handle each type of expression sooner or later, so this isn't as big a deal as it might sound.)But neither one of these is compiling your Python code. Python's bytecode may give you a head start on that if you do want to do it.