Several innovations are documented in the README. Both the Prolog implementation and the type checker are written in / hosted by Scryer (Prolog implementation is done, the type checker is in progress). Scryer has many powerful constructs for monotonic reasoning which should help to take Shen's type checker in particular to new heights of power!
thank you! the scryer community deserves much of the credit too. everyone is welcome and encouraged to join us at https://github.com/mthom/scryer-prolog! some exciting plans in the pipe
Agree, freely available extensive documentation is a must. The link to Book of Shen is for UK. To find it elsewhere, search for the isbn, eg. https://www.amazon.com/s?k=1915012112
Edit: The book is available online, but is scanned in low res blurry format, very not readable.
I am not getting a good sense from the website of what is special or unique about Shen. The top line feature (above the actual list of features) is the presence of an "S series kernel" which as far as I can tell is Shen-specific. After that the top feature is pattern matching, which has become common in the mainstream languages lately (Java and Ruby come to mind)
A little further digging shows that this language is a Lisp. Great! I love lisps and functional programming, and I have a particular soft spot for Clojure. Are there any domains where this language would excel and CLJ would not?
Shen is a very unique language, and one of the ways in which it is unique is that so much of its marketing, information, etc is non-obvious, and less accessible than you might want.
I think the main thing that I find compelling about shen is its type system, especially its sequent calculus system (for defining types in a way that would not be possible for most languages).
The other thing about it that is compelling is how portable it is. the main language is implemented in a simple kernel language; someone who wanted to port the language to a new environment would need to implement a small (relatively) set of primitives, and then you can run the entire shen environment on top of it.
Its worth looking into, however I do caution that it has plenty of rough edges etc.
For me personally I think of it as an inspiration for programming languages I wish to develop someday. Additionally, if you ever worked in a certain environment and really dislike that the language is a bit weak, shen might be something you could port to that language and use. For example, I recently updated https://github.com/deech/shen-elisp so that some of its rough edges were a bit smoothed down and should be more usable; I haven't actually written any shen yet that runs in emacs. That's still a ways away.
> I think the main thing that I find compelling about shen is its type system, especially its sequent calculus system (for defining types in a way that would not be possible for most languages).
That sounds interesting. Can you give an example of a type defined this way that would not be possible in most languages?
One quick example is that the language allows for (nearly) arbitrary computation in the definitions of types, i.e. defining an enumeration/sum type of the employees of a company as:
{datatype Employee
if (element? emp read-file “employee_list.txt”)
______________________
emp : Employee
}
where the enumeration type contains a case for each employee listed in the text file.
The concept is similar to algebraic datatypes where user defined types are created from sum and product types in combination. However, in Shen the Sequent Calculus based datatypes are definable and constructable using any well formed sequent. Then add on the computational content of the sequent clauses to that and you get a system that is wildly expressive.
Why cursed? Why a neat CSV file can't serve as a part of the source three, while a much more cursed pass with `cpp` to handle `#include`, `#ifdef` and such is seen as okay, even e.g. in the Haskell community?
Well, first off, I don't think those things in haskell are good, really. They are/were necessary because of various _other_ issues, but they are not "good" features. And e.g. template haskell doing arbitrary IO at compile time is famously a cause of a variety of unintended problems (e.g. can't cache correctly if you never know what things a TH-module depends upon, very hard to cross compile if you can't be sure the arbitarary TH logic isn't depending upon the compilation host architecture to make some decision for compilation target, etc)
Specifically though for Shen, what causes me pause is how frequently this kind of "call an arbitrary term-level function in the type system" is done; it is quite frequent, and thus all my mental alarm bells sound. Debugging issues that arise in things like this can be quite challenging.
Sharp/dangerous tools are often necessary, but what I find unfortunate is that you need to use those sharp tools constantly, when a safer tool could do just as well!
I agree in general, and with the idea that effectfullness of compile-time calculations should be strictly limited.
OTOH reading an input file is one effect that a compiler inevitably has anyway. A clean way to load and interpret an input file as a part of comptime computation would be very helpful, without the problems of arbitrary effects.
Yeah imo the way this would be handled ideally is that some other program would generate a source file from the csv. That source file can then be included normally and work with existing caching infrastructure etc.
But ya know back when make was the way of doing things this would be easy to set up. Now in the age of each tool having its own build system it is different.
"Coding a Lisp Interpreter in Shen by Mark Tarver", "Shen Tutorial: Sequent Calculus by Neal Alexander", and " Defining Types in Shen by Chris Double" - these all illustrate what is going on in different ways.
Has the license for Shen changed in the last few years? Last I remember it was a custom one that was off putting. I got and read the book years ago, interesting ideas, but not so interesting as to try and go further with a language with a weird license.
That said, even if I don't use this a lot, I pay for Shen Professional to support development. Like you, I got and read the book and like the ideas, and I decided to support the project because I rather be sold something explicit (a programming language) than who knows what I get sold through a language that is open source but depends on a few or even one big company to pay the devs.
The Shen releases for Mac OS X seem to all (I tried 2.7 to 3.0) segfault on m1. That's not great.
Edit: seems the github stuff is ancient (before m1) and not maintained. Should be indicated in those repositories really. The way to get it to (very easily) work, is to install sbcl, download a kernel here[0] and compile it. Works fine.
There is kernel update even on Feb. Just not sure how to use it or install it. Is there a source something that is installable under sbcl. Can it do quick lisp? What is it?
That page is less discoverable. From the Shen homepage, I click on Learn and hope that they have a 15 minute intro? Vs I go to Learn X in Y Minutes, Crtl+F "shen", and I immediately get what I want.
This is the way. Open source projects—languages, libraries, toolkits, etc. (and especially those built by individuals)—are not like YouTube channels vying for your attention, and should not be treated with the arms-length "you serve me" mindset that is so common in some cultures.
As developers, we exist within a shared ecosystem where we all depend on one another. Especially for non-commercial open-source projects, those who put themselves out there are doing so out of goodwill, not because they want to gain fame or money from you (beyond maybe covering the cost of hosting the project). The least we all can do is support them in some small way and thus help build the world of great free software.
I see that it has an inbuilt compiler-compiler, prolog, and features for DSLs. Is the idea that Shen good for implementing statically typed, compiled languages? Or for metaprogramming?
Looks like it's been around for a while and I'm curious what folks have used it for.
> Our mission is to bring the power of Shen technology to every major programming platform used by industry and deliver to programmers the great power of Shen.
yes, but not really. if you reached Shen and would likely use it, you probably clicked on that website on purpose. the idea behind it is not something you can show with a fizzbuzz anyways as it is not your good old regular C skin.
Some idea of the flavor of the language would be helpful, though, and that's surprisingly hard to find at a glance. It seems to be another Lisp variant? Maybe?
The people who use software have absolutely no idea or opinion on the topic.
I asked 'the people who use software' and they don't like excessive memory usage or stuttering from bulk collection.
Also libraries written in a garbage collected language are only going to be usable in the same language.
Lots of people only think about the language they want to program in, then rationalize it being fine. That's how we got stuff like electron. When people think about what someone actually wants to receive that stuff goes away.
> I asked 'the people who use software' and they don't like excessive memory usage or stuttering from bulk collection.
Two of the most widely programming languages are implemented on top of garbage collected runtimes: JavaScript and Java. There are many applications where garbage collection works just fine.
> Also libraries written in a garbage collected language are only going to be usable in the same language.
See .net and the JVM. Those are nowadays runtimes with garbage collection and multiple languages.
Widely used? This is the point. The programs that people use directly are written in C++. Programmers try to get away with garbage collection because it's what they want, not what people using software want.
Those are nowadays runtimes with garbage collection and multiple languages.
That's like saying typescript can be used in javascript, it's all the same underneath. It isn't the same as something native that can be used and consumed anywhere else. Software in non native languages keeps getting re-written over and over and not widely reused. Once someone does something natively and does it well like sqlite, image libraries, etc. it stays done.
> The programs that people use directly are written in C++.
There is a lot C/C++ around and they are widely used to implement runtimes for other languages, incl. garbage collection. Lot's of software people use directly or indirectly is written not in C++.
> That's like saying typescript can be used in javascript
That's another option how to integrate languages: TypeScript is transpiled to JavaScript. C can also be transpiled to JavaScript. Emscripten can compile LLVM instructions to JavaScript and Webassembly. JavaScript/Webassembly then gets compiled to native instructions.
low-level infrastructures like the JVM create native code from Java (and other languages using the JVM), by compiling to machine code.
> It isn't the same as something native that can be used and consumed anywhere else.
Programs with garbage collection also run "native". The garbage collector is a native part of the program.
> Once someone does something natively and does it well like sqlite
sqllite is not written in C++, it's written in C. As the first three letters tell us, it implements a language called SQL. sqllite also comes with its own dynamic memory management system: https://www.sqlite.org/malloc.html
sqllite is an excellent example, where C is used to implement a higher-level language (here SQL) and a complex memory management for it.
Btw., I'm typing this now on a iPad, where the user side of software is mostly implemented in Swift or Objective C, which use "reference counting" for memory management. The browser I'm typing to uses a system provided JavaScript engine with garbage collection. The site I'm using (Hackernews) is written in Arc (which is a Lisp dialect), which runs on top of a variant of Scheme, which is another Lisp dialect, which provides a garbage collector.
This really illustrates my point. Programmers go through all sorts of rationalizations to pretend that what their favorite thing or the one thing they know is just as good as anything else to distribute to people and it's not.
sqllite is not written in C++, it's written in C
Probably why I said native.
higher-level language (here SQL)
Not the same of course. All this mixing of of terminology and pretending that SQL is the same as any other language or that reference counting is the same as typical garbage collection even though it is deterministic, gradual and doesn't need to be applied to stack variables is the kind of circular nonsense that hurts people who have to use software made by programmers who don't care about the end results.
Trying to pretend java compilation is the same as a C library or that two languages targeting the same vm means there is somehow an ecosystem that works with other things is the kind of circular technicalities of pretending the blanket terms apply to everything equally is how we end up with giant bloated java or electron desktop software that pauses and stutters trying to do something that was fast 30 years ago.
This is also why lisp is still a nonsense language after 60 years. Pragmatically it doesn't deliver and there are no upsides to having huge binaries and backwards syntax. People can pretend that modularity, dependencies, garbage collection, syntax and eco systems don't matter, but it's all rationalization of people trying to pretend reality is something it's not.
People don't want bloated slow software, they don't want GC pauses and stuttering and trying to pretend that hundreds of megabytes of java or lisp dependencies for hello world is the same as C is just sticking your head in the sand.
> People don't want bloated slow software, they don't want GC pauses and stuttering and trying to pretend that hundreds of megabytes of java or lisp dependencies for hello world is the same as C is just sticking your head in the sand.
Baaaaased CD!
Garbage collection has no reason to exist in a world where Rust shattered the false dichotomy, proving you can have safety and speed.
For scripting, like with Python, GC is okay.
For significant software, the GC'd langs are almost all mediocrity-enabling abominations created out of corporate greed. Oracle made Java for the same reason that Microsoft made C# and the reason Google made Go; they can't find enough C/C++/Rust programmers, and they want to have their cake and eat it too.
Functional languages are an exception to that criticism though. They're not corporate abominations; they're a weird utopian experiment from simpler times, which, like the corporate abominations, bet that the party would never end, that Moore's law would carry us to heights or CPU power where the bloat is negligible. That was more correct with memory than with processing speed, but it seemed like a bad bet nonetheless.
GC systems delay collecting garbage because it is unproductive overhead. For each object constructed, it is quicker to claim fresh memory than to clean up garbage and reclaim its memory. Thus, garbage accumulates, amounting to memory claimed by the process, but not storing anything useful to the program. In practice, much of the memory claimed by a GC program, most of the time, is such garbage.
While we've been doing pottery for about 30,000 years, and woodworking for perhaps 10,000 years, we've only been programming (digital) computers for about 75 years or so.
We're still figuring out how to do it. Trying new programming language ideas is a big part of that... I started with Fortran 77, and man oh man am I glad I can program in Go now.
And even that, in woodworking there's been three "new" methods of sharpening in the last decade or so which all became trends (and counter-trends); and new tools, new jigs, new tricks pop up all the time, so...
I do almost all hand tool woodworking, but not purist. My main smoothing plane is from 1910ish. My most new fangled hand tool is a Japanese Shinto rasp.
And you’re 100% right. I’ve changed my chisel and plane iron sharpening method twice in the last 12 months.
There’s oil stones, wet stones, diamond stones, and sandpaper. Plus a leather strop with pick-your-compound. I’ve used 2 different jigs on stones to get a more consistent bevel than by hand. There’s high speed grinders with a lot of pauses and cooling to not lose the temper. There’s expensive water cooled low speed grinders. Then there’s debate on the angle, microbeveling, and how much of the back you should flatten.
I’m now using a new jig from TayTools that uses a 3M Cubitron II sandpaper disk on a drill press when they get bad. I freehand on diamond and a strop after and between resetting the bevel. It’s the laziest way I’ve found so far.
Claiming any choice is best is likely to result in fisticuffs. And don’t start a conversation on workbench design or vice choices.
Yeah, that's totally true (and probably for pottery too). I didn't mean to say, those are totally solved areas, just that we're really in the early days, and so we have a ton of learning and experimenting to do. It's a great time to be a nerd :-)
> Shen owes its origins to work done in the 90s by Mark Tarver on applying high performance automated reasoning techniques to the problem of type checking programs. The first version of the work SEQUEL (SEQUEnt processing Language) premiered at the 1993 International Joint Conference on Artificial Intelligence under the title 'A Language for Implementing Arbitrary Logics'.
This is hardly an important point, but I don't think a change in the name makes something a different programming language. It's a minimum of 19 years old since Qi was released in 2005. Even then, Qi was just the evolution of the original language, being built on the same ideas.
only they bring something new. Many of the languages posted here don't fall in that category. Can't learn something if you have already learned it before
Shen was on here ages ago. Probably back in like 2012 if not earlier. Programming languages and discussions on them pop up all the time as new folks discover them and it makes for good continuing talks.
Well, this is a site that a lot of programming nerds read. Programming articles seem to interest enough people here that they keep making the front page.
Maybe just ignore the articles that don't interest you?
yep, it's great. One of my favourite things about HN.
I, for one, will lament these days when the AI overlords take over and we just ask AlexaSiriGPT to write all our code in the same breath as turning on the radio.
https://github.com/mthom/scryer-shen/
Several innovations are documented in the README. Both the Prolog implementation and the type checker are written in / hosted by Scryer (Prolog implementation is done, the type checker is in progress). Scryer has many powerful constructs for monotonic reasoning which should help to take Shen's type checker in particular to new heights of power!