Re: Euphoria 3.2 compatibility
- Posted by Matt Lewis <matthewwalkerlewis at gm?i?.com> Apr 24, 2008
- 646 views
Jeremy Cowgar wrote: > > > Ok, so I just tried it. I'm wrong. Having peek2s will not break code, it will > give a warning that it was redefined. > > Now, I tried this as well: > > === hi.e > }}} <eucode> > global procedure hi() > puts(1, "hi.e: Hi!\n") > end procedure > </eucode> {{{ > > === test.e > include hi.e > > procedure hi() > puts(1, "test.e: Hi!\n") > end procedure > > hi() > </eucode> {{{ > > That works also, however, it does not give a warning that hi() was redefined. > > So, is the argument that new functions will break existing functions not > valid? > Therefore, we may have broke nothing what-so-ever in the 3.2/4.0 release? > > I guess I was just moving on things I thought I saw in the past and what > others > have stated as well. I just tried this test in 3.1 and it works as well in > 3.1. It gets down to how symbols are resolved. Overloading a built in gives a warning. A local (or a global in the same file as it is being used) will take precedence over a global in another file. Two globals in other files will cause breakage:
-- app.ex include foo.e as foo include bar.e as bar procedure hi() puts(1, "app\n") end procedure hi() foo:hi() bar:hi() -- foo.e global procedure hi() puts(1,"foo\n") end procedure hi() -- bar.e include foo.e hi() global procedure hi() puts(1,"bar\n" ) end procedure hi()
$ exu app foo foo bar app foo bar Matt