question on loading HLL bytecode

NotFound julian.notfound at gmail.com
Mon Feb 9 22:54:21 UTC 2009


> So, here's the question: Is it better to add a two-argument form of
> 'load_bytecode' so you can specify:
>
>  load_bytecode "hllname", "path/to/MyLib.pir"
>
> Or, to treat any path passed to 'load_bytecode' that starts with
> 'languages/hllname/' as a "virtual path"?
>
>  load_bytecode "languages/hllname/path/to/MyLib.pir"
>
> I prefer the first, as it's a cleaner interface, and better separation of
> code that does very different things. Also, it could be extended so that
> passing in an HLL source file automatically compiles it to PIR/bytecode if
> the PIR/bytecode doesn't exist already:

Will be more flexible if the two argument form allowed the HLL itself
to specify his PATH, for example by checking for a sub in the HLL
namespace, or in an namespace with a standarized name inside it, that
returns a path or a list of paths, and using his returned values if it
exists. Or just delegating the loading to that sub, passing the second
argument to it. And for simplcity, if that sub does not exists, use
the path deduced from load_language.

Storing in some accessible place the location found by load_language
may also be useful.

-- 
Salu2


More information about the parrot-dev mailing list