1. Re: Multiple includes

kbochert at copper.net wrote:

>>As it stands, the 'new include' technique would refer to a 
>>*local* instance only.  This means the included file acts
>>as a local resource similar to the way local variables work.
>>This should make it pretty easy to implement too.
>>
>>As noted before:
>>
>>--rect.ew
>>atom x1,y1,x2,y2
>>x1=0
>>y1=0
>>x2=0
>>y2=0
>>
>>
>>--file.exw
>>include new rect.ew as r1
>>include new rect.ew as r2
>>r1:x1=10
>>r1:y1=10
>>r2:x1=20
>>r2:y1=20
>>
>>
>>Here, each rect refers to a different set of x and y variables
>>even though only one include file was needed.  In other words,
>>we were able to use two different objects (rects in this case)
>>of the same type that needed to be described only once in
>>rect.ew .  This is also a powerful technique, considering the
>>original file can be extremely complex in itself but used
>>more then once for more then one object by simply declaring
>>it a second or more times taking up only one more line of code.
>>
>>Take care,
>>Al
>>    
>>
>Is this not just a subset of what even simple objects supply?
>
>--rect.ew
>class Rect 
>atom x1,y1,x2,y2
>x1=0
>y1=0
>x2=0
>y2=0
>end class
>
>
>--file.exw
>include rect.exw
>Rect r1, r2
>r1.x1=10
>r1.y1=10
>r2.x1=20
>r2.y1=20
>
>Karl Bochert
>  
>
Whoa! When did we get class types?

Can we do something like

class Rect
atom x1, x2, y1, y2

classfunction Resize(atom way, atom perc)
    if way = RECT_EXPAND_HORIZONTAL then
       x2 *= perc
    elsif way = RECT_EXPAND_VERTICAL then
       y2 *= perc
    else
       x2 *= perc
       y2 *= perc
    end if
end classfunction

end class

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu