

Introducing Spider 0.1 - alongub
http://blog.spiderlang.org/post/103752682650/introducing-spider-0-1

======
dang
[https://news.ycombinator.com/item?id=8618739](https://news.ycombinator.com/item?id=8618739)

------
tinco
What's to love about this language:

    
    
        - 'function' renamed to 'fn'
        - syntax for message passing (a la Go's channels)
        - syntax for promises
        - syntax for currying (!)
        - everything that coffeescript has
    

In my opinion that seems to satisfy everything a modern Javascript programmer
could want from a new language. I'm a CoffeeScript person myself and I love my
super succinct code, but I'm also aware many people are turned off by lack of
braces, and possibilities of ambiguity.

That and the fact that I've noticed my colleague has been rewriting callback
code I wrote into ugly promise-like objects so they could be more powerful, so
I think it's a good time to be exploring for nicer ways of dealing with the
issue, preferably with some sugar.

~~~
bollix
Renaming 'function' to 'fn'?

So much of this is down to fashion. Are programmers really bound by their
typing speed? No.

The only real thing that matters with a language is "can I run this on
hardware X", and "How fast does it run / how much memory". Syntax is utterly
irrelevant (Unless you're into fashion).

Lisp is just basic with a different syntax...

~~~
jfoutz
So do you bother with assembly or just go with straight binary?

~~~
bollix
assembly -> binary is an encoding not a syntax.

That's like asking an author if he writes using the alphabet or ascii.

Programming language debates are like asking Charles Dickens why he wrote in
English rather than Russian. Would his books have been any different in
Russian? No - it's irrelevant.

~~~
icebraining
Language in literature is certainly not irrelevant.

Any translator (or even bilingual person) will tell you that some concepts are
very hard to translate, because the target language was shaped by a different
culture.

And in scientific and other non-fictions texts - which are closer to programs
than literature - this was doubly so, as the number of important scientists
and philosophers writing in non-native languages shows.

------
breuleux
I installed spider-script through npm, but `spider somescript.spider`
complains with $traceurRuntime not being defined. I can still compile the
script, then require traceur and the script from another file, but I'd rather
not have to do that just to try out the language :(

The FizzBuzz example is (still) bugged: it lacks semicolons and []s around
[1...100].

Now for my thoughts: I like the way you handle globals, channels and
async/await. Currying syntax is nifty, I probably wouldn't have chosen ^ but
that's a bit of an arbitrary choice I guess. For integer division I prefer //,
but I just realized you use that for comments. The module syntax works,
although I prefer to group export declarations in a separate export or provide
block.

I think the pattern matching is insufficiently powerful. Normally, pattern
matching lets you declare variables as part of the pattern, so that it becomes
a kind of switch on the different ways to deconstruct the input. I have an
example of what I mean here:
[http://jsfiddle.net/f1ycatas/2/](http://jsfiddle.net/f1ycatas/2/) . Matching
the value of an existing variable could be done with syntax like `== n`.

------
dkarapetyan
Ladies and gentlemen we already have TypeScript, Dart, clojurescript, scalajs,
coffeescript, PureScript, elm, etc. More innovation in the web language
ecosystem is not what is lacking. What is lacking is all the boring stuff like
a sensible package management system, deployment mechanism, framework
interoperability, etc. You know, all the un-sexy stuff that actual engineering
requires.

~~~
NickPollard
What we really need is a replacement for Javascript as the 'bytecode of the
internet'. It's clear now that people want to have the freedom to write client
web code in whatever language they prefer. A web browser is just a VM for
running the output of a [dart, coffeescript, scala...] compiler, and we should
recognise that, and replace javascript (a language designed for humans to
write) with a new bytecode (a language designed for computers to run), and
then people can use whatever compilers they want to translate from the code
they write to the code the user runs.

People can still write javascript with a JS->Bytecode compiler; people who
want to write TypeScript or Dart can get better compilation or performance,
and people can easily write a whole load of new languages and new compilers
without being constrained by the intricacies and design decisions of
Javascript.

~~~
rtpg
I'll take "Subsets of Javascript by Mozilla" for $200, Alex

I think asm.js has proven itself to be a "good enough" solution if we start
writing some serious compiler tech

~~~
NickPollard
I didn't mention asm.js but it was on my mind when I wrote the parent; it's
possible that it is 'good enough' and eventually becomes widely adopted
enough, but I wonder if we might do better by eschewing the need for
compatibility with Javascript.

~~~
bobajeff
We might but first someone has to first design and specify the new
Intermediate Language. Then submit it to ECMA. Then implement it in a browser.

This new IR better be so much better than JavaScript and asm.js at being a
compile target for languages, that it takes no time for web application
developers and compiler developers support it with enough tools and
applications to dwarf their JavaScript counterparts. Good luck with that.

------
msl09
I love almost everything about this and dislike only a few things:

As k__ pointed I see no point in including semicolons, if you already have
parenthesis that can be used to delimit expressions and newline characters,
why include ";" ?

Another thing that I don't like is how the language is encourages type
weakness in circumstances that normally lead to a dozen pointless bugs in my
software during the development process:

    
    
        a = -1
    
        if a { // Actually meant a > 0
          console.log("In if");
        }
    

This could be avoided if languages didn't implicitly convert int, float etc
values into boolean in the conditional expression of if. The result wouldn't
even need a lot more code

    
    
        if Boolean(a) {
    

That would probably require more code to implement into Spider in sections
that might be performance critical. CG coders love to use those binary
shortcuts in their code.

~~~
alongub
Semicolons:
[https://github.com/alongubkin/spider/issues/30](https://github.com/alongubkin/spider/issues/30)

Type inference:
[https://github.com/alongubkin/spider/issues/58](https://github.com/alongubkin/spider/issues/58)

------
riffraff
isn't the fizzbuzz example bugged? Unless the language automatically
identifies the most specific pattern I think the case [0, 0] should be the
first?

EDIT: if it _does_ identify the most specific case, I think it's worth
pointing out.

~~~
alongub
It is bugged, thanks!

EDIT: Fixed

------
k-mcgrady
Is this a brand new language or more like Coffeescript (something that makes
Javascript look nicer)? Either is fine I just couldn't tell from the post.

~~~
delluminatus
it compiles to JS. See: [http://spiderlang.org/](http://spiderlang.org/)

~~~
k-mcgrady
Cool, thanks.

------
viach
"brand new language to avoid JavaScript’s bad side while embracing its good
side."

Why don't just use the good side? Well, with all the tools available for
JavaScript - static code analysers, type checkers and code coverage tools, is
it really _that_ hard to just write this damn code without introducing a new
language?

~~~
chm
I think it's an excellent learning experience to write a new language (even if
it's based off an older one). To me the project is justified on this fact
alone. Even if nobody ends up using it in production, who cares? They're
having fun ;)

------
k__
> takes the best ideas of ... Python ... CoffeeScript

> still got curly braces and semicola

~~~
0942v8653
Go, Swift, and C# all have braces, looks like Python and CoffeeScript were
overruled. I do agree with you on the semicolons, though (that's 4-to-1).

~~~
k__
Well, the text mentions the "best things".

I wouldn't consider braces the best things in go, swift or c#.

------
Ironchefpython
Any thought of doing a sweetjs implementation so I can compose Spider with
other Javascript language extension (e.g. inline JSX templates)

~~~
alongub
This is an open proposal:
[https://github.com/alongubkin/spider/issues/81](https://github.com/alongubkin/spider/issues/81)

------
izolate
Nice one Alon. Still amazed at your development pace. Keep it up, buddy.

------
joaojeronimo
Finally a language that targets ES5/6 that I can use!

------
mounibec
Looks so cool! I'll give it a try

------
sebastianconcpt
I don't want to disencourage good initiatives and experiments, but if is not a
technology that creates a "space" where "Everything is a.." then I won't be
excited because is not going to be paradigmatic by design.

When "Everything is a.." you're forced to do a lot with little and that's
really powerful. And creates a paradigm.

Some examples of it:

LISP: "Everything is an Expression" Haskell and Miranda: "Everything is a
Function" Self and Smalltalk: "Everything is an Object"

~~~
rntz
I can't speak for Smalltalk or Miranda, but _not_ everything in Haskell is a
function, and _not_ everything in Lisp is an expression.

The case in Haskell is obvious: 2, "foo", (Data.Set.singleton 3); none of
these are functions. Functional programming isn't about "everything is a
function", it's about (among other things) making functions _first-class_ ,
and using higher-order functions to build powerful abstractions. (There are
also a lot of other things associated with FP, incl. but not limited to:
immutability, purity, powerful static type systems, focus on "plain old data"
over OO hierarchies, laziness, etc). If you want a language in which
_everything_ is a function, you want the untyped lambda calculus.

The case in Lisp is a little less obvious; I've been meaning to write a blog
post about this. But consider:

    
    
        (let ((x 0)) x)
    

Is `((x 0))` an expression? No. It's a list of binding-pairs.

~~~
sebastianconcpt
If you want we remove the Haskell reference as invalid example, be my guest.
The idea that I'm bringing in is not any less true because of that.

