News for hackers. Stuff that matters.
Re:Lisp in Space by lisper on Tuesday May 03, 2022 @02:27PM (#31251719)
I've never tried Smalltalk so I can't really speak to that. But I have done some coding in ObjectiveC which is a direct descendant so I can tell you that I strongly prefer Lisp, and Common Lisp specifically because I prefer generic functions to message-passing. Message passing privileges the receiver object and thus introduces an asymmetry which is totally unnecessary. It does nothing but cause confusion. The whole point of having a high-level language is to reduce the cognitive load on the programmer, and message passing does the exact opposite. Message passing forces me to think, every single time I call a function, about whether to write a.f(b, c, ...) or f(a, b, c, ...) or that absolutely horrific syntax that ObjC has, [f a:b] or something like that. There is no reason why I should have to think about any of that. That's the compiler's job. All function calls should use the same syntax -- and that syntax should be (f a b c ...) because all those commas are unnecessary too.
Re:Lisp in Space by xkriva11 on Tuesday May 03, 2022 @03:02PM (#31252146)
...or a b c f because all the parentheses are unnecessary too (Forth nudge ;-) )

I think that Smalltalk deserves a little bit of opened mind here. In many respects, it is the closest thing to Lisp machines experience you can get today.

Re:Lisp in Space by lisper on Tuesday May 03, 2022 @03:29PM (#31252448)
> all the parentheses are unnecessary too

That's not quite true. In Forth it is impossible to tell syntactically where the function calls are.

> it is the closest thing to Lisp machines experience you can get today.

I think Clozure Common Lisp running on a Mac (i.e. with the IDE) is pretty close as well.

But I don't begrudge anyone their Smalltalk. It's just not a good impedance match to my brain.

Re:Lisp in Space by AnimalMuppet on Tuesday May 03, 2022 @05:47PM (#31254032)
> It's just not a good impedance match to my brain.

I think that's the answer to every language war ever. "To my brain." If you claim "X is easier to understand", you get a war. But if you claim "for my brain, X is easier to understand", that's a lot harder to have a war about. All someone can reply is "well, my brain is different", which... OK, your brain is different. Fine. (Or someone could claim that nobody could actually have a brain such that X is easy to understand, at which point it's pretty clear who the unreasonable zealot is.)

In fact, I think this is also the answer to the editor wars. It may even be the answer to the political wars.

Re:Lisp in Space by lisper on Tuesday May 03, 2022 @06:30PM (#31254422)
Well, not quite. Some languages are by design good impedance matches to brains that don't know very much. BASIC is the canonical example. It's really easy to learn, which makes it attractive to beginners, but it has some pretty serious limitations that you only become aware of after discharging a certain amount of ignorance. IMHO this makes BASIC objectively worse than other languages.

To me, Lisp makes every other language I know feel like BASIC in the sense that the distinguishing features of the language feel to me like they are designed to appeal to ignorance rather than to empower.

Re:Lisp in Space by dwohnitmok on Tuesday May 03, 2022 @07:42PM (#31255046)
> IMHO this makes BASIC objectively worse than other languages.

"IMHO" and "objectively" are in fairly stark opposition.

Re:Lisp in Space by lisper on Tuesday May 03, 2022 @07:54PM (#31255157)
Not really. All quality metrics are subjective. But if you accept a particular quality metric, then you can objectively assess things against it. For example, C is objectively better than Brainfuck if your goal is to write software easily. If your goal is something else, like challenging yourself to overcome adversity, then Brainfuck might be objectively better than C.
Re:Lisp in Space by dwohnitmok on Tuesday May 03, 2022 @11:30PM (#31256436)
> But if you accept a particular quality metric, then you can objectively assess things against it.

I agree, but the scope of your assessments will be very limited, and also you end up writing tautologies (if your objective quality metric is A, then you've redefined "better" to mean exactly A). In particular, the scope of your assessments will be far more limited than the example you give (words such as "easy," "simple," etc. are unlikely to enter the statement without some rigorous definition, but therefore also highly restrictive, underlying it).

> For example, C is objectively better than Brainfuck if your goal is to write software easily.

I would not take a bet, that if you presented Brainfuck and C to all > 7 billion living humans, there would not be at least one person who found it easier to write software in Brainfuck than in C. Certainly I could imagine a hypothetical human for which it would not be true.

Re:Lisp in Space by samatman on Tuesday May 03, 2022 @06:02PM (#31254192)
> In Forth it is impossible to tell syntactically where the function calls are.

To be fair, this is true of Common Lisp as well, macros aren't functions.

Forth doesn't really have functions, it has words, they're broadly useful like functions but are a differently-literal sort of memory object from a lisp function defined with cons cells.

So you can't know where the function calls are, there is no such animal, but you do know where the word boundaries are, it's the whitespace, and in Forth that's what you care about.

Re:Lisp in Space by lisper on Tuesday May 03, 2022 @06:22PM (#31254359)
> macros aren't functions

That's true, and it is arguable that Lisp could be improved by making macro invocations have a distinguished syntax.

But in practice it's usually pretty clear what is a macro and what is a function because of naming conventions, and because macros commonly admit syntax that would be illegal in a function call e.g. (let ((x 1)) ...) But however bad this problem is in Lisp, it's much worse in Forth.

> Forth doesn't really have functions

That is debatable. If I write 1 2 + 3 * then I think of the + and the * as function invocations that take their arguments off the stack and leave their results on the stack. It's true that this is not exactly the same as a function call in Lisp, but it's similar. In any case, if I write:

a b c d e f g h i j

there is absolutely no way to tell what that is going to do without knowing what every letter means. By way of contrast, if I write:

(a (b c d) (e f) (g h (i j)))

then it's a pretty good bet that a is a function that takes three arguments, b and g are functions that takes two arguments, e and i are functions that take one argument, and c d f h and j are variables.

Re:Lisp in Space by zozbot234 on Tuesday May 03, 2022 @06:59PM (#31254689)
What you don't get in FORTH is arity information from the syntax, because everything is simply treated as a function from stack to stack. Unfortunately it's not feasible to keep the cleanliness of the FORTH syntax while providing that info (one would need a 2D view for that, where multiple arguments to the same function can be seen in parallel) so a parens-based syntax is arguably the next best choice.
Re:Lisp in Space by samatman on Tuesday May 03, 2022 @09:15PM (#31255691)
The other thing you can't do (straightforwardly at least) is push a word onto a stack or apply it against some kind of compound structure.

That's what I mean by Forth words not really being functions, they're subroutines for sure, and you can do some surprisingly powerful metaprogramming given that what you have is a glorified linked list, something a little more powerful than GOSUB, and two stacks, but functions?

When you compare it with a visually similar concatenative language like Factor or Joy, which inarguably have functions, Forth words look pretty different.

Re:Lisp in Space by veltas on Wednesday May 04, 2022 @04:20AM (#31257994)

  a b c d e f g h i j
and

  (a (b c d) (e f) (g h (i j)))
are about as meaningless as each other to me with just letters, in Forth you build a sort of minimal vocabulary for the problem at hand and so you have a better idea of what words are doing. Proper documentation (or at least very good naming) is needed in lisp and forth IMHO.
Re:Lisp in Space by lisper on Wednesday May 04, 2022 @11:58AM (#31262253)
Of course you actually have to know what the words mean. But it's harder in Forth than in Lisp or conventional C-like languages because Forth takes away all of the visual cues that help you figure out what is going on.
Re:Lisp in Space by trenchgun on Wednesday May 04, 2022 @12:41AM (#31256834)
> That's true, and it is arguable that Lisp could be improved by making macro invocations have a distinguished syntax.

Agreed.

Re:Lisp in Space by ralphc on Tuesday May 03, 2022 @10:48PM (#31256198)
You must have run Clozure a while back, I went to the App Store and the version of CCL there hasn't run properly since Sierra, according to reviews. I myself can't run it on Mojave or Catalina.
Re:Lisp in Space by lisper on Tuesday May 03, 2022 @11:16PM (#31256362)
Yes, the app store version hasn't been updated in a long time but if you build from source it will run on Catalina. Maybe later too, I haven't tried it.
Re:Lisp in Space by d-mason on Tuesday May 03, 2022 @05:01PM (#31253534)
I would say the same thing (or more exactly, the dual) from a Smalltalk perspective: I just want to send a message to an object, I shouldn't have to figure out what function to call or what to parenthesize. The problem people get into with OO (particularly Java, C#, C++) is thinking in terms of method-function calls rather than message sends.

Although I do like Lisp generics - I did a bunch of programming in rscheme many years ago, and really liked it.

Re:Lisp in Space by lisper on Tuesday May 03, 2022 @05:54PM (#31254107)
> I just want to send a message to an object

Why? Seriously, why is that something you want? Why do you want sending a message to be syntactically and semantically distinct from calling a function?

> The problem people get into with OO (particularly Java, C#, C++) is thinking in terms of method-function calls rather than message sends.

Well, IMHO the problem people get into with OO is thinking that there is something special about sending a message that is different from calling a function. Sending a message is an implementation technique, not a semantically distinct action that should be exposed in the language semantics, and certainly not in the syntax.

Re:Lisp in Space by abecedarius on Tuesday May 03, 2022 @09:52PM (#31255916)
Where it matters 'who' gets what powers or responsibilities, sending messages is a powerful way to think about it, not an implementation detail.

In Java it is pretty much just a function call, because the code in the callee has the ability to wreak all kinds of havoc in real Java programs, so the pattern of "messages" is quite imperfectly related to the authorities you're bounding.

More at http://habitatchronicles.com/2017/05/what-are-capabilities/

Re:Lisp in Space by pjmlp on Wednesday May 04, 2022 @03:45AM (#31257812)
It would be if virtual method tables weren't a thing, and Java didn't do dynamic dispatch by default.

Then there are Proxy objects, reflection, and invokedynamic as well, for those "doesNotUnderstand:" scenarios.

Re:Lisp in Space by xkriva11 on Wednesday May 04, 2022 @04:26AM (#31258033)
In most cases, it is really only an implementation technique, but it may be different. In my eyes, sending a message to a probe on Mars is very different from evaluating a function with the probe as an argument. It's sure that, in this case, a Lisp program would transform the function call to a kind of message send anyway with the expectation that the probe is a standalone computation system. OOP approach makes this assumption implicit for everything.
Re:Lisp in Space by lisper on Wednesday May 04, 2022 @11:35AM (#31261949)
> sending a message to a probe on Mars is very different from evaluating a function with the probe as an argument

Sure. But why do you want that difference to manifest itself in the syntax of your language? What is the benefit of writing, say:

[probe message]

over

send_message(probe, message)

?

> OOP approach makes this assumption implicit for everything.

And that is exactly the problem IMHO because this model is not appropriate for everything. It makes sense when you are dealing with actual physical objects like a Mars probe, but that is rare. Much more commonly you are dealing with abstract objects. If I want to add two numbers A and B, who do I send the message to? A? B? The adder in the ALU? As a programmer, 99.9% of the time I don't care how the operation gets carried out. I just want to write (sum a b) or a+b and let the compiler sort out the details.

Re:Lisp in Space by xkriva11 on Wednesday May 04, 2022 @01:49PM (#31263635)
In Smalltalk, it is just

probe message

without any brackets, and you can write

a+b

which is the message + send to a with argument b. You just have message passing syntax for everything (Smalltalk has minimal syntax comparable to Common Lisp in size). IMHO it hit the sweet spot of simplicity/readability/expressiveness.

But you cannot judge Smalltalk only from the perspective of its syntax. You need to take into account the context in which it is used. The environment built around it. Then everything starts to make much more sense and forms a vital well balanced system. It is Lisp but different, and I strongly recommend downloading Pharo and to try to figure out how.

I stronlgy admire you; I read "Lisping at JPL" at least dozen times over the years. I really like Lisp, Forth and Smalltalk, and I know that knowing each of them well is worth every penny, even if it may not be obvious on first sight.

Re:Lisp in Space by lisper on Wednesday May 04, 2022 @02:00PM (#31263775)
> which is the message + send to a with argument b

Yeah, I get that. What I don't get is why I should care that "a+b" means "send the message + to a with argument b" rather than just "add a and b". I see no benefit of the first formulation over the second.

(And thanks for the kind words!)

Re:Lisp in Space by ncmncm on Tuesday May 03, 2022 @08:22PM (#31255388)
Message passing within a process and function calls are exactly, precisely isomorphic, so complaining about one or the other is just parochialism.
Re:Lisp in Space by pjmlp on Wednesday May 04, 2022 @03:51AM (#31257834)
Smalltalk and Common Lisp are on my favourite languages list.

Yet I never got the point of arguing about implementation details regarding virtual method dispatch versus message passing.

Specially when many OOP GUI frameworks combine both approaches.

Re:Lisp in Space by ncmncm on Wednesday May 04, 2022 @10:32AM (#31260999)
It's not even an implementation detail. Both use, ultimately, JSR and RET instructions.

It really comes down to fetishism, which is why I don't use either of them. I am not a Fetish-Oriented Programming enthusiast.

It is also why I am not all in on Rust. Memory safety is pretty important, but it is far from the only important thing in programming. The amount of attention Rust insists I devote to it is attention I don't have available for the other things that, frankly, deserve it more.

Considering that in the last 10 years I have spent strictly less time debugging memory usage errors than preparing compiler bug reports against Gcc, putting memory correctness guarantees front and center ahead of all else seems to me a mis-allocation of my extremely scarce attention.

Attention is by far the scarcest resource available to any programmer. Allocating and applying attention where it is most needed is the central problem of programming. A language that overrules your judgment as to where your attention must be thus interferes with the core business of programming.

C++ does demand just a little more attention to memory management than some other languages, but less all the time. It pays that back by eliminating most taxes on performance, a swap I agree to.

Re:Lisp in Space by leobg on Tuesday May 03, 2022 @02:42PM (#31251901)
Makes sense. Thank you!
Re:Lisp in Space by lisper on Tuesday May 03, 2022 @03:29PM (#31252449)
You bet.