
The Shen programming language - fogus
http://shenlanguage.org
======
jamii
From the license page (<http://shenlanguage.org/license.htm>):

"Part of our motivation in maintaining a tight spec and a reliable platform is
to hold the Shen community together so that we do not splinter our resources
on multiple incompatible forks. We do not want multiple incompatible dialects
of Shen, multiple compilers, multiple incompatible libraries. We want $free
readable libraries that work for all of us and libraries we can pick up and
use without worrying about compatibility. Hence the production of derivative
non-conforming programs from our source, whether called Shen, Shin, Shine or
Shoo, is barred by the license. To give up on this is to give up on the
motivation for Shen."

Whilst avoiding forking prevents splintering it can also be dangerous. OCaml
suffers from a similar restriction which has seriously impeded the development
and use of new compiler features like staged compilation
(<http://www.metaocaml.org/>), type-safe marshalling
(<http://www.cl.cam.ac.uk/~pes20/hashcaml/>) and delimited continuations
([http://groups.google.com/group/fa.caml/browse_thread/thread/...](http://groups.google.com/group/fa.caml/browse_thread/thread/d4ca429e7935033c)).
INRIA rarely accept new features into official distribution and the license
prevents anyone else from doing so. Extensions have to be distributed as
patches and inevitably bitrot.

Tying the long-term viability of a language (or spec) to a single owner rings
alarm bells for me. Clearly they want to avoid another Scheme but I've had bad
experiences in both directions.

~~~
gruseom
Tarver would be better off letting go of his urge to tinker with licenses and
just run with one of the existing options. The risk posed by suboptimal
licensing is negligible compared to the risk of his radical new language not
getting used at all, and every time people get distracted by nitpicking
license terms -- as they invariably do -- a significant portion of the tiny
and precious attention budget for Qi/Shen gets blown through. This is a shame.

------
ekidd
There's a nice introduction here, which is aimed at experienced functional
programmers:

[http://shenlanguage.org/documentation/Tutorials/Shen-
in-15mi...](http://shenlanguage.org/documentation/Tutorials/Shen-in-15min.htm)

Shen appears to be a strongly-typed functional language with a Lisp-like
syntax. It supports pattern matching:

    
    
        (define sum-list
          [] -> 0
          [H|T] -> (+ H (sum-list T)))
    

...partial application:

    
    
        (* 3) ; returns (/. X (* 3 X))
    

...as well as macros that can alias function names:

    
    
        (defmacro logmacro
          [log N] -> [log N 10])
    

There's also an embedded "Prolog" implemenation, though I don't know how
complete it might be:

<http://shenlanguage.org/documentation/prolog.htm>

However, there doesn't appear to be an object system or a monad library, and
the "lazy evaluation" system uses a typical promise/force approach, which
every Scheme has had for decades. So Shen may not be well-suited to the kind
of fun tricks available in Haskell and (to a certain extent) Scala. Still,
it's definitely an interesting language.

~~~
masklinn
Partial application with a lisp syntax threw me for a loop, it looks weird.

------
jstepien
The first thing I'd like to see on a programming language's website is a
handful of short examples, like on <http://ruby-lang.org>. In this case
examples are hidden a bit deeper:
[http://shenlanguage.org/Documentation/Tutorials/Shen-
in-15mi...](http://shenlanguage.org/Documentation/Tutorials/Shen-in-15min.htm)

~~~
michaelcampbell
I agree with your point, but ruby-lang.org has precisely one:

    
    
        puts "Hello World!"
    

Which I'd say is more someone trying to be cute (or pro-forma) than trying to
show off the language to the curious.

But, I guess that's subjective.

~~~
djacobs
Wait, but that's not true. It has a full-fledged class definition,
instantiation, and method call.

~~~
jstepien
Yes. I believe they're shown randomly and they're cached so we might see
different examples.

~~~
michaelcampbell
D'oh; all I get is the puts statement with 15 lines of comments.

Apologies.

------
Peaker
When someone writes "Shen has the most powerful type system of any existing
functional language, including ML and Haskell", I get suspicious.

Have they really studied each and every type system out there? What kind of
dependent types do they have? How do they compare to Agda, Coq, Epigram?

~~~
effn
The idea is that Shen has a turing-complete type system, so it shouldn't even
be possible to create a more powerful type system (given a specific definition
of "powerful").

~~~
andolanra
To expand on that idea a little bit: that's a valid definition of 'powerful',
but there's another definition of 'powerful' which some people mean when they
talk about type systems, and that's "To what degree does this type system
prevent errors?" It seems from cursory research that Shen is powerful with
respect to the definition, "To what degree can we encode computations in the
type system at compile-time?" and Agda and Coq's type systems are powerful
with respect to the definition, "How can we limit the class of programs by
encoding constraints in the type system such that the resulting programs are
provably correct?" Consequently, neither Agda nor Coq are Turing-complete even
at the _language_ level, much less the _type_ level, but that accordingly
gives them greater power to know information about their programs at compile
time.

------
z92
Any new language needs the ability to dynamically load and bind with C
libraries (so/dll) and once that works seamlessly, then everything is done.

Otherwise it will enter the chicken and egg problem regarding availability of
libraries.

~~~
riffraff
in this case maybe not so much. If I recall correctly shen has a pretty tiny
core that is designed so it can be ported to existing runtimes, so for example
a shen/js could just delegate calling libraries to V8 or *monkey, while
shen/scheme can use racket's FFI etc

------
SamReidHughes
Instead of lambda expressions, it has _slashdot_ expressions.

~~~
gurraman
I found this really odd. Any idea what the reasoning behind the "slashdot" is?

On a side: I like Haskell's take on lambda syntax (prefix with "\", e.g. \x y
-> x + y).

~~~
rads
If you squint (a lot), /. looks like a lambda.

~~~
anon_c
Why don't we stop fucking around and just use _λx y→x+y_?

~~~
pavpanchekha
Because typing a lambda is not obvious on US keyboards.

~~~
gcr
A shame, too. At least decent editors make this a tad easier. DrRacket, for
example, binds lambda to Ctrl+\\. Racket accepts both "lambda" and "λ" as the
same thing, so it's up to personal preference.

~~~
pavpanchekha
I'm well aware of how DrRacket works; nonetheless, telling a newbie to type
"lambda" will lead to typing, and telling them to type a lambda will lead to
griping.

Also, the difficulty of typing lambdas also means that writing blogs about
code, or documents, or emails, will require even more pain.

------
JoachimSchipper
Apparently, this is based on Qi, which tried to update Lisp with, among other
things, types (type checking/inference/pattern matching/etc.)

------
Zak
I'm disappointed that it doesn't seem to stick with Lisp syntax, instead
adding a large number of infix operators. I'm reminded of the loop macro, but
this is more pervasive since you don't have to use loop.

The syntax is important for being able to write sophisticated macros that take
advantage of all the language's features and for making things like genetic
programming easier.

~~~
Fixnum
The infix operations are mostly syntactic sugar - [3 4 5] is the same as (list
3 4 5), [A|B] is (cons A B), and so on. I don't know about '->' for pattern
matching and '<-' for backtracking (maybe others), but you can of course
replace '->' by conditionals as is usually seen in Lisp programs not employing
pattern matching.

It's the non-open license (forks seem not to be allowed) which is a bit more
disappointing. I guess it's a reaction to historic Lisp fragmentation but I
doubt this will help adoption.

------
muraiki
I'm trying to go through the longer book (on Qi, which has been updated for
the most part for Shen) but I'm having a difficult time reading it because
every page is saved as a JPG! Magnifying the text just makes it more
unreadable... is this 1990?

Edit: The book is quite excellent, including a neat history on why imperative
languages are the norm. It's just that my eyes are in pain. :(

------
Shenglong
I feel obligated to learn this language, just because of its name.

~~~
shennyg
Same here!

