Re: Keywords and Namesapces

new topic     » goto parent     » topic index » view thread      » older message » newer message

Matt says: “The difficulty is in mapping object oriented C plus plus code to procedural C and Euphoria.”
I say: Please continue doing what you are doing there. I am not suggesting any change there.
Matt says: “My understanding of Vinoba's proposal is to add an integer parameter to distinguish the target class.”
My proposal is to add an integer parameter to simply combine 2-8 functions as one function. In its simplest form, you have in the file “wxFlexGridSizer”, the following two functions:- (Notice I use the word “file” not “Class”)

add_growable_col ( atom sizer, atom idx, atom proportion )  
-- (Link: #ADD_GROWABLE_COL)   
add_growable_row ( atom sizer, atom idx, atom proportion ) 
-- (Link: #ADD_GROWABLE_ROW)  

I/we noticed that both the functions have the same three parameters, viz.
atom sizer
atom idx
atom proportion

So we create a new function with the same parameters and add one more parameter “integer colrow” and remove the words “row” and “col” from the two names.

add_growable (Link: #ADD_GROWABLE)( atom sizer, atom idx, atom proportion, integer colrow ) 
-- colrow: 1=col, 2=row    
-- Here I have arbitrarily defined variable “colrow” to mean col if its value is 1  
-- and row if its value is 2.  
-- If the methodology is adopted, we must try and use the same values for rows and columns throughout. 

Then we define in a new wxeudex.e, where all these changes will be accommodated.

include wxeud.e 
-- 
public constant newpara_error = 9999 
-- 
public function add_growable ()( atom sizer, atom idx, atom proportion, integer colrow ) 
    if (colrow < 1) or (colrow > 2) then 
       return newpara_error  
--  We retun an error.  Error No 9999 has been defined as a universal error number for the new work. 
-- 
    end if 
 
    if colrow = 1 then 
       add_growable_col (  sizer, idx,  proportion )    
    end if 
 
    if colrow=2 then 
       add_growable_row (  sizer, idx,  proportion )    
    end if 
    return colrow  
-- since these were originally "procedures" in wxeud.e, and we want to use them as functions,  
-- we return something. 
-- we could return the atom sizer, or anything else if that is likely to be more useful  
-- for becoming an argument (parameter) to the next function. 
 
end function   

No major change to the existing work.
In fact, the existing functions "add_growable_col" and "add_growable_row" remain usable till finally deprecated.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu