6

Thoughts On Lisp And Racket

 3 years ago
source link: https://www.macadie.net/2019/08/11/thoughts-on-lisp-and-racket/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Thoughts On Lisp And Racket – MacAdie Web BlogSkip to content

I plan on writing about why I am interested in the Lisp family of languages. It will probably come out in stages.

But first, I will write about some recent events. (This is a bit all over the place.)

A few weeks ago there was a lot of traffic on the Racket Users mailing list about a proposal by Racket core developer Matthew Flatt called “Racket2“. They are thinking about changes, with one goal to increase the user base.

One proposal was to change the syntax and move away from s-expressions. The current syntax would be “#lang racket”, and the new syntax would be “#lang racket2” (or whatever it winds up being called). This has caused a lot of debate.

Some people (including myself) came to Racket because it is part of the Lisp family. And s-expressions are part of that. I have met a lot of people who said that they could do things with Lisp 20, 30 years ago that languages either cannot do today, or could only do recently. Many languages are influenced by Lisp, yet Lisp does not feel the need to be influenced by anybody else. (An exception might be OOP, one of the few ideas that did not start in the Lisp family, and is very easy to implement in Lisp.)

I grew up near Chicago, and the population kept expanding westward. People would complain that their suburb was too crowded, so they would pave over more farmland, and expand the next suburb, and ten years later this would repeat. I always thought that maybe we should learn to design cities and towns better so we don’t cut into our food supply and stop making the same mistakes over and over again. Eventually we will run out of land. Or people will be commuting from the Quad Cities.

I remember when the hot thing was to do Java/Spring/Hibernate. Then Rails came along, and a lot of Java people went to Rails because they could build apps faster. And then they got tired of the magic and the monolith and the lack of multi-threading and now a lot are going to Elixir. Granted, not all Rails people came from Java, and not all of them are going to Elixir, but there are a lot of them who took the Java-Rails-Elixir path. In other words, there are a lot of people who dumped unmanageable apps on other people for the new cool, hip language twice in the span of a decade.[Note 1]

And then there is the JavaScript community. Constantly churning out new frameworks and libraries and entire languages that transpile to JavaScript so they do not have to deal with JavaScript directly. And the whole time Lisp people have been in their corner just doing their thing.

There is a lot of churning in IT/CS, but not a lot of learning. It looks to me like the Lisp community knows something the rest of the world does not. They are not searching for the next hot thing. They seem to understand things on a deeper level than other communities. Perhaps “enlightenment” is not an overwrought term to use.

No other language has people claiming what the Lisp people claim. Many langs claim to be influenced by Lisp, or try to do things that Lisp can do, or do things that started in Lisp (which is just about everything but OOP). But the Lisp crowd doesn’t see a need to be like other languages. It’s like fat people want to date fit people, but fit people do not want to date fat people.

Norvig asks if Lisp is still unique. More languages have features that at some point only existed in Lisp. (Paul Graham also lists some Lisp features.) I get the impression that Norvig thinks that the world does not need Lisp anymore. Perhaps a better interpretation is that a lot of time and energy has gone into re-inventing the wheel.

Granted, maybe this was inevitable. C and UNIX were given away for free, and for a time Lisp was only available on specialized and more expensive hardware.

But if languages are becoming more and more like Lisp, maybe we should just cut to the chase and use some variant of Lisp.

I am one of those people who came to Racket because it is a Lisp. I feel that I should be better at creating/using software and general problem solving than I am, and I guess you could say I am looking for the fabled Lisp enlightenment. Maybe saying Lisp is the language of the gods is overwrought, but nobody ever said that JavaScript made them smarter, or that they learned a lot using anything by Microsoft.

It seems like everybody wants the capabilities that s-expressions give them, without actually using s-expressions. It has been tried, and nobody has been able to get it to work. Even if you could, why bother? Why go through the effort to invent a language that can do the things that Lisp can do? I think it would be easier to just learn to program with s-expressions (which frankly are not as hard as some people seem to think). A lot of the suggested alternatives usually end up looking like Python. If you want to use Python, then go use Python.

There was one person on the Racket users mailing list who wrote that parentheses make his head hurt. He also wrote that he found arguments from “parenthistas” to be condescending. And he is a PhD student in CompSci. Frankly, if you are a PhD student in CS and you do not grasp parentheses, then you deserve condescension. I am not claiming to be the foremost Lisp expert, and I am sure you can find Lisp code that makes my head hurt. But you can find impenetrable code in any language. But in all seriousness, s-expressions just do not seem as hard as some people make them out to be.

In “The Evolution of Lisp“, written around 1993, Richard Gabriel and Guy Steele predicted this would happen: People would suggest alternative syntaxes to Lisp, and the suggestions would be rejected. There have been a couple of SFRIs for this in Scheme. They never seem to go anywhere. From Gabriel and Steele:
On the other hand, precisely because Lisp makes it easy to play with program representations, it is always easy for the novice to experiment with alternative notations. Therefore we expect future generations of Lisp programmers to continue to reinvent Algol-style syntax for Lisp, over and over and over again, and we are equally confident that they will continue, after an initial period of infatuation, to reject it. (Perhaps this process should be regarded as a rite of passage for Lisp hackers.)

I think it should be regarded as an IQ test. People have done this, and it has never caught on. Why will it be different this time? Also: What if the people who are in Racket for the Lispiness leave and you do NOT gain new users?

Back to Racket: What do I think Racket should do to increase its user base?

1. Do something about Dr Racket.
I use racket-mode with emacs, which may not be the most beginner-friendly way to use Racket. But DrRacket looks kind of cartoonish in a way. It’s clean, I’ll grant that. Maybe I am the only person who does not like it. Maybe I expect an IDE to look more like IntelliJ, or Eclipse, or Visual Studio.

2. Focus more on libraries, frameworks, and applications. I read the Racket Manifesto, and I know that it is intended to be “a programming language for creating new programming languages”. But it also claims to have “batteries included”. Which is it?

I know some say language oriented programming is Racket’s strong suit. But to some people, it can make Racket look more cumbersome and less powerful. It is a nice thing to have when you need it, but do you always need it? Why can’t Racket solve problems out of the box? If it is powerful enough to create new languages, then you should be able to do something with plain old Racket.

In other languages, when you ask how to do something, many times you are pointed to a library or framework. In Racket, you might get told to “write a language.” People want to make applications, not languages.

I think the reason Rails was so successful was not just that it had a lot of magic, but that it was a nice default answer. Back then, the major languages for web programming were PHP, where you did have to do everything yourself, or Java, which had (and still has) a lot of frameworks. After Rails came along, if you asked how to make a web application in Ruby, the answer was: Try Rails. It wasn’t the only option, but it was a nice default. I think the Racket community should focus on building libraries, frameworks, and applications that people can use in Racket.

3. Related to the above comment: Does Racket want to be a teaching language? Or a language used by professional developers? Are these two goals possible at the same time?

4. I think being immutable by default is a good idea.

5. Can Racket do more with GPUs? I think these will become more important going forward.

[Note 1] Another thing that bugs me is that for a long time, Java developers said that Java was faster than Ruby, and criticized Ruby for not being able to execute multiple threads. Rails developers responded that the speed of the developer was more important than the speed of the runtime, and that WRT threads, they could just send stuff to a message broker. And unlike Java, Ruby had metaprogramming, which some derided as “magic”; Rails devs said they were just envious.

Now, lots of Rails devs are moving to Elixir because it’s fast, it can handle multiple threads, and a lot of the Rails magic was changing core Ruby classes which caused a lot of problems. In other words, Rails developers left Rails due to the criticisms that they all said were invalid a few years ago.

You’re welcome.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK