load Logtalk code from plain Prolog

Help requests on developing Logtalk applications

Moderator: Paulo Moura

Post Reply
joerg
Posts: 40
Joined: Fri Dec 21, 2007 9:38 am

load Logtalk code from plain Prolog

Post by joerg » Tue Jun 03, 2008 3:47 pm

Hello,

is it possible to load the Prolog files into which Logtalk files are compiled in Prolog again?

Suppose I have written a program my_prog.lgt which contains an object my_object. Suppose my_object has the method ::do_it(A, B, C). I want to be able to share this method with other people without having to force them to use Logtalk. I.e. I want to give them a file, say, my_prog.pl that contains the plain Prolog predicate do_it(A, B, C).

(It is hard enough to talk people into using Prolog. I do not always manage to talk them into using Logtalk. They might become interested in using Logtalk, though, if they like do_it(A, B, C) ...)

Jörg

Paulo Moura
Logtalk developer
Posts: 475
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

Re: load Logtalk code from plain Prolog

Post by Paulo Moura » Tue Jun 03, 2008 4:15 pm

Hi!

Logtalk includes both a compiler, which generates intermediate Prolog files, and a runtime. The generated Prolog files contain code that updated the Logtalk runtime tables upon loading. For simple examples, it might be possible to "extract" the plain Prolog code of the compiled methods. This will not work as soon you use inheritance, protocols, categories, etc. Note, however, that Logtalk generated new predicate functors constructed from object identifiers and predicate indicators that, because they need to be unique to avoid conflicts, are not as nice as the names used in the original source code.

As far as marketing logic programming solutions goes, why not try it the other way around? Sell Logtalk with a passing mention that it uses a Prolog system as a back-end compiler? Logtalk declarative OOP features can be an easier to sell feature than Prolog-only features per se.

Best regards,

Paulo
Paulo Moura
Logtalk developer

joerg
Posts: 40
Joined: Fri Dec 21, 2007 9:38 am

Re: load Logtalk code from plain Prolog

Post by joerg » Wed Jun 04, 2008 6:31 am

Hello Paulo,

thank you for your answer.

Greetings,

Jörg

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest