Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Programming IT Technology

Lisp and Ruby 336

sdelmont writes "The developers of Rubinius, an experimental Ruby interpreter inspired by SmallTalk, have been discussing the possibility of adding a Lisp dialect to their VM. Pat Eyler collected some ideas and opinions from the people involved and it makes for some interesting reading. For many, Ruby already is an acceptable Lisp, and the language itself started as a 'perlification' of Lisp (even Matz says so) so it is perhaps fitting and might help explain why the whole idea feels right. Now, if someone added support for VB and gave it the respect it deserves, the world would be a better place."
This discussion has been archived. No new comments can be posted.

Lisp and Ruby

Comments Filter:
  • by oohshiny ( 998054 ) on Sunday January 14, 2007 @10:24AM (#17602130)
    If you're gonna have a "Ruby inspired by Smalltalk", why not be done with it and give it Smalltalk syntax as well? Smalltalk syntax is great: very readable, very simple. And with Objective C, it has enjoyed some resurgence.
  • by morgan_greywolf ( 835522 ) on Sunday January 14, 2007 @10:24AM (#17602132) Homepage Journal
    Having perl as it is, what are the reasons to take a look at ruby. Mind you, I am not saying that these reasons do not exist, I guess I was just lazy to find it out by myself and then again, nobody has yet offered any compelling reason. I have taken a good look at ruby, clean syntax and all, but really I couldn't find something really compelling.


    Having Perl as it is, what are the reasons to take a look at Python? Having Python as it is, what are the reasons to take a look Ruby? Having Ruby as it is, what the reasons to take a look at Perl? Having Python as it is, what are the reasons to take a look at Perl?

    Because they're different languages with different strengths and weaknesses. Just as Lisp and Ruby are different, and Python and Perl are different, so is Perl and Ruby.

    A good staring point for you would be to read this article differentiating Perl and Ruby [ruby-lang.org]. Working back from that description, if you have experience in programming in languages other than Perl, you should be able to figure out what the advantages are of Ruby over Perl and vice-versa.
  • by Wolfbone ( 668810 ) on Sunday January 14, 2007 @10:28AM (#17602152)

    "I mean, take Lisp and its performance. Compare it to Ruby's."

    Which Lisp? One which (as most implementations of Common Lisp do these days) appropriately and reasonably gets compared to the output of a C compiler?:

    http://www.lrde.epita.fr/cgi-bin/twiki/view/Public ations/200606-IMECS [epita.fr]

    I wouldn't have thought that would be a very fair comparison to make for Ruby.

  • by Jonathan ( 5011 ) on Sunday January 14, 2007 @10:30AM (#17602172) Homepage
    1) Object Orientation is consistent throughout the language. Perl provides ways to make objects, but none of the built in functions or datatypes are objects, making your code a schizophrenic mess of objects and non-objects.

    2) Consistency -- In Perl it is needlessly difficult to do ever simple tasks like making arrays of arrays or arrays of hashes -- you have use a weird syntax to get at references. I never could remember it and always had to look it up whenever I needed an array of arrays in Perl. In Ruby, everything is a reference to an object so you don't have to worry about it -- a[0] = [1, 2] does exactly what you want -- puts an array [1, 2] in the first element of array a.

    I used to be a big Perl fanboy -- I did most of my programming in Perl from 1992-1999. But when I discovered Ruby I went for it and never looked back. What's cool about it is that its syntax is so clean that it is basically a version of the pseudocode I have in my head. In the Ruby community there's a phrase for it -- "the principle of least surprise" -- things just work.

    Obviously, if you really like Perl, nothing is going to make you change. But if you are just keeping with Perl because of inertia, then you ought to look around at other scripting languages. Ruby is my favorite, but most modern scripting languages are cleaner than Perl.

  • by kruhft ( 323362 ) on Sunday January 14, 2007 @12:05PM (#17602890) Homepage Journal
    Lisp is the oldest, still in use, high level programming that exists today. It's the core of emacs, and was standardized into Common Lisp in the early 90's. It basically has no syntax other than words and nested parenthesis (() :-), has an extrememly powerful macro system, and a loyal following of elders that hang out in comp.lang.lisp on usenet. As well, the great Emacs is basically a lisp interpreter (or Operating System) that happens to have a text editor above it.

    Smalltalk is another high level language where everything is an object. It has syntax, supports many interesting high level concepts like persistance, and has some nice development environments and pseudo OS projects, one of which is called Squeak.

    Ruby is a newer high level language from Japan, that was designed to combine the high level concepts of Lisp, but added some syntax to reduce code verbosity and increase expressiveness. The Lispnicks say this is unnecessary complexity that reduces the power of the language; people that were raised on languages with syntax find the expressiveness more familiar, easy to use and powerful.

    I'm still undecided.
  • by pivo ( 11957 ) on Sunday January 14, 2007 @01:03PM (#17603332)
    I suggest you forget about Lambda calculus and learn Lisp just like you'd learn any other programming language. Peter Seibel has made his excellent, non-migraine-inducing book "Practical Common Lisp" available for free on like at http://www.gigamonkeys.com/book/ [gigamonkeys.com] He leads you through building a streaming MP3 server in Lisp, which is quite fun.
  • rails is not ruby (Score:2, Informative)

    by Generic Player ( 1014797 ) on Sunday January 14, 2007 @01:04PM (#17603346)
    "Download a copy of InstantRails and take 60 minutes to create your own full blown webapplication."

    No, make a dinky little toy web app. Even DHH himself doesn't use such blatent exagerations to push rails. Yes its faster than coding everything from scratch, no it is not magic and you can't write anything non-trivial with it in 60 minutes. Do you seriously think anyone anywhere would be using anything but rails if it actually offered a 100x development speed improvement?

    "If you think you can do faster and better in Perl, I bow to you mighty Perl God."

    Catalyst is for perl what rails is for ruby. There's no need to switch to ruby just to get a web framework.

    He asked why to switch to ruby from perl, and you basically ignored ruby altogether and talked about rails. He never even mentioned if he even does web development, how would rails help him if he doesn't do DB driven web development? Ruby itself doesn't offer much over perl, basically just cleaner OO support. If you are already used to perl then I don't think it makes any sense to switch. If you do DB driven web dev and would benefit from rails, then it still makes more sense to stick with perl and just use catalyst (or maypole for trivial 60 minute type stuff) than to switch to ruby just for rails.
  • by Anonymous Coward on Sunday January 14, 2007 @01:33PM (#17603590)
    And 0 being true is the least surprising behaviour, now?

    That's something I like. Coupled with the facts that a method can return any type, and everything is an expression, allows you to do things like:

    if x = goDoSomethingThatReturnsAnIntegerOrFalse()

    In C you'd have to write something like

    if( (x=goDoSomethingThatReturnsAnIntegerOrAMagicNumber ()) != MAGIC_NUMBER_THAT_SURELY_WILL_NEVER_COME_UP_OTHERW ISE)

  • by plopez ( 54068 ) on Sunday January 14, 2007 @01:51PM (#17603772) Journal
    I beg to differ. I have done VB and found for many purposes Perl is faster, cleaner and easier than VB. Python too is better than VB, and also supports win32 api. As does Ruby (I am currently switching over though I still use Perl as I am very fluent in it). Add in an IDE such as Eclipse or Komodo, and you can do perfectly fine desktop or web apps rapidly.

    is still alive though not supported my Microsoft (VB6).

    I think you meant 'by' not 'my', a typo (it happens to all of us).

    But there's the rub. You never know when MS is going to pull the rug out from under you. Right now its .Net, 3 years from now it could be 'Microsoft McFoo'. OSS languages seem to be more consistent and incremental in thier changes. Major changes changes tend to occur only after much debate and input from the entire community, not just an arbitrary decision by a few marketing types.

    VB6 was horribly crippled. No good object support, reflection, etc. Nothing that made it better than COBOL. .Net was actually the best thing that happened to VB.

  • by Anonymous Coward on Sunday January 14, 2007 @04:36PM (#17605432)
    the reason is not-invented-here syndrome or a strawman argument against Unicode's ideograph system.

    Asians complain about having to share codepoints for characters (see Han Unification). A lot of people think the whining is mostly racist in nature; however, there are a few legitimate complaints in there, for instance many characters that Han Unification forced to share codepoints actually have different glyphs depending on which language it's written in, even if they all shared a similar source. Unicode's official stance is that the application should identify the language being used and select the correct glyph for that particular character from a font designed for that language (which basically makes it impossible to create a single definitive Unicode font). Explanation of both the glyph problem and the not-invented-here issues here [wikipedia.org]. More on glyphs [kaist.ac.kr].

    As for the "major encodings" currently in use, Shift-JIS was basically forced onto them by Microsoft who took their existing JIS encoding (based on ISO-2022) and broke it. There's about 1000 [google.com] websites of people telling the world just what they thought of that, yet not-invented-here or not, the Shift-JIS system sucks. Consider the fact that it uses two separate non-contiguous sets of codepoints (compare graphs of the non-unicode encodings here [lfw.org].

    It's easy to say "not-invented-here", it's harder to admit that the foreigners had no clue what they were doing and broke it :P

    it could just be a vocal minority

    Of course it's a vocal minority, the majority just want their computers to work.

"Spock, did you see the looks on their faces?" "Yes, Captain, a sort of vacant contentment."

Working...