6 ms·
Reia: Friendly, Ruby-style syntax on the Erlang VM
- nathanwdavis 16y agoThis is still very alpha, but I'm submitting this because I really hope this succeeds. Erlang is really powerful and provides more modern paradigms for concurrent programming that just are not easily implemented in other VMs. However, Erlang's prolog inspired syntax is a big turnoff to many programmers. This could be a breakthrough.
- gurraman 16y agoI guess I'm weird but I actually like Erlang's syntax. To me it's part of the language's personality.
- nathanwdavis 16y agoYeah, I don't mind it either. Syntax is not a big deal to me, I care more about the unique capabilities of a language are. But I have heard other developers say they hate it.
- gordonguthrie 16y agoI was mostly using Ruby when I switched to Erlang full time 5 years ago and I really struggled with the syntax. I have got to start writing Ruby again now (to use the OLE libraries which I ain't going to reimplement). Ruby looks like line noise now. The key thing about switching to Erlang is that it is not a programming language choice. Erlang/OTP is an Application System that runs on one or more computers. We stick with Operating Systems (including super-ugly ones like the Unices) because of the benefits of knowing that your unwritten software can write to disk, speak to a network, use a GUI etc. Once you have started writing to an Application System where your unwritten software knows how to fail over to a new machine, you ain't going back. The syntax could be nicer? Who cares? Love the one your with is my experience - oh and I really do heart the mighty Erlang.
- rlander 16y agoMe too. i actually miss the syntax when i'm doing something in python now .
- bradfordw 16y agoDon't cheat yourself...Erlang itself is not that hard once you understand the core principles. I will say that OTP can be overwhelming, but with tools like rebar taking care of the bulk of it for you now, it's much more accessible to beginners. The learnyousomeerlang.com guide as well as the "Erlang and OTP in Action" book are really great resources for starting out. Stick with it, you'll be glad you did.
- moe 16y agoVoting you back up to 1, after you had predictably been downvoted... You're not alone here. I gave erlang more than one shot and really, really wanted to like it. It promises to simplify and robustify some of the most thorny distributed programming problems that I'm dealing with nearly every day, in ruby and python. But, just like you, I couldn't get over the syntax. It's ugly. It's error-prone. It's ugly. And that's a dealbreaker. The most powerful VM doesn't help when you have to work uphill against arcane syntax all day long. Nobody wants to do that. That's why ruby is so popular, despite the trainwreck that is MRI.
- CitizenKane 16y agoWhile the Erlang syntax is certainly a bit unusual I suspect that the greater adoption of Erlang is hampered more by other things. For instance, there is tool support. As with any language that isn't very widely used there aren't that many tools for the language. It makes it more difficult to get up and going in a short manner. This is especially true if you're on Windows since many Erlang projects don't work on Windows (even though the VM itself has Windows support). Beyond that, Erlang uses a model of programming and concurrency that isn't commonly used elsewhere. While you can get many of the features of Erlang in other systems, you are generally making an intentional effort to do so. Things like messaging passing, processes and hot code swapping are at the core of the language and getting used to things like this can be a bit overwhelming. On top of that many of the Erlang projects I've worked with have extremely sparse documentation. There are many cool projects out there like Mochiweb, Nitrogen, etc. but getting up and going with them can at times be an exercise in frustration. I think these things combine to make a barrier to entry that is much larger than people's syntax preferences.
- nivertech 16y agoI think Efene/Ifene is better for this task (just different syntax for Erlang, without changing Erlang semantics). No performance overhead. Reia has completely new semantics and run in interpreted mode over BEAM (Erlang VM). I personally think, that if programmer can't adapt to new syntax, it will be much harder to her/him to adapt to new semantics. Erlang's syntax is ugly comparing to modern languages like Ruby. The simple things are hard to do in Erlang and simple in Ruby, but complex thing are easy in Erlang and impossible in Ruby. Erlang is pragmatic choice for today. Maybe in 5-10 years Erjang,Scala,Go,Rust or some other new language will be a better choice, but until then use Erlang/OTP.
- bascule 16y agoReia isn't "interpreted" in any manner different from the Erlang language itself. It's somewhat similar to CoffeeScript in that it uses parse transforms to produce Erlang parse trees which are then compiled by the Erlang compiler just like any other Erlang source code. However, it's a bit more like JRuby in that it ships a runtime, core types, and a standard library. It's slower than Erlang, not because it's executed in a different manner than Erlang, but because it supplies a separate late binding mechanism for dispatching methods to their receivers.
- nivertech 16y agosorry, my mistake
- daleharvey 16y agoThis is a cool and fun project, but a lot of people in the thread are pretty confused about erlang syntax so I wanted to post this. erlang's syntax is not some arcane afterthought, it may look strange or even "ugly" to people not familiar with it, but it has been very well thought out and purposeful, every time there is a choice between a beautiful construct that can add confusion, or a less elegant solution that is crystal clear, erlang chooses less elegant every time. I have been doing javascript since I started programming and still get confused by its object model + prototypal inheritance, the same is true for pretty much every language, python, ruby, c++ etc going back to erlang is a refreshing break.
- moe 16y agoI'll stick with Damien Katz on this: Erlang is based originally on Prolog, a logic programming language that was briefly hot in the 80's. Surely you've seen other languages based on Prolog, right? No? Why not? Because Prolog sucks ass for building entire applications. But that hasn't deterred Erlang from stealing it's dynamite syntax. cf. http://damienkatz.net/2008/03/what_sucks_abou.html http://damienkatz.net/2008/03/what_sucks_abou.html
- troutwine 16y agoUntil our species gets rather better at quantifying the effect of communication mediums' on cognition I take issue with Mr. Katz's assertion. The semantic meaning of Erlang and prolog code is such that ideas can be expressed rapidly, in my experience. Besides, taste in syntax is like taste in tea: you might prefer a light cup of Earl Grey, I might like mine over-brewed and bitter. Prolog's syntax--and by extension Erlang's--is an acquired taste, perhaps; I like them both. Tea time!
- moe 16y agoYou of course have a point in that "you can't argue with taste". However programming languages live and die by the size of their community. Erlang has, by choice of an over-brewed and bitter syntax, drawn itself into a niche much smaller than it deserves. The only chance to escape would be to adapt a more popular taste. Otherwise it will eventually be obsoleted by a language "as powerful as erlang, but minus the arcane syntax".
- knodi 16y agoI really like Reia and have been following it for sometime now, I hope to use it onces it makes into beta.
- pjscott 16y agoWhat would make this more attractive to me is a mechanism for local mutable state. Some algorithms are just easier to express if you're allowed to change the values of some local variables. Erlang has no shared mutable state, but as Haskell's State monad shows, it's perfectly possible (and often useful) to keep mutable state boxed off safely. Since this can be transformed to tail-recursion, you should be able to implement it on the Erlang VM without too much trouble. Getting a convenient syntax and doing the transformation would be the hardest part.
- hvs 16y agoI'm a huge fan of Erlang (hot-swapping code for the win!), but this is probably my biggest peeve with it.
- wnoise 16y agoThere is still the process dictionary, but it's a bit unwieldy. http://www.erlang.org/course/advanced.html#dict http://www.erlang.org/course/advanced.html#dict
- yosh 16y agoI've also used private ETS tables for this.
- gordonguthrie 16y agoYes the process dictionary seems attractive, but you will come to regret it. It will always bit you in the bum, don't do it, don't do it, don't do it.
- nathanwdavis 16y agoCan you explain why please?
- gtani 16y agobackground on PD (tho i havent kept up with developments in R14, i can't say whether everything below still valid http://groups.google.com/group/erlang-programming/browse_frm/thread/15e3718c9fab68f7/c64371fee1f859f6?tvc=1#c64371fee1f859f6 http://groups.google.com/group/erlang-programming/browse_frm... ------------ (Oct 09) http://groups.google.com/group/erlang-programming/browse_frm/thread/8c5aac9e0ae91895/72683f33f1c4be85?tvc=1#72683f33f1c4be85 http://groups.google.com/group/erlang-programming/browse_frm...
- grav1tas 16y agoHere's a question. Does there exist a decent stand alone representation (BNF or otherwise) of the Ruby grammar? I see all this stuff that says Ruby-style, and it looks almost like straight up Ruby. Moreover, I Google around for a Ruby grammar and can't find much of anything substantial, but I haven't looked in awhile. I've tried cruising the Ruby YACC file, but that's kind of a disaster. Is there good one that exists as a reference for 3rd party Ruby implementations?
- RickHull 16y agoYou might take a look at http://mirah.org http://mirah.org, which is Charles Nutter's (creator of JRuby) forging of Ruby-like syntax with static typing that compiles to Java bytecode.
- nivertech 16y agoStill using rake for build? Please rebar-ify!
- bascule 16y agoPerhaps. Rebar is cool. But I'd like for as much of Reia as possible to be accessible to Rubyists with little or no knowledge of Erlang.
- jwecker 16y agoI too have been following Reia since he started it up and... well, I'm consistently disappointed. I'm putting this out there publicly because it's come up with co-workers. In the end, he's waffled with so many language design decisions that, in my opinion at least, it's turned into a language that on one end doesn't have the true syntactical flexibility of Ruby, and on the other side has buried a lot of what is most useful in Erlang. For alternatives I would suggest Lisp Flavored Erlang http://forum.trapexit.org/viewtopic.php?p=40268 http://forum.trapexit.org/viewtopic.php?p=40268 or Efene / Ifene http://www.marianoguerra.com.ar/efene/ http://www.marianoguerra.com.ar/efene/ - both of which do much better at being Erlang-(but-with-better-syntax). Edit: This is referring to its current state only- I reserve the right to change my mind in the future (:
- bascule 16y agoHi, Reia's my thing. My view on waffling on language design decisions: If you're working on a language project, fuck it up, and don't do a rewrite, you get PHP. That said, your other criticisms are valid: much of Erlang's functionality doesn't have first class Reia support (but is still directly callable through the presently undocumented Erlang interfacing syntax) Many of Ruby's great features aren't available in Reia yet either. I'm shooting for a subset of Ruby's metaprogramming features which aren't incompatible with Erlang-style code loading. I hope you'll continue to watch the project.
- jwecker 16y agoThe word waffling was too negative, and you're right. I apologize and I'll definitely keep watching. Erlang and Ruby are my two favorite languages as well, so if you do pull it off at some point, you'll have my support (:
- ohyes 16y agoI feel that we spend too much time worrying about the syntax of programming languages. I don't find switching between typing in erlang/lisp/java/ruby code any more difficult. All I do is switch IDEs (or plugins) and I'm at about the same level of productivity typing wise. Semantics are much more interesting to talk about, but it seems we never do talk about them. We rarely have holy-wars over the semantic differences between (for example) c and lisp, or lisp and Erlang. There are certain problems that are easier to solve when expressed as many concurrent processes. In this same way, there are certain problems that are easier to solve when expressed as self modifying code or a tower of objects, or low level bit bashing. At a certain level, different syntaxes do absolutely nothing for me. No matter what I'm doing with code, I am manipulating a syntax tree. I'm never thinking about the syntax on the page as the 'code,' what is on the page is just a representation of the 'code' that is in my head and being run by the computer. And the semantics of that 'code' is what influences how I use the language. Syntax on the page is almost a deception. Kind of an illusion that influences you into thinking about the code in a certain abstract way (a spatial 'on the page' arrangement of different parts), when really, the code was already abstract to begin with (runtime execution 'arrangement' of the different parts).