Ask a Question related to Ruby, Design and Development.
-
ts #21
Re: Method wrapper question (was "stereotyping (was ...))
>>>>> "G" == Gavin Sinclair <gsinclair@soyabean.com.au> writes:
G> Do both the :pre method wrappers get executed? If so, in what order?
G> If not, which one does? And why not execute both?
I really hope that ruby will give an message (method redefined) : I don't
want to learn a new language and you have module to do what you want.
Guy Decoux
ts Guest
-
"stereotyping" (was: Strong Typing (Managing metadataabout attribute types) )
> In sean's case, class and/or module were sufficient to define To be fair, he goes beyond class/module model. The reason we tend to object to... -
"stereotyping" (was: Strong Typing (Managing metadataabout attribute types)
Simon, there is another way, the classes can be substantiated only on the remote end and all messages are routed to the remote object. the local... -
"stereotyping" (was: Strong Typing (Managing metadataabout attribute types)
Simon, yes, i understood that the first time. (sorry, i just spent a couple of hours reading through hugely verbose posts that tended toward... -
"stereotyping" (was: Strong Typing (Managing metadataabout attribute types)
On Thu, 2003-11-20 at 11:33, Weirich, James wrote: Well, you certainly captured my thoughts. That's exactly what I was suggesting with the... -
"stereotyping" (was: Strong Typing (Managing metadataabout attribute types)
Sean O'Dell writes: know it they Charles Hixson writes: Several people have said this, and although true, this is not my main concern... -
Gavin Sinclair #22
Re: Method wrapper question (was "stereotyping (was ...))
On Saturday, November 22, 2003, 11:47:50 PM, ts wrote:
G>> Do both the :pre method wrappers get executed? If so, in what order?>>>>>> "G" == Gavin Sinclair <gsinclair@soyabean.com.au> writes:
G>> If not, which one does? And why not execute both?
Well, I'm not sure what I want in this case. Wrapping methods is a> I really hope that ruby will give an message (method redefined) : I don't
> want to learn a new language and you have module to do what you want.
great idea to satisfy a common idiom. I think it does seem a bit
wrong not to allow multiple wrappers, though. The idiom as it stands
(alias method to something else, and call alias from redefined method)
can be used to wrap a method several times if desired.
What method are you talking about? Oh, aspectr I suppose.
Gavin
Gavin Sinclair Guest
-
ts #23
Re: Method wrapper question (was "stereotyping (was ...))
>>>>> "G" == Gavin Sinclair <gsinclair@soyabean.com.au> writes:
G> Well, I'm not sure what I want in this case. Wrapping methods is a
G> great idea to satisfy a common idiom. I think it does seem a bit
G> wrong not to allow multiple wrappers, though. The idiom as it stands
Perhaps in this case, you can also have multiple def in the same class :-)
G> What method are you talking about?
module B
def a:pre
end
end
class A
include B
def a:pre
end
def a
end
end
Guy Decoux
ts Guest
-
Charles Hixson #24
Re: "stereotyping" (was: Re: Strong Typing (Re: Managing metadataabout attribute types) )
Yukihiro Matsumoto wrote:
Perhaps one could make assertions about parameters / methods that could>Hi,
>
>In message "Re: "stereotyping" (was: Re: Strong Typing (Re: Managing metadata about attribute types) )"
> on 03/11/21, "Sean O'Dell" <sean@celsoft.com> writes:
>
>|This is, I think, the clearest I can make the new proposal tonight:
>|
>|[url]http://www.rubygarden.org/ruby?InterfaceContracts[/url]
>
>...
>
> matz.
>p.s.
>Please do not use bad words everyone.
>
be checked?
e.g.
class someclass < someOtherClass
assert .kind_of(someClass, Number)
def initialize (foo, bar)
assert.responds_to(foo, +)
assert.kind_of(bar, Number)
...
end
...
end
The only advantage I see of this over the normal responds_to? and
kind_of? is that it could be enabled or disabled by either a flag or by
a global variable ($DEBUG or possibly $ASSERT instead). assert
appears slightly special in that since it doesn't require any import
statement, it's probably added onto Object, and also I notice that the
"+" operator was considered as a normal method without being attached to
any variable (and methods would need to be able to go there too).
Perhaps that argument should be quoted?
This clearly doesn't answer all of the requirements, but it does answer
some of them, and might assist in debugging. (And it appears to me that
it would be simple for someone who understood Ruby better than I do to
implement.) Clearly if this were to be intended as a serious checking
tool it would need expansion, e.g. one would want a way to test that "+"
could take either one or two arguments, and that those arguments could
be numbers. A benefit of this approach is that it could probably be
bolted on without any change to the interpreter itself (at least until
it was decided to implement interpreter flags).
Charles Hixson Guest



Reply With Quote

