Inheritance in Revolution?

Arthur Urban aturban at qwest.net
Fri Sep 10 03:36:21 EDT 2004


Because that solution divorces the object from it's code and data. I do use
"libraries", but only for stand-alone functions that are clearly not object
behaviours.

I've discovered that I'm not really talking about inheritance here, but more
class instantiation. Revolution only embraces the thought that every object
is an instantiation of a single base class implementing a singleton pattern.
I'd like to be able to declare a single object as a "class" from which I can
instantiate multiple copies of it wherever I need them.

I think some of the workarounds are genuinely clever, but a poor substitute
actual "classes". I don't need Rev to be a true OOL, I just think script
sharing sounds very cool. In the mean time, I might as well go at the
"library" approach. Is there any limit to the number of back scripts I can
have? Is there a certain number after which my program might start to bog
down?

> Why not just create a library and 'start using' it? Then you could do 
> something like:
> 
> on mouseUp
>     if the myCustomPropFavoriteColor of btn "xyz" is "blue" then
>        do stuff etc...
>     end if
>     pass mouseUp
> end mouseUp
> 
> Now, all you need to do is create a custom property of the 
> control you 
> wish to handle and you've effectively done what it is you want.
> 
> I use this technique all the time. You could also use this as a 
> FrontScript as well, though the library method is 'cleaner.'
> 
> -Chipp
> 
> Arthur Urban wrote:
> 
> > I probably wasn't as clear as I could have been. These 50 
> buttons all 
> > live on different cards, different sub-stacks, etc. Think of this 
> > ability as one might approach a Password Field. You'd write 
> the clever 
> > text hiding code in the field's script, and then maybe use 
> this field 
> > in two or three different locations. When you discover that 
> bug, you 
> > just change the master script, and no matter where the 
> other buttons 
> > happen to be, they gain the benefit of the fix without extra 
> > copy/paste efforts.
> > 
> > This is probably too cool a feature to ever actually see, but I can 
> > hope. What do the Rev Developers think? Wouldn't this add a 
> tremendous 
> > level of code (and object) reusability, not to mention data/code 
> > encapsulation?
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com 
> http://lists.runrev.com/mailman/listinfo/use-> revolution
> 



More information about the use-livecode mailing list