[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: RES: package system modification (module loaders)
- From: skaller <skaller@...>
- Date: 21 Jan 2005 16:22:45 +1100
On Thu, 2005-01-20 at 22:17, David Burgess wrote:
> P.S.
> I we wish to read about Felix we can visit the website.
Just some context then: I'm examining Lua to see how
to integrate it with Felix. This leads to all sorts
of difficult questions, because it must be viewed
as a cooperating pair of systems, rather than an
application simply using it.
My questions are not 'how do I use Lua to do XYZ?'.
The question is 'how does my client
use Lua + Felix to do XYZ?' where I don't know
in advance what XYZ actually is.
There are some obvious questions like: 'how do I
organise that a Felix function become a Lua function'?
And of course vice-versa. That question can be
answered by examining the Felix architecture plus
the Lua C API, which already has support for both
these operations. The issues relate to transparency,
data mapping, etc.
However it isn't all that obvious. For example
a Felix procedure is already a coroutine.
Can I make the Felix 'yield()' and the Lua 'yield()'
work together? There is no C API in Lua for that.
What happens if a C function registered as a Lua function
is actually C++ and throws an exception? In a *particular*
application I could wrap the C++ function in a C like one
that catches the exception, preventing it propagating
into Lua code.. but that may not be possible for
an arbitrary function.
Anyhow, at least one model of cooperation I'm considering
is to make Lua the top level scripting language, with
a 'magical' extension that allows compiling Felix script
directly. Crudely something like
f = Flx2Lua ("fun f(x:int)=> x * x")
print (f (2)) -- prints 4
which works by
(a) compiling the Felix to C++,
(b) compiling the C++ to a shared library,
(c) dynamically loading the library
(d) registering the function f as a C function with Lua
It may look like this is a stupid way to extend Lua,
and probably it is.
But try the converse viewpoint: the basic system is
actually Felix/C++ not Lua. Lua is being used as
the top level architecture manager, handling the
top level integration .. and then the picture begins
to make sense.
--
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850,
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net
- References:
- package system modification (module loaders), Tiago Dionizio
- RES: package system modification (module loaders), André de Leiradella
- Re: RES: package system modification (module loaders), duck
- Re: RES: package system modification (module loaders), Tomas
- Re: RES: package system modification (module loaders), duck
- Re: RES: package system modification (module loaders), duck
- Re: RES: package system modification (module loaders), duck
- Re: RES: package system modification (module loaders), skaller
- Re: RES: package system modification (module loaders), Diego Nehab
- Re: RES: package system modification (module loaders), skaller
- Re: RES: package system modification (module loaders), David Burgess