il Mon, 19 Jul 2004 17:15:47 +0900, zuzu <sean.zuzu / gmail.com> ha scritto:: > >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. look in the archives of the group for exact definition. I think the definition is quite non strong :) anyway: >> 10.class => Fixnum >> 10.is_a?Integer => true >> (10..2).kind_of?Enumerable => true >> (10..2).is_a?Enumerable => true >> 10.respond_to? '+' => true ypou can use the StrongTyping and types.rb modules to have signature based dispatch and stuff like that. >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. > >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). this sounds good at the first time but it's not really, imho. the programmer does not have many advantage from this: MyClass.new 10 MyClass.new '1' over this: MyClass.from_int 10 MyClass.from_str '1'