spdegabrielle
2022-2-27 11:30:44

Racket gets a mention in https://news.ycombinator.com/item?id=30485604\|https://news.ycombinator.com/item?id=30485604

> Note that I already have that using Racket with a bunch of macros but in my business it is easier to introduce your own language than use Racket…


soegaard2
2022-2-27 12:01:53

> > tluyben2 2 hours ago | root | parent | next [–] > > Most people are allergic for lisp likes. Not sure why but it has since always been blocked. I even did a lispy but with <> instead 20 years ago and that was OK (it was the xml for everything hype) while with () it was rejected. I had a talk with the cto of one of our bigger infra structure partners and he had exactly the same issue, so he replaced the () with [] and suddenly it was fine. So he has had scheme in their products for over 10 years but with [] because people are allergic to ().


laurent.orseau
2022-2-27 12:56:11

Could this be related to people strongly expecting prefix () to be for grouping (by contrast to foo(…) ), and the resulting cognitive conflict is hard to resolve?


soegaard2
2022-2-27 12:59:12

It’s the best hypothesis I have heard.


massung
2022-2-27 13:13:06

I dunno.. I think the world generally rejected XML, too. HTML is still in use “just because” the idea of replacing it would be a monumental task. But I haven’t read about anyone who loves using XML for pretty much anything. Is it still used for stuff? Sure. But anyone who can uses any other format available to them.


laurent.orseau
2022-2-27 13:30:09

I’ve heard people say they love XML due to the tree structure and the generality you get out of it with little syntax. People who would only program in C and JS


massung
2022-2-27 13:30:25

I love lisp and its derivatives. I love Forth and its derivatives. And there will always be a place in my heart for Smalltalk.

Forth suffers the masses because anything more complicated than single-parameter threading can be insanely difficult to follow. Quite often Perl is more readable than Forth code.

Smalltalk suffers because - in general - OOP “lost” for two reasons: class hierarchies becoming unwieldy and difficult to manage long-term (is an Mech a subclass of Vehicle or Humanoid?) and due to memory storage it absolutely cannot compete WRT multi-threading and cache coherency.

Lisp - ignoring the whole “Lisp Curse” - suffers in two main areas (IMHO):

  1. Mathematical expressions are a pain to write and read. I don’t care what anyone says; they are unnatural. Same as Forth.
  2. Structure and variable assignment/mutation is also equally frustrating. Compare player.pos.x += dt * speed.x to… (set-vector-x! (object-pos player) (+ (vector-x (object-pos player)) (* dt (vector-x speed)))) It’s not the parenthesis, but the baggage that goes along with it. Give the world a Lisp with . notation (or equiv.) and a straight-forward way to write mathematical expressions, and I believe a world of people will find themselves giving it a go much easier.

sorawee
2022-2-27 13:34:25

. is great to have, and Racket can support it via read-cdot. Even with the default reader, the macro system can also kinda simulate it — see syntax-parse’s syntax class.


laurent.orseau
2022-2-27 13:35:13

As a concrete example for structs: https://github.com/Metaxal/bazaar/blob/master/struct.rkt#L153 (needs refinement but you get the point)


soegaard2
2022-2-27 13:45:14

In Sketching you can actually write:

#lang sketching (no-gui) (struct player (pos)) (define hero (player (vector 0 0))) (+= hero.pos.x 10) hero The result is: (player '#(10 0))


massung
2022-2-27 13:46:27

I know everyone means well, but the responses are indicative of the problem. “Use macros to solve the frustration” or “Lisp is powerful enough to modify the reader to do that” - while very true - are not programming 101 level stuff for any language.

Either the barrier of entry needs to be very low (it literally needs to be the default implementation) or the advantages need to massively outweigh the initial cost and suffering.


soegaard2
2022-2-27 13:47:47

Official support for dot notation and l-values in #lang racket would be nice.


soegaard2
2022-2-27 13:48:51

The tension is of course between dynamic/static resolution of id.field where Racket/Scheme usually defaults to a static view point.


sorawee
2022-2-27 13:49:03

I agree, and that’s why I think Rhombus is heading in the right direction, to support infix math operators and dot notation by default.


massung
2022-2-27 13:49:10

It’s akin the Linux community responding to trivial things like “how does a user modify their PATH environment variable?” with “Step 1. open a terminal, figure out which shell you’re running, then use vi to edit the dot file…”

Like WTF? :slightly_smiling_face:


massung
2022-2-27 13:49:59

> I think Rhombus is heading in the right direction… I haven’t looked at it much at all. I need to, I think.



soegaard2
2022-2-27 13:51:36

In the mean time:

#lang sketching (no-gui) (struct player (pos)) (define hero (player (vector 0 0))) (+= hero.pos.x 10) hero gives (player '#(10 0))


laurent.orseau
2022-2-27 13:53:30

oh nice!


sorawee
2022-2-27 13:54:29

That’s not Racket/Scheme’s vector, right? It means vector that has x and y instead?


laurent.orseau
2022-2-27 14:28:54

To be clearer, I do agree with your assessment in particular for dot and structs (although I have my reserves for infix math) and the fact that it’s not standard hence not well supported and obscured. (Also, I wasn’t really offering a drop-in solution by contrast to @soegaard2)

The nice thing with Racket though it’s that it’s still doable, by contrast to most other languages.

And I really wish a dot notation for structs was standard by default.


soegaard2
2022-2-27 14:56:44

It’s the standard vector. It’s not pretty - but if id has no associated “dot fields” then x, y and z is interpreted as 0, 1 and 2. So hero.pos.x becomes (#%ref hero.pos 0). Since hero.pos evaluates to a vector we get the first coordinate of hero.pos.

An effort has been made to make the lookup fast, but it’s of course slower than writing (vector-ref (player-pos hero) 0).


soegaard2
2022-2-27 14:58:42

The second reference to hero.pos.x ought to be faster than the first reference.


soegaard2
2022-2-27 14:59:12


soegaard2
2022-2-27 15:05:59

The last link shows fake “methods” for vectors: #lang sketching (no-gui) (define v (vector 11 12 13)) v.length (v.ref 1) The result is: 3 12


chansey97
2022-2-27 15:07:41

Sexp is not suitable for handwriting. Imagine that boss asks you to write pseudocode on a blackboard, and you have to count parentheses.


laurent.orseau
2022-2-27 15:12:12

What’s the problem with that? “imagine that you have to write pseudo code on the blackboard and you have to trace vertical lines to keep track of indentation” applies just as well to Python. Also my boss will want math, not pseudocode :smile:

But more importantly, I was trying to find a reason why people seemed okay with prefix notation using &lt;...&gt; or [...] but not using (...) as described in the posts above mine


chansey97
2022-2-27 15:18:53

I personally rather (...) than [...] or &lt;...&gt;.:wink:


sschwarzer
2022-2-27 16:55:33

@massung Which Forth derivatives do you love/like or would suggest having a look at?


massung
2022-2-27 16:59:13

I’ve used a lot of VFX and SwiftForth in production, but for hardware (not desktop apps). I like playing around with Factor at times.


sschwarzer
2022-2-27 17:16:58

Thanks! I remember having checked the websites for VFX and SwiftForth recently, but didn’t want to spend the money since I’m not even sure how much I’d use them. If you use these compilers in a commercial context, this makes much more sense. Factor is actually what I heard most about; I guess it’s the most well-known Forth-like language. I had looked at gforth, but as I understand it, the GPL would require that all software based on gforth that I publish would have to be GPLed, too.

Actually, most of the limitations wouldn’t be a problem for the start, but they might be if I decide to use a tool written in my free time in a commercial project.


sschwarzer
2022-2-27 17:25:41

One thing I noticed for me personally is that nested brackets of the same kind (like in ")))") seem to “blur” into each other, even if the font technically doesn’t use kerning. It’s worse with ">>>" (in most fonts), and better with "]]]", where there’s no visual overlap. Still, square brackets can be a bit annoying if there’s too little space between them.


sschwarzer
2022-2-27 17:27:56

I assume what people deters from brackets in Lisp aren’t their numbers, but that they can appear in big clusters, like in "))))))))".


sschwarzer
2022-2-27 17:49:19

> “imagine that you have to write pseudo code on the blackboard and you have to trace vertical lines to keep track of indentation” applies just as well to Python. In my experience, it’s much easier to keep track of the indentation in Python than of the brackets in Lisp. That said, if the indentation for Lisp conveys the structure well enough, there’s not such a strong need to get the brackets to balance on a blackboard or whiteboard. Then again, if the Lisp code on the board is part of a lecture on programming, the code should better be correct. :smile: