From: Robert Klemme Date: 2004-07-19T19:12:08+09:00 Subject: Re: ruby idiom for parsing function arguments? "zuzu" schrieb im Newsbeitrag news:a988e9f604071901151d11aaf0@mail.gmail.com... > On Mon, 19 Jul 2004 16:52:08 +0900, Robert Klemme wrote: > > > > "zuzu" schrieb im Newsbeitrag > > news:a988e9f604071816245a8892af@mail.gmail.com... > > > > > 2.) i would like to clarify, that this is not necessarily for reading > > > ruby, the interpreter, or chmod +x .rb files, shell command lines. > > > this should apply to any function/method's arguments; as in > > > object.method(arg1, arg2, arg3). > > > > What exactly do you want to do? I mean, you don't have to parse method > > arguments since that is taken care of by Ruby. > > > > Btw: see also "Duck Typing". > > > > Regards > > > > robert > > word. http://c2.com/cgi/wiki?DuckTyping > my initial impression of "duck typing" was equivalent to dynamic > typing, but there seems to be a little more to the mallard definition. > i would appreciate an example of code demonstrating how to introspect > a "hey, what kind of object are you?" message/method. You don't with Duck Typing. Instead you just invoke the method and get bitten by an exception if it's not there. > i'm looking to extend ruby to the actor/dataflow model where instead > of "everything is an object", "everything is an actor". as an > intended side-effect, this should encourage runtime > introspection/reflection and concurrency/parallelization in > programming. What does actor/dataflow have to do with introspection? I'd regard these as completely orthogonal. > so specifically, if i'm randomly (according to the scheduler) passing > an object/actor dataflow and options as arguments, i would like a > "behaviour script" to successfully differentiate them introspectively > rather than explicitly (by the programmer). Why then don't you just require an actor to implemente a method like "def act(*args, &block)"? That's the easiest and most appropriate way to differentiate object behavior according to its type (see Polymorphism). Regards robert