Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.prolog > #15887

How is "unify" control done in Dogelog Player (Was: The lost Genius of GNU Prolog FFI)

From Mild Shock <janburse@fastmail.fm>
Newsgroups comp.lang.prolog
Subject How is "unify" control done in Dogelog Player (Was: The lost Genius of GNU Prolog FFI)
Date 2026-08-24 17:26 +0200
Message-ID <116hnr0$11e7d$1@solani.org> (permalink)
References <116hmgl$11d72$1@solani.org>

Show all headers | View raw


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
> 

Back to comp.lang.prolog | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

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

csiph-web