Re: Pass by Reference

new topic     » goto parent     » topic index » view thread      » older message » newer message
jimcbrown said...

As I recall, eumem was written explicitly for this use case.

Thanks, Jim.

You could be right, but the documentation is entirely opaque to me. It looks like it's doing something roughly equivalent to declaring a globally visible heap. If that's the case, how is it much different from:

global sequence GLOBAL_MEMORY = {} 
 
-- get the next handle (index) to the global sequence 
global function malloc() 
    GLOBAL_MEMORY &= 0 
    return length(GLOBAL_MEMORY) 
end function 
 
-- get the value stored in the global sequence 
global function get(integer index) 
    return GLOBAL_MEMORY[index] 
end function 
 
-- set a value stored in a global sequence 
global procedure set(integer index, object value) 
    GLOBAL_MEMORY[index] = value 
end procedure 

But it doesn't answer the question why OpenEuphoria support pass by reference.

- David

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

Search



Quick Links

User menu

Not signed in.

Misc Menu