F. Senault
7/23/2006 11:06:00 PM
Le 23 juillet 2006 à 20:43, transfire@gmail.com a écrit :
> Well, I guess the question is: how does one insert code later? If you
> just have to redine it as one does now, why bother, just use raise
> "dude, where's my code!". OTOH, if there some mean by which one inject
> code into these locations, well, the use of this would be more
> interesting. But I'm not sure how that's done if all you has to go on
> is '...'. Also, implemenation might prove a little hairy.
Well, I'm sure it's possible to do something that would react like
this :
class Foo
abstract :bar, :baz
end
class Quux < Foo
def bar()
puts "Hello."
end
end
q = Quux.new()
q.bar
=> "Hello"
q.baz
=> exception "Baz must be implemented in child."
Now, is that useful, pretty, ruby'ish, and whatever, I don't know.
And it's limited to methods (and / or accessors ?).
Fred
--
If there were no desire to heal
The damaged and broken met along
This tedious path I've chosen here
I certainly would've walked away by now. (Tool, The Patient)