Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How far are modules implemented? #27

Open
ghost opened this issue Jun 25, 2018 · 5 comments
Open

How far are modules implemented? #27

ghost opened this issue Jun 25, 2018 · 5 comments
Assignees
Labels
question Questions todo TODO features

Comments

@ghost
Copy link

ghost commented Jun 25, 2018

Since when using the sandbox, I see a use_module/1 directive, I
thought most of the concepts of the ISO module standard
are implemented. So I tried a module that is created on the fly:

grafik

@ghost
Copy link
Author

ghost commented Jun 25, 2018

I just adopted naively what works in the SWI console. But I am
not sure whether it also works in the SWI web sandbox. But in
the SWI console the result would be:

grafik

@jariazavalverde jariazavalverde self-assigned this Jun 26, 2018
@jariazavalverde jariazavalverde added question Questions todo TODO features labels Jun 26, 2018
@jariazavalverde
Copy link
Collaborator

jariazavalverde commented Jul 13, 2018

Sorry for the delay. Currently, the use_module directive only can be used to load libraries of Tau Prolog. User-defined modules can't be used. In the next days I'll start working on the rest of directives.

@ghost
Copy link
Author

ghost commented Aug 4, 2018

Would it be possible in the future to have an operator (:)/2
also for static foreign function calls. And maybe even an
operator (::)/2 for dynamic foreign function calls.

I already find these predicates here:

http://tau-prolog.org/documentation/prolog/js/apply/3

http://tau-prolog.org/documentation/prolog/js/apply/4

What would prevent Tau Prolog from insted of having names
and lists, to use compounds as in the ISO module standard.
So instead of for example:

apply(foo, [a, b], X).
apply(Y, foo, [a,b] X).

One would for example do:

JSMain:foo(a,b,X).
Y::foo(a,b,X).

The operator (:)/2 is from the ISO module standard. The
operator (:;)/2 is found in Logtalk for example, but it can
be also bootstrapped Pythonesk from (:)/2.

@ghost
Copy link
Author

ghost commented Aug 4, 2018

The JSMain is a module name I made up for a static call.
But if the foreign function is known in the current context,
one could drop this module name, and simply write:

foo(a,b,X).

Even if its a Java Script call, is not specially registered
in the Prolog context, only visible from the Prolog context,
then an automatic synthetic Prolog module could be

created and cached.

@gilbert
Copy link
Contributor

gilbert commented Feb 4, 2020

Having ffi using : would be fantastic. It would enable Tau to better integrate with the JS ecosystem. I'm very interested in seeing and helping this happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions todo TODO features
Projects
None yet
Development

No branches or pull requests

2 participants