To this I would add the suggestion that the filesystem is not the only thing from which you might wish to load executable code. For instance, you might wish to retrieve ucode strings from a database or web service and then execute it. Thus, my dream would be having something like "loads()" that would accept the same arguments as "load()" except that the first string would be the ucode itself rather than the path to a file that contains ucode.

By the way, according to Appendix B in Programming with Unicon, I believe that Steve meant IPATH.

Steve Wampler wrote:

Hmmm, there's:

  loadfunc(...) for dynamic loading of a C wrapper function, and
  load(...) for dynamic loading of an entire Unicon program, but

there's no way to dynamically load a Unicon procedure
(from the IPL, for example).  Instead, one has to have
statically referenced the proper file in a link directive.

How about a:

loadProc(fname,pname)

that searches I/LPATH (whichever is the right one!)
for file fname.u and returns the procedure referenced
by pname from that file.  So, for example:

int2bit := loadProc("bitint","int2bit")

would work.    (I assume loadProc() would have to
link in *all* of bitint.u [since pname could reference
who knows what], so subsequent calls for other
procedures defined in bitint.u would be faster.

There are several other variants that would be
equally useful (any one of them would be sufficient).
For example, could have:

(a) linkFile(fname)

     dynamic equivalent of "link fname" directive; globals in
     fname.u are made available as globals.  (Have to define
     behavior if that global already exists, though...)

(b) namespace := linkFile(fname) # my favorite

     similar to (a), but returns a table of the globals in
     fname.u, thus avoiding the namespace collision
     problem.  Also easier to dynamically 'unlink'...

I have a feeling that linkPackage(pName) would be
similarly useful.







-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: Dedicated Hosting for just $79/mo with 500 GB of bandwidth! No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
_______________________________________________
Unicon-group mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to