r/programming • • Aug 30 '08

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

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

122 comments sorted by

View all comments

Show parent comment

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.