just a quick question. is the use of #missing_method kosher? should i be
happy to use it or should i try to avoid it?
···
–
~transami
just a quick question. is the use of #missing_method kosher? should i be
happy to use it or should i try to avoid it?
–
~transami
just a quick question. is the use of #missing_method kosher? should i be
happy to use it or should i try to avoid it?
It usually makes me happy when I use it – it’s quite kosher, IMO, makes
creating wrappers a piece of cake.
Chris
Hi –
On Fri, 26 Jul 2002, Tom Sawyer wrote:
just a quick question. is the use of #missing_method kosher? should i be
happy to use it or should i try to avoid it?
You’ll find that if you call #missing_method, it will be intercepted
by #method_missing
But, allowing for word inversion, I’ve never heard a case made for
avoiding it where it fits in to a design.
David
–
David Alan Black
home: dblack@candle.superlink.net
work: blackdav@shu.edu
Web: http://pirate.shu.edu/~blackdav
My advice would be to avoid using method_missing if you can achieve the
same result using “normal” Ruby constructs, and keep method_missing for
code that works at the meta-level.
Method_missing adds implicit control flow to your program that is not
easily discovered by reading the code. This makes it harder to
understand and maintain the code, and is a source of subtle bugs that
can be hard to track down.
But, if you are writing meta-level code, method_missing is a powerful
tool, and the easiest way of intercepting calls to arbitrary objects.
For example, the Test::Mock package uses method_missing to easily mock
the behaviour of arbitrary classes, and DRb uses method_missing to trap
method calls on local proxies and send them over the network to remote
objects. Method_missing makes this task very easy to implement.
Cheers,
Nat.
On Thu, 2002-07-25 at 20:08, Tom Sawyer wrote:
just a quick question. is the use of #missing_method kosher? should i be
happy to use it or should i try to avoid it?
–
Dr. Nathaniel Pryce, Technical Director, B13media Ltd.
Studio 3a, 22-24 Highbury Grove, London N5 2EA, UK
http://www.b13media.com
now that gave me a good chuckle! thanks.
On Thu, 2002-07-25 at 13:29, David Alan Black wrote:
You’ll find that if you call #missing_method, it will be intercepted
by #method_missing
–
~transami
I’ve never heard a case for avoiding goto where it fits into design.
Paul
On Fri, Jul 26, 2002 at 04:29:01AM +0900, David Alan Black wrote:
But, allowing for word inversion, I’ve never heard a case made for
avoiding it where it fits in to a design.
Hi –
But, allowing for word inversion, I’ve never heard a case made for
avoiding it where it fits in to a design.I’ve never heard a case for avoiding goto where it fits into design.
You want precision in language and logic? What are you, a computer
programmer?
OK, v2.0: I’ve never heard a case made for avoiding it on principle.
Note that I’m being cowardly and not making an actual case for not
avoiding it – just saying that, in reading discussions of it and
seeing cases where it’s been proposed as a solution, I don’t remember
its being dismissed as an inherently questionable technique.
(Can’t say that about goto
David
On Fri, 26 Jul 2002, Paul Brannan wrote:
On Fri, Jul 26, 2002 at 04:29:01AM +0900, David Alan Black wrote:
–
David Alan Black
home: dblack@candle.superlink.net
work: blackdav@shu.edu
Web: http://pirate.shu.edu/~blackdav