News for hackers. Stuff that matters.
Re:ShenScript – An Implementation of the Shen Language for J... by FreezerburnV on Saturday January 02, 2021 @11:57AM (#25614135)
I checked their home page, and I can't quite seem to find the value proposition of Shen. It looks like it's a Lisp implementation? Why would I want to spend time learning/using this over JS/Go/Java/etc.?

I'm not trying to make any statements about the usability or anything, I just literally cannot find enough details about what Shen is beyond some books on Amazon or vague home page claims to make any judgements about this.

Re:ShenScript – An Implementation of the Shen Language for J... by travv0 on Saturday January 02, 2021 @01:41PM (#25615173)
That's weird, because I just checked their home page and found this list of features:

        pattern matching,
        lambda calculus consistency,
        macros for defining domain specific languages,
        optional lazy evaluation,
        static type checking based on sequent calculus, one of the most powerful systems for typing in functional programming,
        an integrated fully functional Prolog,
        an inbuilt compiler-compiler,
        has a BSD kernel that runs under a host of different languages (Lisp, Python, Javascript, C ...) and operating systems (Windows, Linux, OS/X),
        is extensively documented in a book
If those don't interest you, there's probably not a reason for you to spend time learning it. I'm not sure what other info you're expecting to find.
Re:ShenScript – An Implementation of the Shen Language for J... by nerdponx on Saturday January 02, 2021 @04:48PM (#25616874)
I enjoyed this Strange Loop talk: https://www.youtube.com/watch?v=lMcRBdSdO_U
Re:ShenScript – An Implementation of the Shen Language for J... by cwyers on Saturday January 02, 2021 @03:29PM (#25616185)
So, a Lisp.
Re:ShenScript – An Implementation of the Shen Language for J... by zeugmasyllepsis on Saturday January 02, 2021 @03:36PM (#25616254)
> static type checking based on sequent calculus, one of the most powerful systems for typing in

Not exactly a common characteristic for Lisps

Re:ShenScript – An Implementation of the Shen Language for J... by eyelidlessness on Saturday January 02, 2021 @01:25PM (#25615009)
It’s a statically typed functional lisp, which is a rarity and a good opportunity to try out another programming paradigm. At a glance it looks like it uses a lot of Prolog semantics, so that’s also got Logic Programming heritage which is yet another paradigm exploration opportunity.

I’m not sure it’s something I’d want to use in production, but I certainly might play around with it at some point to get some brain juices flowing in different directions.

I went from JS -> Clojure/ClojureScript -> TypeScript, and that progression taught me a lot. It probably improved my programming skills many times over. I learned how to much better reason about state (Clojure/FP) and interfaces/contracts (TS/static types), which pays off constantly.

Re:ShenScript – An Implementation of the Shen Language for J... by openfuture on Saturday January 02, 2021 @02:14PM (#25615494)
The main idea is extreme portability. You only need to implement something like 46 basic functions (and, or, xor, +, -, *, /, if,...) and then you can use the language on that platform.

Besides that it has a lisp-2 macro system so you can do everything..

Re:ShenScript – An Implementation of the Shen Language for J... by analognoise on Sunday January 03, 2021 @01:08AM (#25619906)
Do you have a link to the list of functions?

It sounds like it would make for a Forth replacement for an ultra-minimal first boot up language for hardware bring up for custom ISAs.

Re:ShenScript – An Implementation of the Shen Language for J... by Jtsummers on Saturday January 02, 2021 @01:21PM (#25614974)
http://shenlanguage.org/osmanual.htm

Here's a now 4 year old version of the manual that ought to provide you with more detail.

Re:ShenScript – An Implementation of the Shen Language for J... by asimjalis on Saturday January 02, 2021 @09:54AM (#25613173)
Where can I find a hello world for this language. I didn’t see it in the docs linked above.

Update: I found this link helpful.

http://www.shenlanguage.org/shenin15min.htm

Re:ShenScript – An Implementation of the Shen Language for J... by smasher164 on Saturday January 02, 2021 @12:11PM (#25614265)
For those who want a good overview of the power of Shen, see this Strange Loop talk: https://youtu.be/lMcRBdSdO_U.
Re:ShenScript – An Implementation of the Shen Language for J... by tenaciousDaniel on Saturday January 02, 2021 @09:31AM (#25613035)
As someone who is not at all familiar with Shen, or transpiling in general...why not create a WASM compiler for Shen instead?
Re:ShenScript – An Implementation of the Shen Language for J... by uryga on Saturday January 02, 2021 @10:21AM (#25613366)
[caveat emptor: my knowledge of WASM stuff is mostly based on blog posts and HN comments, and may be outdated. corrections welcome]

in general transpiling to JS lets you reuse the JS runtime (if your language is similar enough), e.g. the garbage collector. also, DOM/window APIs, which are likely why you'd want your language to run in a browser.

with WASM, you have to ship a runtime/interpreter for your language, often adding more than a few MB of overhead to any page using your wasm-compiled-language, and interop with the DOM and other browser stuff is (afaik) still in a pretty rough state. i think C# with Blazor managed to work around it, but it's tough

Re:ShenScript – An Implementation of the Shen Language for J... by eyelidlessness on Saturday January 02, 2021 @01:28PM (#25615034)
> also, DOM/window APIs

And Node/Deno APIs as well.

Re:ShenScript – An Implementation of the Shen Language for J... by shortercode on Saturday January 02, 2021 @12:33PM (#25614460)
In an ideal world it probably would!

WebAssembly only provides very minimal capabilities, anything more complicated than basic arithmetic and linear memory access require the features to be built. malloc, closures, arrays, error throwing, GC etc. all must be implemented. Some language features like console logs and visual output physically aren't possible, and must call out to the host ( normally JS ). Requiring the compiler to emit 2 languages.

In comparison JS has analogues to many common language features, making it easy to transpile to. There are other advantages to JS as well, but probably not worth listing.

It's complicated, and emitting JS is easier.

Re:ShenScript – An Implementation of the Shen Language for J... by aidenn0 on Saturday January 02, 2021 @11:58AM (#25614143)
I dunt know about Shen, but I looked into doing a wasm implementation of common lisp, and wasm is far too static. You can't, e.g. compile a single function to wasm and then call it from your already existing wasm. On top of that, its stack implementation makes it hard to do GC and any nonlocal transfers if control that aren't anticipated by its C++ support.
Re:ShenScript – An Implementation of the Shen Language for J... by sitkack on Sunday January 03, 2021 @07:05AM (#25621297)
Trampolines can enable all you seek.
Re:ShenScript – An Implementation of the Shen Language for J... by aidenn0 on Sunday January 03, 2021 @08:37PM (#25627094)
Can you explain more? Trampolines can help with non-local returns, but at a significant cost to performance in the case where returns are all local. I don't see how they help with allowing you to arbitrarily (re)define functions, which is something that both Javascript and real world assembly languages allow just fine, but WASM struggles with.
Re:ShenScript – An Implementation of the Shen Language for J... by felixr on Saturday January 02, 2021 @10:51AM (#25613570)
I came across this and had not realised that there are quite a few implementations of Shen now. The ones certified to the latest version are CL, Scheme, Wasp, Erlang and JavaScript

https://shen-language.github.io/#downloads