r/programming • • Aug 30 '08

Tour De Babel -- Rant about programming languages (at Amazon)

http://steve.yegge.googlepages.com/tour-de-babel
13 Upvotes

122 comments sorted by

View all comments

Show parent comment

6

u/jmhodges Aug 31 '08

mcantelon, that ^ pretty much. It sounds weird, because it is weird when you first run into it. It's a bit different than passing functions around (even anonymous ones in functional languages) because the syntax to do this.. feels different.. cleaner. It's hard to explain, but when you see it and grok it, its a very nice way of seeing a problem in a simpler, easier to understand way.

Oh, and everything is an object and really, really an object and holy christ is it awesome not to have to pass self around everywhere. And modules rock.

I should note that I still like python. Ruby just has some things that are nifty that python doesn't.

5

u/ubernostrum Aug 31 '08 edited Aug 31 '08

Oh, and everything is an object and really, really an object

Just like Python, you mean?

Edit: and... what? I get downmodded for pointing out that the same is true in Python? Show me something in Python that isn't an object, then.

3

u/shen Aug 31 '08

I know that Python uses objects for everything, but the difference here is that Ruby consistently uses object-oriented syntax, while Python doesn't (list comprehensions, blocks instead of loops, a few sticking-out functions like len, for example).

2

u/ubernostrum Aug 31 '08 edited Aug 31 '08

And that's not the same thing at all. There's a big difference between saying, say, that Ruby uses message-passing syntax everywhere and Python doesn't use method-calling syntax everywhere (almost true about Ruby, true about Python -- there are situations where Ruby doesn't use consistent syntax) and saying, say, that in Ruby everything is an object and implying that in Python not everything is an object (which is false).

3

u/shen Aug 31 '08

I know that. I'm just saying that people generally mean the former when they say the latter.

1

u/ubernostrum Aug 31 '08

People should say what they mean instead of casting about dangerously-incorrect statements.

3

u/[deleted] Aug 31 '08

print

1

u/Leonidas_from_XIV Aug 31 '08

Won't be in Python 3.0, your complaint is ages old and has been heard by the developers.

3

u/[deleted] Aug 31 '08

I was answering a question, not complaining.

1

u/Smallpaul Sep 01 '08

Keywords are not objects in Python. Nor are they are in Ruby. Ruby has more keywords than Python.

3

u/[deleted] Aug 31 '08 edited Aug 31 '08

+ ?

5

u/ubernostrum Aug 31 '08 edited Aug 31 '08

That operator delegates to the __add()__ method of its left-hand operand; a + b is literally the same as a.__add__(b), just with nicer syntax. And unless I'm mistaken, Ruby has no standalone, built-in object named "+" (instead using it as syntax to delegate to a method call, just like Python), so if this is an argument against Python it's one against Ruby as well.

1

u/[deleted] Aug 31 '08 edited Aug 31 '08

I know it delegates to the __add()__ method of its left-hand operand. It's not an object though (or is it? to be honest, I don't know python internals well enough to know. It seems like it's just a symbol-table entry to me)

In the case that I am mistaken, what about def, or a comment? There's tons of stuff in python that aren't objects. If keywords and comments are objects in python, why can't I treat them like objects? Or can I?

3

u/ubernostrum Aug 31 '08

OK, then, as long as you're willing to make exactly the same critique of Ruby (i.e., that some syntactic elements are not in fact objects), I'm OK with that.

Typically what I think when I hear "everything is an object", though, is that everything a program will be accessing or manipulating at runtime is an object, not that every byte in the source code file ultimately corresponds to some object in the program at runtime, and I think that's much more in line with what people mean when they use that phrase (because, honestly, by the line of reasoning you're taking you wouldn't even be able to say "everything" in Smalltalk is an object, which would be absurd).

2

u/[deleted] Aug 31 '08

I would make the same critique of Ruby if someone asked me to show them something in Ruby that wasn't an object. (I code mainly in Python at this point in time)

I agree with the second paragraph of your comment, although part of me doesn't think that people should be saying "everything is an object", unless "object" is the one base thing that everything is derived from in the language specs.

Squeak, which is the only smalltalk implementation I'm even remotely familiar with, seems to come awfully close to having everything that the programmer interacts with being an object (unless, presumably, they're working on squeak outside of squeak) - but I could be sorely mistaken about that.

Lisp (specifically CL) would be another similar example - not of everything being an object, but of everything being definable through a very few simple abstractions.

-4

u/vagif Aug 31 '08

You should try lisp macros. Same thing syntaxically, only much better than Ruby's blocks, much more powerfull too.