[Dev-luatex] REQ: Please tell comp.text.tex why LuaTeX chose embed rather than extend.
Jonathan Fine
jfine at pytex.org
Mon May 25 00:32:11 CEST 2009
Arthur Reutenauer wrote:
>> One of the best parts, in my view, was Zeljko Vrba pointing out, in effect,
>> that Postgres both embedded scripting languages and provided an interface
>> that allowed it to be used as an extension to a scripting language. This
>> provides a wonderful dual example.
>
> Taco and Hans already stated their opinions, and I won't speak on
> their behalf, but I read the entire thread on c.t.t. and would like to
> point out that in the discussion, Željko seems to say the exact contrary
> to what you report here: Postgres embeds Python as a scripting language
> -- just like LuaTeX embeds Lua --
Thank you for reading the c.t.t thread, Arthur, and for your comments.
Željko pointed out that Postgres allows Python to be embedded as a
scripting language. It is well-known that there are Python wrappers
that allow one to extend Python with the Postgres database engine. Put
the two together and you have the dual example.
I don't think I was being too generous in giving Željko credit for this
wonderful dual example. He certainly provided the part that was not
obvious.
> and [Postgres] does not offer the database engine
> as an extension: it only gives access to it through an API, and does not
> extend Python with a database module.
In Python I can write
import pyscopg
and then I have a module that allows me to connect to a Postgres
database, and add, change and delete records. In other words I have
imported into Python a database extension.
I'd expect almost every LAMP web-site to do something like this. Not
always Python, not always Postgres, but extend a scripting language to
provide database access.
This database will be accessed, of course, through its API. (How else
would a sensible programmer do it?) The extension module pyscopg
provides a wrapper around the API that makes it accessible to Python.
As it happens, and for good reasons, pyscopg is not provided by Postgres
but by a third party. So technically you are correct. Postgres does
not provide a Python extension module, only an API. A third party wraps
the API to provide a Python extension module.
But all this is a little off the topic of embed and extend. Postgres
can embed Python, and one can extend Python using Postgres. This is the
dual example, and it helps show us what embed is good for, and what
extend is good for.
--
Jonathan
More information about the dev-luatex
mailing list