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

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.