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?
I've spinning up a new Shen implementation from scratch, in Racket, which integrates directly with my Prolog implementation, Scryer Prolog:
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!
Great job with Scryer Prolog!
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
The author, Dr. Mark Tarver, is perhaps best known for the essay The Bipolar Lisp Programmer: https://marktarver.com/bipolar.html
If you want to jump straight into what makes Shen interesting, read Part 10 of the manual, starting with recursive types: https://shenlanguage.org/OSM/Recursive.html
He has also published The Book of Shen, which is really interesting.
Sadly, the lack of extensive free documentation is probably harming Shen's popularity.
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.
Not sure it is. It it sort of hypertext ???
https://shenlanguage.org/OSM/Introduction.html
That is the spec. The Book of Shen:
https://shenlanguage.org/TBoS/tbos.html
The page "Shen in 15 minutes" gives a quick introduction:
https://shenlanguage.org/OSM/15min.html
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?
It's a hybrid of lisp and prolog.
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
______________________
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.
Note: this is all of extremely interesting, extremely powerful, and extremely cursed! But I think it is certainly interesting food for thought
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.
That’s pretty cool. Any other examples? Actor framework equivalent ?
check out https://shenlanguage.org/learn.html, especially
"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.
Says they transitioned to 3-clause BSD a while ago: https://shenlanguage.org/OSM/License.html
Ah nice, thank you
There was a crowdfunding to open source it. It seems to have gotten more friendly with the open science thing as well. Might give it another go.
There are open source ports that have a clear license now: https://github.com/Shen-Language/shen-sources/blob/master/LI...
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.
[0] https://shenlanguage.org/download.html
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?
Download the S38, install sbcl and do the load from README from the REPL. It’s very fast and then it works fine.
Yeah it took barely 2.5200843811035156e-4 secs to compile on M2 Mac.
When I want to get a quick feel for a language I've never heard of, I usually look for the Learn X in Y Minutes[0] page for it.
Shen doesn't have one. Perhaps the author and/or poster should remedy that?
[0] https://learnxinyminutes.com/
Not the same, but this section of the book could work as a quick intro: https://shenlanguage.org/TBoS/tbos_34.html#34;
It does: https://shenlanguage.org/OSM/15min.html
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.
LearnXinYminutes says "Want to add your favorite language to the list? Head on over to Github[1] and send a pull request!" Right at the very bottom.
Sounds like a great opportunity for you to contribute. Especially since the work is basically already done and your main concern is discoverability.
[1]: https://github.com/adambard/learnxinyminutes-docs
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.
Your personal workflow is what you are used to, not what is inherently "more discoverable."
The second option sounds way less discoverable, assuming you’re interested in learning Shen.
I went to the Shen web page, and immediately got "Learn Shen in 15 minutes". Seems obvious to me.
Given he wrote the bipolar issue of lisp and lisp users, what/how/why this language solve this issue?
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.
Tip for anyone trying to show off a language: put a hello world or fizz buzz on the front page
this is not one of "those" languages that is begging for your use / mainstream adoption.
> 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.
Sounds like it is?
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?
Here's what you're looking for I guess. But yeah, not that easy to find.
https://shenlanguage.org/OSM/15min.html
Love the name. Literally the only reason why I clicked into this-- "Hey, is this referencing what I think it's referencing?" Neat.