Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: lib for optional static typing
Eivind Eklund
12/12/2005 4:13:00 PM
On 12/5/05, robertj <robert_kuzelj@yahoo.com> wrote:
> is there any lib where i could emulate attributes on methods
> like there are some libs already now for python 2.4
>
> @params(String, String)
> @return(String)
> def concat(_key1, _key2):
> return _key1 + _key2
>
> that is something that allows for defining the parameters
> and the return type and the corresponding checks at runtime.
>
> i thought i have seen something like that for ruby sometime and
> somewhere but i can not find it anymore (or maybe i had simply
> visions)
I've got an implementation that works more or less like that available
at
http://people.freebsd.org/~eivind/r...
It also allows more complicated declarations (respond_to checks,
conditional series of parameters, handling of repeats, etc, etc).
If you find ways to use this that turn out to actually be an advantage
in practice, I'd appreciate a mail describing your use. When I tried
to use it with the way I program, I found that it didn't catch errors
any earlier than I'd get them from MethodMissing anyway, and that it
got in the way of my refactoring. That doesn't mean it couldn't be
useful for somebody else, of course.
Eivind.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: lib for optional static typing
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password