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?
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?
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.
That sounds interesting. Can you give an example of a type defined this way that would not be possible in most languages?
{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.
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!
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.
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.