Re: Forward referencing

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

Greg Haberek wrote:
> 
> ChrisBurch3 wrote:
> > 
> > Hi
> > 
> > How much of a problem would it be to re introduce the bug that Rob squashed
> > a 
> > few years ago for eu 4 - ie calling functions and procedures after they
> > have been called? routine _id would still be unaffected, so no present code
> > would be broken. It may make includes a bit easier to implement.
> > 
> > Chris
> 
> I don't see the necessity for this. It opens up all sorts of potential bugs.
> This would be the proper method of forward referencing (which I use
> frequently).
> 
Well, it didn't for 2-3 weeks until the 'bug' was noticed.

> }}}
<eucode>
> integer r_Func2
> 
> function Func1( integer i )
>     return call_func( r_Func2, {2} )
> end function
> 
> function Func2( integer i )
>     return i * 2
> end function
> r_Func2 = routine_id("Func2")
> </eucode>
{{{

> 
> 
Well, that may the 'proper' way of doing things, but

function Func1( integer i )
atom x
    Func2(2)
end function

function Func2( integer i )
    return i * 2
end function


is a lot easier. I guess C must have it wrong then.


> Could you post an example of how you could better implement the includes with
>  the bug reintrocuced?
> 
> -Greg

Weeeeeell, thats a bit more tricky, and probably more to do with lazy
programming than anything else

a.e
contains stuff

b.e
contains other stuff

main.exw
include a.e
include b.e
contains funcs called in  both a and e

later on
b.e is edited to add a great function

then a.e is edited to call the great function in b.e - but it can't, because
its not in the right order. So you create routine ids, which is fine, but
its taken extra work to do it.

So, perhaps you could give an example of an introduced bug created by
forward referencing.

Chris

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

Search



Quick Links

User menu

Not signed in.

Misc Menu