1. bind
Lewis Townsend wrote:
> I know Windows does and that routine_id doesn't
> work with bind for some reason.
Actually, the trouble you are referring to isn't unique to Windows. Bind
*will* work, except under the following circumstances:
1. You select to shroud your code. Shrouding renames all your routines, so
the string literal in routine_id no longer matches the shrouded routine
name. For example:
Before Shrouding:
-----------------
procedure foo()
end procedure
constant bar = routine_id("foo")
After Shrouding:
----------------
z3 u0()
i9 z3
u8 u1 = sy("foo")
Note that bind mangles *all* the code, keywords included, except for string
literals. If you choose not to shroud your code when binding, you don't have
this problem. Unless...
2. Unless, of course, there is a name conflict. When Euphoria binds your
code, it effectively merges the source file and include files into a single
file. If you tell it *not* to rename your code, it will still rename
routines if there is a name conflict. For example:
Before Binding:
---------------
-- file1
include file2
integer foo, bar
-- file2
integer foo, baz
After Binding:
--------------
-- file 1
-- include file2
-- file2
integer foo, baz
integer u3, bar
Notice that there is a name conflict between the use of 'foo' in both files.
The bind routine resolved this by renaming the second, and all other
occurances of 'foo' to something else. When it's done binding, it *will*
warn you about what it's done, but it's a real pain to fix this sort of
thing.
To avoid this problem, there's a FIX program in Win32Lib. It works a lot
like bind and shroud. It does the following:
1. It merges the main file and all the include files together into a new
file.
2. It renames *all* the routines, constants and variables.
3. It alters the literal strings in routine_id() to reflect the new names.
Unlike shroud, it doesn't rename Euphoria keywords. So it would do something
like this:
Before Fixing:
--------------
procedure foo()
end procedure
constant bar = routine_id("foo")
After Fixing:
-------------
procedure t1()
end procedure
constant t2 = routine_id("t2")
So if you want to bind code, run FIX on it, and create the bound file from
that output.
Hopefully, when Robert introduces namespaces into Euphoria, it will
eliminate this problem.
-- David Cuny
2. Re: bind
I wrote:
> After Fixing:
> -------------
> procedure t1()
> end procedure
>
> constant t2 = routine_id("t2")
Which should have been:
After Fixing:
-------------
procedure t1()
end procedure
constant t2 = routine_id("t1")
Sorry.
-- David Cuny
3. Re: bind
Hello David C.
Thanks for clearing that up for me, AND providing a solution.
later,
Lewis Townsend
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.