Live data from Hacker News

What Pythonistas Think of Ruby

blog.peepcode.com

181–190 of 247 posts

Re: What Pythonistas Think of Ruby

#181

> 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 d…

They 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.

Re: What Pythonistas Think of Ruby

#182
post #171

Earlier quoted context omitted.

> 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.)

I 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.

I have yet to see a Ruby "DSL" that didn't feel like Ruby. That is,

  unless you.talk :like => "this"

Re: What Pythonistas Think of Ruby

#183
post #169
post #45

Earlier quoted context omitted.

I'm not sure I get the lambda issue. If you want a > 1 line lambda why not just define a function? def a(x): def b(): print x return b Not sure what a prototypical ruby usecase would be.

The prototypical ruby case would be: def some_method(x, &block) yield x end then to call it: some_method "hey" { |v| print v } That might not look like much, but it allows you to create methods that can extend the language expressively and then use them without extra crufty syntax or sigils obstructing their meaning.

> some_method "hey" { |v| print v }

I'm sure ruby is great once you're initiated, but despite >10 years of programming and having learned basic, c, pascal, lisp, java, c++, python, perl, bash, php and javascript, I have no idea what code does.

Don't mean to harsh, just an observation.

Re: What Pythonistas Think of Ruby

#184
post #170
post #81

Earlier quoted context omitted.

Sayer's Law: "In any dispute the intensity of feeling is inversely proportional to the value of the stakes at issue." http://en.wikipedia.org/wiki/Sayre%27s_Law Special case in programming -- "colour of the bikeshed" http://en.wikipedia.org/wiki/Parkinson%27s_Law_of_Triviality

Offtopic question: where can I get a hierarchical category/index/guideline to many of these * laws ? I'd like to quotes these cool stuff as well, just need a way to look it up :)

This is pretty close to what you're looking for, I think: http://en.wikipedia.org/wiki/Category:Adages

Re: What Pythonistas Think of Ruby

#185
post #171

Earlier quoted context omitted.

I 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.

I have yet to see a Ruby "DSL" that didn't feel like Ruby. That is, unless you.talk :like => "this"

Those 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.

Re: What Pythonistas Think of Ruby

#187
post #66
post #6

Earlier quoted context omitted.

proc[arg1,arg2] is terrible; strictly worse than proc.call arg1, arg2. When I see an id followed by brackets, I'm looking at a collection, not a callable. This is only exacerbated by Ruby's weird/useful [index,length] convention.

I think what we both want is proc(arg1, arg2).

In newer versions of Ruby you can do proc.(arg1, arg2), which I think is a decent compromise.

Re: What Pythonistas Think of Ruby

#188

Earlier quoted context omitted.

I have yet to see a Ruby "DSL" that didn't feel like Ruby. That is, unless you.talk :like => "this"

Those 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.

Okay, 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.)

Re: What Pythonistas Think of Ruby

#189
post #6
post #4

It's not self.call(:my_method) --- that's nuts. It's my_method[param1, param2] which is aliased to my_method.call(param1, param2). Ruby's syntax can be a crapfest (like Procs not being callable without [] instead of () for example), but this isn't an example.

proc[arg1,arg2] is terrible; strictly worse than proc.call arg1, arg2. When I see an id followed by brackets, I'm looking at a collection, not a callable. This is only exacerbated by Ruby's weird/useful [index,length] convention.

Wow, I actually never knew that it was [index, length]. I usually just pass a range as the key when I'm doing stuff like that, so you can do "hello"[2..3] (2 <= i <= 3) or "hello"[2...3] (2 <= i < 3).

Re: What Pythonistas Think of Ruby

#190
post #50

Earlier quoted context omitted.

I have the definitive impression that the Pythonistas are more interested in this fighting than most other language cultures. I might be wrong, but I really can't mention any other group of people trolling Perl discussions. It is the same for Ruby? It really seems strange for a language which got the name from Monthy Python. (-: Is it some inferiority feelings to environments which are fun ? :-)

I might be wrong, but I really can't mention any other group of people trolling Perl discussions. Everyone is out trolling the Perl discussions. PHP developers hate us, Java developers hate us, Ruby developers hate us, and Python developers hate us. I think this is funny, because we generally don't hate the other languages, we just embrace and extend their good ideas for Perl. (The Perl community has come up with a f…

> Moose is from Smalltalk and CL...

... and Perl 6.

Post reply on HN