Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.prolog > #15884 > unrolled thread
| Started by | Mild Shock <janburse@fastmail.fm> |
|---|---|
| First post | 2026-08-24 17:03 +0200 |
| Last post | 2026-08-24 17:26 +0200 |
| Articles | 4 — 1 participant |
Back to article view | Back to comp.lang.prolog
The lost Genius of GNU Prolog FFI Mild Shock <janburse@fastmail.fm> - 2026-08-24 17:03 +0200
The missing genius of Web Prolog (Was: The lost Genius of GNU Prolog FFI) Mild Shock <janburse@fastmail.fm> - 2026-08-24 17:06 +0200
Some variable scoping tricks (Was: The missing genius of Web Prolog) Mild Shock <janburse@fastmail.fm> - 2026-08-24 17:07 +0200
How is "unify" control done in Dogelog Player (Was: The lost Genius of GNU Prolog FFI) Mild Shock <janburse@fastmail.fm> - 2026-08-24 17:26 +0200
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2026-08-24 17:03 +0200 |
| Subject | The lost Genius of GNU Prolog FFI |
| Message-ID | <116hmgl$11d72$1@solani.org> |
Hi,
We really find a lost Genius in GNU Prolog FFI.
It has this wonderful thing. The field "unify"
controls whether the actual argument must
be unified at the exit of the C function.
10.3.6 Input/output arguments
typedef struct
{
PlBool is_var;
PlBool unify;
union
{
PlLong l;
char *s;
double d;
}value;
}PlFIOArg;
Judging from just looking at it, one can basically
communicate "don't care" arguments, usuall expressed
as "_" i.e. annonymous variables, or some variants
of Prolog systems also allow "_Name", but effectively
variables that only occure at one call site location.
But why is it lost. It is slowly subject to bit rot.
> www.gprolog.org verwendet ein ungültiges Sicherheitszertifikat.
>
> Das Zertifikat gilt nur für folgende Namen: trantor.univ-paris1.fr,
> *.univ-paris1.fr, univ-paris1.fr, *.pantheonsorbonne.fr,
> pantheonsorbonne.fr
>
> Fehlercode: SSL_ERROR_BAD_CERT_DOMAIN
Some older browsers fall back to HTTP, some newer
browsers do not fall back to HTTP, and require an
exceptions. I dunno how this affects your FFI project
and some merits of using GNU Prolog. But somehow projects
become quickly outdated, either from the inside or from
the outside. I think its an error to think one can make
a website, and then forget it for decades, you basically
have to internally reviewed it every 2-3 years. So half
dead projects like GNU Prolog based on C will disappear
in favor to for example Rust projects, simply because
Rust might be more attentive and more alive now,
until Rust is replaced by the next wave of programming
languages. Its the same with repositories that were
accessible via FTP and had PS files, nobody can access
them easily nowadays. In a few months you might need
to place an ai.txt on your website, and add some
certificate to it, to prove your code was made by a
human and not by a robot, because of cybersecurity
and alignment issues.
Bye
[toc] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2026-08-24 17:06 +0200 |
| Subject | The missing genius of Web Prolog (Was: The lost Genius of GNU Prolog FFI) |
| Message-ID | <116hml2$11d72$2@solani.org> |
| In reply to | #15884 |
Hi,
I have some doubt that Web Prolog captures the
wisdom of 70 years of distributed database engineering.
Or maybe the Trinity Web Prolog concept paper does
not talk about it. But the general structure of SQL queries is:
SELECT projection
FROM source
WHERE condition
Now I have a problem with Web Prolog when I would like
to do very simple remote things like for example, which can be
highly optimized in traditional WAM based Prolog systems,
the way anonymous variables can be represented. You see
this in the GNU Prolog FFI, in the C declarations from <gprolog.h>,
where an argument can be marked as wanted on return or not:
?- ..., PID ! person(ID, _, _, AGE, _), ...
What a Web Prolog might see at runtime is only:
?- ..., 9167 ! person(3524, _1, _2, _3, _4), ...
The pengine, although it can do paging or whatever, will
then happily send back over the wire a very large JSON
packet which will have the answer in its data field:
{
...
data:{"_1":..., "_2":...", "_3":..., "_4":...}
}
But from the intention of the original query we would like only:
{
...
data:{"_3":...}
}
So while Web Prolog gives me some traits of a ResultSet
from SQL, like paging. I think a mechanism for select projection
is missing, while SQL happily does that as well in its ResultSet.
Its quite a tricky problem, since it shatters the whole idea of
a simple (!)/2 binary operator for Prolog based RPC. Maybe it
can be solved on the compiler side with an analysis that
provides the GNU Prolog FFI flags. But then the Prolog based
RPC becomes more than a new built-in with a beautifully
looking (!)/2 binary operator, it would also require some
intervention in compiler technique from the Prolog system.
Bye
Mild Shock schrieb:
> Hi,
>
> We really find a lost Genius in GNU Prolog FFI.
> It has this wonderful thing. The field "unify"
> controls whether the actual argument must
>
> be unified at the exit of the C function.
>
> 10.3.6 Input/output arguments
> typedef struct
> {
> PlBool is_var;
> PlBool unify;
> union
> {
> PlLong l;
> char *s;
> double d;
> }value;
> } PlFIOArg;
>
> Judging from just looking at it, one can basically
> communicate "don't care" arguments, usuall expressed
> as "_" i.e. annonymous variables, or some variants
>
> of Prolog systems also allow "_Name", but effectively
> variables that only occure at one call site location.
> But why is it lost. It is slowly subject to bit rot.
>
> > www.gprolog.org verwendet ein ungültiges Sicherheitszertifikat.
> >
> > Das Zertifikat gilt nur für folgende Namen: trantor.univ-paris1.fr,
> > *.univ-paris1.fr, univ-paris1.fr, *.pantheonsorbonne.fr,
> > pantheonsorbonne.fr
> >
> > Fehlercode: SSL_ERROR_BAD_CERT_DOMAIN
>
> Some older browsers fall back to HTTP, some newer
> browsers do not fall back to HTTP, and require an
> exceptions. I dunno how this affects your FFI project
>
> and some merits of using GNU Prolog. But somehow projects
> become quickly outdated, either from the inside or from
> the outside. I think its an error to think one can make
>
> a website, and then forget it for decades, you basically
> have to internally reviewed it every 2-3 years. So half
> dead projects like GNU Prolog based on C will disappear
>
> in favor to for example Rust projects, simply because
> Rust might be more attentive and more alive now,
> until Rust is replaced by the next wave of programming
>
> languages. Its the same with repositories that were
> accessible via FTP and had PS files, nobody can access
> them easily nowadays. In a few months you might need
>
> to place an ai.txt on your website, and add some
> certificate to it, to prove your code was made by a
> human and not by a robot, because of cybersecurity
>
> and alignment issues.
>
> Bye
>
[toc] | [prev] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2026-08-24 17:07 +0200 |
| Subject | Some variable scoping tricks (Was: The missing genius of Web Prolog) |
| Message-ID | <116hmnh$11d72$3@solani.org> |
| In reply to | #15885 |
Hi,
P.S.: A variant 1 workaround would be to allow
quantifiers in a query, like for example (^)/2 as
already found in setof/3. But then one runs into
the annoying opt-out accumulation:
?- ..., PID ! X1^X2^X3^person(ID, X1, X2, AGE, X3), ...
P.P.S.: Although switching from opt-out to opt-in would
be a solution in this matter, sending programs could be also
a variant 2 solution, for example an RPC where I
can send a temporary program and a query would also
do the job, see this rpc/3 example:
?- ..., rpc(PID, person_age(PID, AGE),
{person_age(PID, AGE) :- person(ID, _, _, AGE, _)}), ... .
It has mindboggling variable scoping, {}/1 doing
automatic universal quantification, just like input
clauses are read in a Prolog text according to ISO
core standard semantics, but practically one runs
into problems whether the provided program should
more have some embedded implication semantics and have
not all variables automatically universally quantified,
so as to capture terms, and here transmit to the PID,
from the calling context.
Bye
Mild Shock schrieb:
> Hi,
>
> I have some doubt that Web Prolog captures the
> wisdom of 70 years of distributed database engineering.
> Or maybe the Trinity Web Prolog concept paper does
>
> not talk about it. But the general structure of SQL queries is:
>
> SELECT projection
> FROM source
> WHERE condition
>
> Now I have a problem with Web Prolog when I would like
> to do very simple remote things like for example, which can be
> highly optimized in traditional WAM based Prolog systems,
>
> the way anonymous variables can be represented. You see
> this in the GNU Prolog FFI, in the C declarations from <gprolog.h>,
> where an argument can be marked as wanted on return or not:
>
> ?- ..., PID ! person(ID, _, _, AGE, _), ...
>
> What a Web Prolog might see at runtime is only:
>
> ?- ..., 9167 ! person(3524, _1, _2, _3, _4), ...
> The pengine, although it can do paging or whatever, will
> then happily send back over the wire a very large JSON
> packet which will have the answer in its data field:
>
> {
> ...
> data:{"_1":..., "_2":...", "_3":..., "_4":...}
> }
>
> But from the intention of the original query we would like only:
>
> {
> ...
> data:{"_3":...}
> }
>
> So while Web Prolog gives me some traits of a ResultSet
> from SQL, like paging. I think a mechanism for select projection
> is missing, while SQL happily does that as well in its ResultSet.
>
> Its quite a tricky problem, since it shatters the whole idea of
> a simple (!)/2 binary operator for Prolog based RPC. Maybe it
> can be solved on the compiler side with an analysis that
>
> provides the GNU Prolog FFI flags. But then the Prolog based
> RPC becomes more than a new built-in with a beautifully
> looking (!)/2 binary operator, it would also require some
>
> intervention in compiler technique from the Prolog system.
>
> Bye
>
> Mild Shock schrieb:
>> Hi,
>>
>> We really find a lost Genius in GNU Prolog FFI.
>> It has this wonderful thing. The field "unify"
>> controls whether the actual argument must
>>
>> be unified at the exit of the C function.
>>
>> 10.3.6 Input/output arguments
>> typedef struct
>> {
>> PlBool is_var;
>> PlBool unify;
>> union
>> {
>> PlLong l;
>> char *s;
>> double d;
>> }value;
>> } PlFIOArg;
>>
>> Judging from just looking at it, one can basically
>> communicate "don't care" arguments, usuall expressed
>> as "_" i.e. annonymous variables, or some variants
>>
>> of Prolog systems also allow "_Name", but effectively
>> variables that only occure at one call site location.
>> But why is it lost. It is slowly subject to bit rot.
>>
>> > www.gprolog.org verwendet ein ungültiges Sicherheitszertifikat.
>> >
>> > Das Zertifikat gilt nur für folgende Namen: trantor.univ-paris1.fr,
>> > *.univ-paris1.fr, univ-paris1.fr, *.pantheonsorbonne.fr,
>> > pantheonsorbonne.fr
>> >
>> > Fehlercode: SSL_ERROR_BAD_CERT_DOMAIN
>>
>> Some older browsers fall back to HTTP, some newer
>> browsers do not fall back to HTTP, and require an
>> exceptions. I dunno how this affects your FFI project
>>
>> and some merits of using GNU Prolog. But somehow projects
>> become quickly outdated, either from the inside or from
>> the outside. I think its an error to think one can make
>>
>> a website, and then forget it for decades, you basically
>> have to internally reviewed it every 2-3 years. So half
>> dead projects like GNU Prolog based on C will disappear
>>
>> in favor to for example Rust projects, simply because
>> Rust might be more attentive and more alive now,
>> until Rust is replaced by the next wave of programming
>>
>> languages. Its the same with repositories that were
>> accessible via FTP and had PS files, nobody can access
>> them easily nowadays. In a few months you might need
>>
>> to place an ai.txt on your website, and add some
>> certificate to it, to prove your code was made by a
>> human and not by a robot, because of cybersecurity
>>
>> and alignment issues.
>>
>> Bye
>>
>
[toc] | [prev] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2026-08-24 17:26 +0200 |
| Subject | How is "unify" control done in Dogelog Player (Was: The lost Genius of GNU Prolog FFI) |
| Message-ID | <116hnr0$11e7d$1@solani.org> |
| In reply to | #15884 |
Hi,
Since a few releases I transport similar
information, for certain test_XXX FFI predicates.
It is burried here:
public static boolean is_pending(Object template) {
if (template == Store.UNDEF_OBJ) {
return true;
} else if (Store.is_place(template)) {
return true;
} else {
return false;
}
}
Basically I pass defered Prolog clause terms,
not yet instantiated. And these can be examined for
being a singleton, i.e. template == Store.UNDEF_OBJ
or a variable, i.e Store.is_place(template), that
get both later instantiated when the clause gets
fully instantiated. So basically template ==
Store.UNDEF_OBJ does serve as my "unify" control
flag. But I don't use it explicitly in the control
flow of a built in. But very common use cases
would be for example:
... functor(T, F, _) ...
or then also:
... functor(T, _, A) ...
So you don't you don't need a separate built-in
functor_arity/2 or functor_name/2, and can spare
some trailing, or even spare writing shunted variables.
I do this sparing later here, during the exit of a built-in:
public static boolean exec_unify(Object template, Object alpha) {
for (; ; ) {
if (template == Store.UNDEF_OBJ) {
return true;
Its a little harder to do in classic WAM that puts
all its arguments before a predicate call on the
stack. It would need to preserve some singleton information.
But its not impossible to also do in classic WAM I
suspect. And GNU Prolog possibly being the example
of how it its done in classic WAM.
Bye
Mild Shock schrieb:
> Hi,
>
> We really find a lost Genius in GNU Prolog FFI.
> It has this wonderful thing. The field "unify"
> controls whether the actual argument must
>
> be unified at the exit of the C function.
>
> 10.3.6 Input/output arguments
> typedef struct
> {
> PlBool is_var;
> PlBool unify;
> union
> {
> PlLong l;
> char *s;
> double d;
> }value;
> }PlFIOArg;
>
> Judging from just looking at it, one can basically
> communicate "don't care" arguments, usuall expressed
> as "_" i.e. annonymous variables, or some variants
>
> of Prolog systems also allow "_Name", but effectively
> variables that only occure at one call site location.
> But why is it lost. It is slowly subject to bit rot.
>
> > www.gprolog.org verwendet ein ungültiges Sicherheitszertifikat.
> >
> > Das Zertifikat gilt nur für folgende Namen: trantor.univ-paris1.fr,
> > *.univ-paris1.fr, univ-paris1.fr, *.pantheonsorbonne.fr,
> > pantheonsorbonne.fr
> >
> > Fehlercode: SSL_ERROR_BAD_CERT_DOMAIN
>
> Some older browsers fall back to HTTP, some newer
> browsers do not fall back to HTTP, and require an
> exceptions. I dunno how this affects your FFI project
>
> and some merits of using GNU Prolog. But somehow projects
> become quickly outdated, either from the inside or from
> the outside. I think its an error to think one can make
>
> a website, and then forget it for decades, you basically
> have to internally reviewed it every 2-3 years. So half
> dead projects like GNU Prolog based on C will disappear
>
> in favor to for example Rust projects, simply because
> Rust might be more attentive and more alive now,
> until Rust is replaced by the next wave of programming
>
> languages. Its the same with repositories that were
> accessible via FTP and had PS files, nobody can access
> them easily nowadays. In a few months you might need
>
> to place an ai.txt on your website, and add some
> certificate to it, to prove your code was made by a
> human and not by a robot, because of cybersecurity
>
> and alignment issues.
>
> Bye
>
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.prolog
csiph-web