Hacker News new | ask | show | jobs
by psykotic 2833 days ago
newLISP was the butt of half the jokes on #scheme over a decade ago. I'm surprised it had enough uptake to stick around. Uniquely for a Lisp, all objects are deep-copied by value when passed around. It also doesn't have closures. To get around these and other limitations, it has a notion of contexts that are auto-dereferenced ("default functor calls") so you can pass values by reference with syntactic sugar. At least that's how I remember it--not sure how much has changed. The way you emulate closures in newLISP is morally similar to how cl.el does it for Emacs (true lexical closures are a late addition to Emacs Lisp), namely by generating a completely new function for each closure instance, with the closed-over values in the environment hard-wired into it.

In my opinion, you can find much better versions of this sort of thing in Tcl, if for some reason you really want it.

Props to the author for keeping it going for this long, though.

3 comments

newLISP is a language to replace sh/bash/perl. I don't know of any other s-expression language targeting that space?

The thing is, if you look at what people on various programming language channels mock, bash et al should be the target of widespread derision. It does everything "wrong" and is an absolute mess. Yet all of these languages do a really good job of being super simple to use when you quickly need to automate something, even if the result is an unreadable, unmaintainable mess. It's ease of writing that is being optimized for, not reading/maintenance. But a big chunk of the code I actually write is in the category of write-once, use-once, never-read. (Reorganizing data on disk, doing a one-time data cleanup or reduction, renaming deeply nested files matching certain patterns, tabulating data, etc.)

newLISP, as far as I can tell, is an attempt to apply s-expressions to the same niche, and it makes the same sort of ugly, aesthetically horrifying compromises that shell languages (+ perl) do. But the only questions of import, I think, is: does it work? Is it quick to use? Is it simple, and not mentally taxing to automate something in newLISP?

If so, I'd much rather code in newLISP than write another hideous bash loop.

> all of these languages do a really good job of being super simple to use when you quickly need to automate something... It's ease of writing that is being optimized for, not reading/maintenance.

I think of shells as being optimised for/excellent at:

- Invoking subprocesses (managing buffers, propagating signals, handling exit codes, etc.)

- Standard input/output redirection (pipes, file reading/writing, etc.)

- Command line interaction

- Being installed by default (on Unix-like systems, anyway)

They also have some nifty string handling, but as you say it's quite messy compared to other languages. Some other languages have reasonable commandlines and are usually available by default (e.g. Python), but the majority of languages are awful at the first two points (e.g. I wrote an example at https://news.ycombinator.com/item?id=17733865 ). This is why there are many libraries which try to improve the situation, like 'sh.py' and 'plumbum' for Python, 'Shelly' and 'Turtle' for Haskell, Scala's 'process' package, 'shell-pipeline' for Racket, etc.

> I don't know of any other s-expression language targeting that space?

Others have mentioned some. I really like scsh (Scheme shell), there was a nice paper about it posted to HN recently ( https://news.ycombinator.com/item?id=17886714 ). The shell-pipeline package mentioned above is really nice, and usable from Racket (a variant of Scheme, which uses s-expressions by default).

> I don't know of any other s-expression language targeting that space?

TXR: http://www.nongnu.org/txr

scsh, CLISP, ...
Gauche Scheme ... even Chicken Scheme could be used for a lot of sysadmin tasks
Don't forget Guile. I managed entire web sites with Guile back in the day.
Someone just told me that newlisp was full of leaks and hacks. Maybe that's why it was mocked on #scheme.
>newLISP was the butt of half the jokes on #scheme over a decade ago. I'm surprised it had enough uptake to stick around

Because #scheme itself is so influential?