5 ms·
Introducing Spider 0.1
- k-mcgrady 12y agoIs 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 12y agoit compiles to JS. See: http://spiderlang.org/ http://spiderlang.org/
- k-mcgrady 12y agoCool, thanks.
- izolate 12y agoNice one Alon. Still amazed at your development pace. Keep it up, buddy.
- mounibec 12y agoLooks so cool! I'll give it a try
- sebastianconcpt 12y agoI 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 12y agoI 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.
- pdubroy 12y agoWhy isn't a list an expression?
- sebastianconcpt 12y agoYes, in LISP everything is an expression
- sebastianconcpt 12y agoIf 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.
- ryanmk 12y agoI'm intrigued by your comment that being forced to do a lot with a little is powerful. Do you have any arguments or evidence for that you could point me to?
- sebastianconcpt 12y agoIf you can do a lot with little means you are resourceful. That's powerful by definition. So there you have a pragmatic yet theoretical foundation. Just by being somehow basically-reductionist, you'll see that the Universe does a lot with just electrons, protons and photons, yes? Well... if you for example adhere to String Theory then you will be able to model a lot with just strings http://en.wikipedia.org/wiki/String_theory http://en.wikipedia.org/wiki/String_theory "Everything is a String" => you have something Paradigmatic. A "space" or "knowledge body" that can explain a lot using little. That's what I mean by being paradigmatic. If you want more reference on this principle and you take the Quantum way, one thing you'll find is that you can explain a lot with little too. There is actually a theorem that deducts Newton's second law using only Schrödinger's Equation as foundation. But since I've talked about this here I've won 3 downvotes, then you can rest for sure that the Universe is broken.
- dkarapetyan 12y agoLadies 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.
- alongub 12y agoNote that Spider comes _from_ an actual engineering requirement. http://spiderlang.org/#why-spider http://spiderlang.org/#why-spider
- dkarapetyan 12y agoPlease don't take my comment as dismissive of your work. I think it's really cool and the list of language features is quite impressive. I only disagree with the dynamic typing statement. Both TypeScript and AtScript are optionally/gradually typed which means your code can be as dynamically typed as you want it to be so you still retain the benefits of dynamic types. For some the backwards compatibility might be an issue but I personally like the fact that any JavaScript code is automatically valid TypeScript code that I can easily migrate to use more and more TypeScript features.
- adam-a 12y ago> Ladies and gentlemen we already have NPM, Bower, Component, Duo, Jam, etc. More package management systems are not what is lacking. What is lacking ... I find your comment to be snide, ungrateful and most of all uninformed. Personally I think new programming languages are interesting, despite how widely they might or might not end up being used, if they present new ideas, or solve difficult problems. Spider seems to solve a few Javascript problems and does so with a different approach to the other languages you listed.
- dkarapetyan 12y agoYou forgot jspm.io. So are you enjoying having all those choices and each one being subtly incompatible with all the others? Let me know how your next spider project turns out and how it interoperates with all the existing code written in coffeescript, typescript, dart, vanilla js, etc.
- riffraff 12y agoisn'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 12y agoIt is bugged, thanks! EDIT: Fixed
- tinco 12y agoWhat'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.
- alongub 12y agoYou forgot that Spider embraces JS prototypes instead of just adding classes, ES6 target, explicit global scope usage, string interpolation, splats, `for-in` and `for-of`, list comprehensions, existential operator, ranges, and much more. Take a look at http://spiderlang.org/ http://spiderlang.org/ :)
- rattray 12y agoThat all went under "everything Coffeescript has". Perhaps he was less excited about the class thing or having to ::call globals.
- tinco 12y agoSorry, I edited the last list entry to "everything Coffeescript has" was "syntax for lambdas" before. He is correct, all the features CoffeeScript has are pretty much essential and are in fact in this language, so I edited it to reflect that.
- jamesfisher 12y agoSyntax != semantics. The JavaScript problem is not a syntactic one. Baking "channel <- message" into the syntax only introduces unnecessary syntactic complexity; why not just `put(message, channel)`?
- k__ 12y ago> takes the best ideas of ... Python ... CoffeeScript > still got curly braces and semicola
- bpicolo 12y agoClearly defined blocks are not a bad thing, and let you do things python can't.
- zufallsheld 12y agoCan you give an example?
- bpicolo 12y agoThe best justification is probably that you lose an entire class of errors, but imo you improve language expressiveness. Rust takes advantage of it's braces in good ways, I'd say.
- k__ 12y agoI'd like some examples, too. I found myself struggling with whitespace-languages at first.
- arohner 12y agoMulti-line lambdas, for one.
- k__ 12y agoWasn't the multi-line lambda problem in Python due to the fact how small lambdas have to be in Python?
- Grue3 12y agoAutomatic, unambiguous indentation of code by editor.
- 12y ago
- joaojeronimo 12y agoFinally a language that targets ES5/6 that I can use!
- Ironchefpython 12y agoAny thought of doing a sweetjs implementation so I can compose Spider with other Javascript language extension (e.g. inline JSX templates)
- alongub 12y agoThis is an open proposal: https://github.com/alongubkin/spider/issues/81 https://github.com/alongubkin/spider/issues/81
- viach 12y ago"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 12y agoI 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 ;)
- msl09 12y agoI 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 12y agoSemicolons: 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
- breuleux 12y agoI 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`.
- dang 12y agohttps://news.ycombinator.com/item?id=8618739 https://news.ycombinator.com/item?id=8618739