Ian Bicking: the old part of his blog

unit/test

Is there anything special about unit/test? We all have unit testing libraries; they are important, but I'm leaving out lots of important things that don't distinguish one language from the other.

Re: modification of base classes. I imagine modification of Object could be necessary at times. This is the flip side of Python's magic methods -- where you can build defaults and other rules into the function that then optionally calls magic methods, in Ruby (presumably?) you would create an implementation in Object that gets specialized as necessary. That's certainly the norm in Smalltalk, though I think there are some serious reason's to be concerned by how that effects the larger process and the many users of Object. From the opposite end CLOS handles the same thing with generic functions, with substantially better decoupling; in Python people are pushing in that direction with adaptation and generic functions, though that kind of development is not the form.

Along these lines, the experimental Javascript 2.0 spec adds namespaces to methods, mitigating the issues of adding methods to other classes. An interesting way to address the problem.

Comment on Re: Ruby, Python, "Power"
by Ian Bicking

Comments:

Disclaimer: Read this post with the knowledge that I really only know enough about Ruby to be dangerous.

Hmm, no I don't think there's anything particularly standout about test/unit. I just really REALLY like unit testing and I think I didn't understand what you meant about notable libraries.

Oh, actually, now that I think about it, optparse is pretty sweet and I've never really seen anything like it other languages I've used (though I'm not really up on Python, so it may have something similar) RDoc here: http://www.ruby-doc.org/stdlib/libdoc/optparse/rdoc/index.html

Back to Object mods: Well, you know, it's not too hard to do change localization in Object with the alias method. Like:

alias :meth, :old_meth

def meth
 ...
end

and then when you're done with being a clever bugger:

alias :old_meth, :meth and Bob's your Uncle, back to normal.

Not sure what you're talking about with CLOS and adaptation and generic functions or JavaScript 2.0 as I'm not up on that (in fact, I'm probablly not in a position to be talking about language features at all as it's certainly not my specialty).

I don't think popping Object open and changing it around is the flip side of Python Magic Methods though. Read the following section with the knowledge that I am no Ruby expert and know only of Python from mythical tales of its courage in battle:

From what I've used of Ruby, it would seem that the actual flip side of Python "magic methods" is just using some standard method names, like "to_s" or "each" that behave like they should for the Object they're inside of. I think the "magic" is typically accomplished with mixins, Enumerable being the example used in the Pickaxe where you define "each" to get a bunch of the iterators and "<=>" if you want the rest (I think defining "<=>" and including Enum also gives you Comparable, but you might need to add it explicitly) and then if you want a special version of one of the methods the mixin adds, you just go ahead and change it.

I'm gonna shut up now because if I keep talking, I'm probablly going to misrepresent something and start a flamewar.

# Danno

Oh, actually, now that I think about it, optparse is pretty sweet and I've never really seen anything like it other languages I've used (though I'm not really up on Python, so it may have something similar).

http://docs.python.org/lib/module-optparse.html -- need I say more? optparse existed in Python under name of Optik since 2001: http://optik.sourceforge.net/ and given apparent similarities in API, I even doubt whether Ruby one is clone of Python one...

# Seo Sanghyeon