14 ms·
> Ruby takes full advantage of the Lisp chainsaw. I always get a little sad and slightly irritated when I hear people say things like this. This is a statement
by KirinDave 17y ago
> Ruby takes full advantage of the Lisp chainsaw.
I always get a little sad and slightly irritated when I hear people say things like this. This is a statement born from ignorance and misunderstanding.
What ruby does to present micro-DSLs are what any language that lets the programmer influence the scope of single dispatch and has a lightweight syntax for function calls can do. They are not what Lisp macros do, and do not even approach all the common "easy" uses cases for macros. Further, they also incur a much larger runtime performance penalty, whereas macros incur none.
Ruby has so many merits on its own. There is no need to drum up nonsense about how it's a "lisp without the parenthesis".
- showell 17y agoYou might be taking the statement out of context, and you are certainly quoting it out of context (although brevity is appreciated.) The statement in the talk was made to illustrate the differences between Ruby and Python, and it was not made to suggest that Ruby was replicating all the benefits of Lisp.
- deleted 17y ago[deleted]
- KirinDave 17y agoI understand the intent, but I do not feel that it loses its incorrectness by taking it out of context. That people even feel this comparison is appropriate is what has me depressed. It represents a fairly fundamental set of misunderstandings.
- chromatic 17y ago> That people even feel this comparison is appropriate is what has me depressed. I agree; you can replace the term "DSL" with "API" in almost every case without losing any essential meaning. (You have to give the hipper-than-thou language pseudo-advocacy, but that's no loss.)
- mjw 17y agoI think in those contexts, DSL is more a description of how an API feels to use, than a precise technical categorisation.` Ergonomic distinctions are useful though, as is the distinction between declarative-style APIs and more imperative ones, which 'DSL' is often used to make.
- kscaldef 17y agoI have yet to see a Ruby "DSL" that didn't feel like Ruby. That is, unless you.talk :like => "this"
- kemiller 17y agoThose are just the "english-y" DSLs. Not all are attempting to read like english. And even for those that are, the point isn't to be writing in english, the point is to be at least halfway readable to a non-programmer reading over your shoulder.
- kscaldef 17y agoOkay, but it's not really all that clear that "sum.should == 3" is actually any more readable than "assert(sum == 3)". (Do you really have non-programmers reading code over your shoulder? I can't think of any case in a 10+ year career where that's happened.)
- kemiller 17y agoI don't personally use the stuff. :) But I have seen environments where that does happen, and it works pretty well for them. If you're not doing that, I think they're kind of silly.
- chromatic 17y ago> ... the point is to be at least halfway readable to a non-programmer reading over your shoulder. That's the same argument for filing the serial number off of TDD and calling it BDD: sometime, somewhere, somehow eventually some non-programmer is going to have to maintain source code without a trained professional programmer around to help. I don't get it; FIT's been around much, much longer. What kind of non-developer business rule expert can read the punctuation-sprinkled pseudo-English pidgin Ruby spreads around but doesn't know how to manipulate tabular data in a spreadsheet?
- _pius 17y agoThey are not what Lisp macros do. True. What ruby does to present micro-DSLs are what any language that lets the programmer influence the scope of single dispatch and has a lightweight syntax for function calls can do. They are not what Lisp macros do, and do not even approach all the common "easy" uses cases for macros. Further, they also incur a much larger runtime performance penalty, whereas macros incur none. I think that part of the problem is that no one (whom I've seen, at least) has explained in a brief, easy to follow manner just what the Lisp macros get you beyond all of the parse tree manipulation, code generation, and "metaprogramming" you can already do with Ruby. If you could explain the extra benefit succinctly, I'd love to hear it. In other words, I'd love to see an essay or blog post that makes me wish Ruby had true, Lisp-style macros. Performance, by the way, won't be enough: language implementations are always getting better.
- KirinDave 17y ago> I think that part of the problem is that no one (whom I've seen, at least) has explained in a brief, easy to follow manner just what the Lisp macros get you beyond all of the parse tree manipulation, code generation, and "metaprogramming" you can already do with Ruby. Uh, the stuff you can do with ruby (short of the Ruby2Ruby parse tree generation) is incredibly limited compared to the arbitrary transforms that macros, especially tools like macrolet (lexically scoped macros) and symbol-macrolet (lexically scoped symbol expansion) allow you to do. Ruby2Ruby lets you do almost arbitrary parse tree transforms, but again it does this at runtime. Unless you specifically architect your program in a somewhat non-rubyish fashion to have a sort of "compile" phase where your transforms are completed. > Performance, by the way, won't be enough: language implementations are always getting better. ... I say this as a fan of ruby who's made a career out of it for years. Ruby's performance improvements move at a snail's pace. If someone said, "Hey, you can do everything Ruby2Ruby can do, but with 0 performance penalty" then that'd be a huge value add. If you say it isn't, you're being unreasonable. "It is fast enough" is a mantra you can foist off on people who haven't put up production systems on a Merb stack.
- _pius 17y agoYou're missing the point. Nothing in your sarcastic "Uh ..." missive makes me or anyone else care about the features you just named. Yes, I know Ruby doesn't have True Lisp Macros. The point is, why should I care? What real-world problem can I not solve elegantly in Ruby because it lacks this language feature? "It is fast enough" is a mantra you can foist off on people who haven't put up production systems on a Merb stack. Well, seeing as how I have deployed Merb in production as well, maybe we can discuss the merits without trying to measure egos based on who's deployed what? Again, my point is that if you can't name a single real world benefit of macros over what's already in Ruby, then why should anyone care how fast they are?