Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"I will make no bargains with terrorist hardware." -- Peter da Silva


devel / comp.lang.prolog / Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

SubjectAuthor
* A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)Mostowski Collapse
`* Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)Mostowski Collapse
 `* Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)Mostowski Collapse
  `* Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)Mostowski Collapse
   `* Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)Mostowski Collapse
    `* Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)Mostowski Collapse
     `* Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)Mostowski Collapse
      `* Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)Mostowski Collapse
       `* Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)Mostowski Collapse
        `* Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)Mostowski Collapse
         `* Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)Mostowski Collapse
          `* Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)Mostowski Collapse
           `* Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)Mostowski Collapse
            `* Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)Mostowski Collapse
             `* Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)Mostowski Collapse
              `* Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)Mostowski Collapse
               `- Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)Mostowski Collapse

1
A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

<sdf4hs$roa$1@solani.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=714&group=comp.lang.prolog#714

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!weretis.net!feeder8.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janburse@fastmail.fm (Mostowski Collapse)
Newsgroups: comp.lang.prolog
Subject: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)
Date: Fri, 23 Jul 2021 21:16:12 +0200
Message-ID: <sdf4hs$roa$1@solani.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 23 Jul 2021 19:16:12 -0000 (UTC)
Injection-Info: solani.org;
logging-data="28426"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:60.0)
Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.8.1
Cancel-Lock: sha1:SrO5u17r2ytErfPRfDCNW9MWeRk=
X-User-ID: eJwVwoENACEIA8CVQKDIOFh0/xE+n7swKJiOgMf7nV7VdJEE0iqJCSsxlo2yhpv71otFnD5MmVG/q6950z5RghXz
X-Mozilla-News-Host: news://news.solani.org:119
 by: Mostowski Collapse - Fri, 23 Jul 2021 19:16 UTC

Isn't ensure_loaded/1 a directive defined in the
ISO core standard [ISO 7.4.2.8]. Why do Logtalk
and GNU-Prolog not have it.

I managed to provide a consult/1 for Dogelog runtime.
Its reentrant. Means a file in progress of consult/1
can call consult/1 on another file, and it

gets correctly consulted as well. And Dogelog runtime
is a transpiler similar like Logtalk or GNU-Prolog.
Means the sub call of consult/1 will also pass

the the compiler pipeline consisting of transform
and encode. Why cant Logtalk or GNU-Prolog do that
as well? Whats the Prolololoblem?

Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

<sdf4k8$roa$2@solani.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=715&group=comp.lang.prolog#715

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janburse@fastmail.fm (Mostowski Collapse)
Newsgroups: comp.lang.prolog
Subject: Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)
Date: Fri, 23 Jul 2021 21:17:28 +0200
Message-ID: <sdf4k8$roa$2@solani.org>
References: <sdf4hs$roa$1@solani.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 23 Jul 2021 19:17:29 -0000 (UTC)
Injection-Info: solani.org;
logging-data="28426"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:60.0)
Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.8.1
Cancel-Lock: sha1:zBmdQulmeVd4wknHSFUAdLtFxC8=
X-User-ID: eJwNwoERwCAIBLCVQPhXxhGB/UdoL4FR+bYTdMxvRTC6ph5cGlNCkzxcx2rDtXJ2P+sTJKHOYPto1r26lB9JsBUc
In-Reply-To: <sdf4hs$roa$1@solani.org>
 by: Mostowski Collapse - Fri, 23 Jul 2021 19:17 UTC

Well the consult/1 I provide is weaker than
the ensure_loaded/1. But ensure_loaded/1 is planned.

Prolog explicit version of ensure_loaded/1 #80
https://github.com/jburse/dogelog-moon/issues/80

Mostowski Collapse schrieb:
> Isn't ensure_loaded/1 a directive defined in the
> ISO core standard [ISO 7.4.2.8]. Why do Logtalk
> and GNU-Prolog not have it.
>
> I managed to provide a consult/1 for Dogelog runtime.
> Its reentrant. Means a file in progress of consult/1
> can call consult/1 on another file, and it
>
> gets correctly consulted as well. And Dogelog runtime
> is a transpiler similar like Logtalk or GNU-Prolog.
> Means the sub call of consult/1 will also pass
>
> the the compiler pipeline consisting of transform
> and encode. Why cant Logtalk or GNU-Prolog do that
> as well? Whats the Prolololoblem?

Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

<sdf501$s3a$1@solani.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=716&group=comp.lang.prolog#716

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janburse@fastmail.fm (Mostowski Collapse)
Newsgroups: comp.lang.prolog
Subject: Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)
Date: Fri, 23 Jul 2021 21:23:44 +0200
Message-ID: <sdf501$s3a$1@solani.org>
References: <sdf4hs$roa$1@solani.org> <sdf4k8$roa$2@solani.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 23 Jul 2021 19:23:45 -0000 (UTC)
Injection-Info: solani.org;
logging-data="28778"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:60.0)
Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.8.1
Cancel-Lock: sha1:vJymbUb+UXZvyVAEDajMUutk4Wo=
In-Reply-To: <sdf4k8$roa$2@solani.org>
X-User-ID: eJwNycEBwCAIA8CVagkhjiMg+4/Q3vfcuFgBOuHjY90I4Bqe7LMfLGUQseS7BLYsa8bRbtfEP6WjEBKH9X45IhTE
 by: Mostowski Collapse - Fri, 23 Jul 2021 19:23 UTC

Its the double DCG problem and similar problems,
even the earth benders are lost on this problem
and have suggested Tarau engines.

LoL

But what about the air nation? Can it solve the
problem. I understand that it might be difficult,
because of the various stages and artefact

transformations involved in GNU Prolog. But maybe
a little separate compilation and later linking
would do the job. So that an ensure_loaded/1 directive

would spawn a separate compilation, put the artefact
on a list, and at the end of a consult batch all
separate artefacts are linked together or

otherwise integrated.

Mostowski Collapse schrieb:
> Well the consult/1 I provide is weaker than
> the ensure_loaded/1. But ensure_loaded/1 is planned.
>
> Prolog explicit version of ensure_loaded/1 #80
> https://github.com/jburse/dogelog-moon/issues/80
>
> Mostowski Collapse schrieb:
>> Isn't ensure_loaded/1 a directive defined in the
>> ISO core standard [ISO 7.4.2.8]. Why do Logtalk
>> and GNU-Prolog not have it.
>>
>> I managed to provide a consult/1 for Dogelog runtime.
>> Its reentrant. Means a file in progress of consult/1
>> can call consult/1 on another file, and it
>>
>> gets correctly consulted as well. And Dogelog runtime
>> is a transpiler similar like Logtalk or GNU-Prolog.
>> Means the sub call of consult/1 will also pass
>>
>> the the compiler pipeline consisting of transform
>> and encode. Why cant Logtalk or GNU-Prolog do that
>> as well? Whats the Prolololoblem?
>

Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

<f7341a1f-bec1-4341-9d14-006fd3c216fdn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=717&group=comp.lang.prolog#717

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a37:a004:: with SMTP id j4mr6059957qke.499.1627068959310;
Fri, 23 Jul 2021 12:35:59 -0700 (PDT)
X-Received: by 2002:a25:5e0a:: with SMTP id s10mr8413174ybb.247.1627068959131;
Fri, 23 Jul 2021 12:35:59 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 23 Jul 2021 12:35:58 -0700 (PDT)
In-Reply-To: <sdf501$s3a$1@solani.org>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sdf4hs$roa$1@solani.org> <sdf4k8$roa$2@solani.org> <sdf501$s3a$1@solani.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f7341a1f-bec1-4341-9d14-006fd3c216fdn@googlegroups.com>
Subject: Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Fri, 23 Jul 2021 19:35:59 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mostowski Collapse - Fri, 23 Jul 2021 19:35 UTC

Whats a little challenge, is to get the canonical file names. In
Jekejeke Prolog we call the file system to give us a canonical
file name. Things then get even more funny for URLs, we

even normalize them including %xx encoding manipulations and
punny manipulations. Not sure how this all works out in JavaScript.
The proof of concept will be if we have a predicate current_source/1,

that lists the consulted sources. The same built-in also exists in
Jekejeke Prolog. We could store sys_source/2 with additional flags, so
as to detect cyclic ensure_loaded etc..

current_source/1 would be only a facade.

Mostowski Collapse schrieb am Freitag, 23. Juli 2021 um 21:23:46 UTC+2:
> Its the double DCG problem and similar problems,
> even the earth benders are lost on this problem
> and have suggested Tarau engines.
>
> LoL
>
> But what about the air nation? Can it solve the
> problem. I understand that it might be difficult,
> because of the various stages and artefact
>
> transformations involved in GNU Prolog. But maybe
> a little separate compilation and later linking
> would do the job. So that an ensure_loaded/1 directive
>
> would spawn a separate compilation, put the artefact
> on a list, and at the end of a consult batch all
> separate artefacts are linked together or
>
> otherwise integrated.
>
> Mostowski Collapse schrieb:
> > Well the consult/1 I provide is weaker than
> > the ensure_loaded/1. But ensure_loaded/1 is planned.
> >
> > Prolog explicit version of ensure_loaded/1 #80
> > https://github.com/jburse/dogelog-moon/issues/80
> >
> > Mostowski Collapse schrieb:
> >> Isn't ensure_loaded/1 a directive defined in the
> >> ISO core standard [ISO 7.4.2.8]. Why do Logtalk
> >> and GNU-Prolog not have it.
> >>
> >> I managed to provide a consult/1 for Dogelog runtime.
> >> Its reentrant. Means a file in progress of consult/1
> >> can call consult/1 on another file, and it
> >>
> >> gets correctly consulted as well. And Dogelog runtime
> >> is a transpiler similar like Logtalk or GNU-Prolog.
> >> Means the sub call of consult/1 will also pass
> >>
> >> the the compiler pipeline consisting of transform
> >> and encode. Why cant Logtalk or GNU-Prolog do that
> >> as well? Whats the Prolololoblem?
> >

Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

<3a6c2c75-ebfa-43e0-b337-54b3061c5f15n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=718&group=comp.lang.prolog#718

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a0c:a223:: with SMTP id f32mr6450568qva.8.1627069791296; Fri, 23 Jul 2021 12:49:51 -0700 (PDT)
X-Received: by 2002:a25:ef0c:: with SMTP id g12mr8542208ybd.116.1627069790558; Fri, 23 Jul 2021 12:49:50 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 23 Jul 2021 12:49:50 -0700 (PDT)
In-Reply-To: <f7341a1f-bec1-4341-9d14-006fd3c216fdn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sdf4hs$roa$1@solani.org> <sdf4k8$roa$2@solani.org> <sdf501$s3a$1@solani.org> <f7341a1f-bec1-4341-9d14-006fd3c216fdn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3a6c2c75-ebfa-43e0-b337-54b3061c5f15n@googlegroups.com>
Subject: Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Fri, 23 Jul 2021 19:49:51 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 90
 by: Mostowski Collapse - Fri, 23 Jul 2021 19:49 UTC

canonical file names can be a challenge. For example SWI-Prolog
claims it does so. It says:

absolute_file_name(+File, -Absolute)
Expand a local filename into an absolute path.
The absolute path is canonicalised: references to . and .. are deleted.
https://www.swi-prolog.org/pldoc/man?section=files

But it doesn't work. I have file named 'Dict.TXT' on a Mac:

?- absolute_file_name('/Users/janburse/Desktop/dict.txt', X).
X = '/Users/janburse/Desktop/dict.txt'.

So what am I supposed to do, if on one side Dict.TXT is consulted
and on another side dict.txt is consulted? Am I supposed to call
same_file/2?

?- same_file('/Users/janburse/Desktop/dict.txt', '/Users/janburse/Desktop/Dict.TXT').
true.
?- same_file('/Users/janburse/Desktop/dict.TXT', '/Users/janburse/Desktop/Dict.txt').
true.

But this doesn't lead to a canonical name. Its only an equivalence
relation on a relative large equivalence class, on the Mac file
search is case insensitive.

To implement ensure_loaded/1 with same_file/2 I would
need to call it O(N^2) and cross compare all already compiled
file names. With a canonical name I could do some first

argument indexing which seems more natural to me.

Mostowski Collapse schrieb am Freitag, 23. Juli 2021 um 21:36:00 UTC+2:
> Whats a little challenge, is to get the canonical file names. In
> Jekejeke Prolog we call the file system to give us a canonical
> file name. Things then get even more funny for URLs, we
>
> even normalize them including %xx encoding manipulations and
> punny manipulations. Not sure how this all works out in JavaScript.
> The proof of concept will be if we have a predicate current_source/1,
>
> that lists the consulted sources. The same built-in also exists in
> Jekejeke Prolog. We could store sys_source/2 with additional flags, so
> as to detect cyclic ensure_loaded etc..
>
> current_source/1 would be only a facade.
> Mostowski Collapse schrieb am Freitag, 23. Juli 2021 um 21:23:46 UTC+2:
> > Its the double DCG problem and similar problems,
> > even the earth benders are lost on this problem
> > and have suggested Tarau engines.
> >
> > LoL
> >
> > But what about the air nation? Can it solve the
> > problem. I understand that it might be difficult,
> > because of the various stages and artefact
> >
> > transformations involved in GNU Prolog. But maybe
> > a little separate compilation and later linking
> > would do the job. So that an ensure_loaded/1 directive
> >
> > would spawn a separate compilation, put the artefact
> > on a list, and at the end of a consult batch all
> > separate artefacts are linked together or
> >
> > otherwise integrated.
> >
> > Mostowski Collapse schrieb:
> > > Well the consult/1 I provide is weaker than
> > > the ensure_loaded/1. But ensure_loaded/1 is planned.
> > >
> > > Prolog explicit version of ensure_loaded/1 #80
> > > https://github.com/jburse/dogelog-moon/issues/80
> > >
> > > Mostowski Collapse schrieb:
> > >> Isn't ensure_loaded/1 a directive defined in the
> > >> ISO core standard [ISO 7.4.2.8]. Why do Logtalk
> > >> and GNU-Prolog not have it.
> > >>
> > >> I managed to provide a consult/1 for Dogelog runtime.
> > >> Its reentrant. Means a file in progress of consult/1
> > >> can call consult/1 on another file, and it
> > >>
> > >> gets correctly consulted as well. And Dogelog runtime
> > >> is a transpiler similar like Logtalk or GNU-Prolog.
> > >> Means the sub call of consult/1 will also pass
> > >>
> > >> the the compiler pipeline consisting of transform
> > >> and encode. Why cant Logtalk or GNU-Prolog do that
> > >> as well? Whats the Prolololoblem?
> > >

Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

<0c3246ee-2263-448b-bd1c-cffc4b37e6fcn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=719&group=comp.lang.prolog#719

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:1193:: with SMTP id b19mr5987326qkk.439.1627070028260; Fri, 23 Jul 2021 12:53:48 -0700 (PDT)
X-Received: by 2002:a25:4f08:: with SMTP id d8mr8436785ybb.10.1627070028057; Fri, 23 Jul 2021 12:53:48 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!feeder1.feed.usenet.farm!feed.usenet.farm!tr1.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 23 Jul 2021 12:53:47 -0700 (PDT)
In-Reply-To: <3a6c2c75-ebfa-43e0-b337-54b3061c5f15n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sdf4hs$roa$1@solani.org> <sdf4k8$roa$2@solani.org> <sdf501$s3a$1@solani.org> <f7341a1f-bec1-4341-9d14-006fd3c216fdn@googlegroups.com> <3a6c2c75-ebfa-43e0-b337-54b3061c5f15n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0c3246ee-2263-448b-bd1c-cffc4b37e6fcn@googlegroups.com>
Subject: Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Fri, 23 Jul 2021 19:53:48 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 102
 by: Mostowski Collapse - Fri, 23 Jul 2021 19:53 UTC

In Jekejeke Prolog I get as expected:

?- absolute_file_name('/Users/janburse/Desktop/dict.txt', X).
X = 'file:/Users/janburse/Desktop/Dict.TXT'

Mostowski Collapse schrieb am Freitag, 23. Juli 2021 um 21:49:52 UTC+2:
> canonical file names can be a challenge. For example SWI-Prolog
> claims it does so. It says:
>
> absolute_file_name(+File, -Absolute)
> Expand a local filename into an absolute path.
> The absolute path is canonicalised: references to . and .. are deleted.
> https://www.swi-prolog.org/pldoc/man?section=files
>
> But it doesn't work. I have file named 'Dict.TXT' on a Mac:
>
> ?- absolute_file_name('/Users/janburse/Desktop/dict.txt', X).
> X = '/Users/janburse/Desktop/dict.txt'.
>
> So what am I supposed to do, if on one side Dict.TXT is consulted
> and on another side dict.txt is consulted? Am I supposed to call
> same_file/2?
>
> ?- same_file('/Users/janburse/Desktop/dict.txt', '/Users/janburse/Desktop/Dict.TXT').
> true.
> ?- same_file('/Users/janburse/Desktop/dict.TXT', '/Users/janburse/Desktop/Dict.txt').
> true.
>
> But this doesn't lead to a canonical name. Its only an equivalence
> relation on a relative large equivalence class, on the Mac file
> search is case insensitive.
>
> To implement ensure_loaded/1 with same_file/2 I would
> need to call it O(N^2) and cross compare all already compiled
> file names. With a canonical name I could do some first
>
> argument indexing which seems more natural to me.
> Mostowski Collapse schrieb am Freitag, 23. Juli 2021 um 21:36:00 UTC+2:
> > Whats a little challenge, is to get the canonical file names. In
> > Jekejeke Prolog we call the file system to give us a canonical
> > file name. Things then get even more funny for URLs, we
> >
> > even normalize them including %xx encoding manipulations and
> > punny manipulations. Not sure how this all works out in JavaScript.
> > The proof of concept will be if we have a predicate current_source/1,
> >
> > that lists the consulted sources. The same built-in also exists in
> > Jekejeke Prolog. We could store sys_source/2 with additional flags, so
> > as to detect cyclic ensure_loaded etc..
> >
> > current_source/1 would be only a facade.
> > Mostowski Collapse schrieb am Freitag, 23. Juli 2021 um 21:23:46 UTC+2:
> > > Its the double DCG problem and similar problems,
> > > even the earth benders are lost on this problem
> > > and have suggested Tarau engines.
> > >
> > > LoL
> > >
> > > But what about the air nation? Can it solve the
> > > problem. I understand that it might be difficult,
> > > because of the various stages and artefact
> > >
> > > transformations involved in GNU Prolog. But maybe
> > > a little separate compilation and later linking
> > > would do the job. So that an ensure_loaded/1 directive
> > >
> > > would spawn a separate compilation, put the artefact
> > > on a list, and at the end of a consult batch all
> > > separate artefacts are linked together or
> > >
> > > otherwise integrated.
> > >
> > > Mostowski Collapse schrieb:
> > > > Well the consult/1 I provide is weaker than
> > > > the ensure_loaded/1. But ensure_loaded/1 is planned.
> > > >
> > > > Prolog explicit version of ensure_loaded/1 #80
> > > > https://github.com/jburse/dogelog-moon/issues/80
> > > >
> > > > Mostowski Collapse schrieb:
> > > >> Isn't ensure_loaded/1 a directive defined in the
> > > >> ISO core standard [ISO 7.4.2.8]. Why do Logtalk
> > > >> and GNU-Prolog not have it.
> > > >>
> > > >> I managed to provide a consult/1 for Dogelog runtime.
> > > >> Its reentrant. Means a file in progress of consult/1
> > > >> can call consult/1 on another file, and it
> > > >>
> > > >> gets correctly consulted as well. And Dogelog runtime
> > > >> is a transpiler similar like Logtalk or GNU-Prolog.
> > > >> Means the sub call of consult/1 will also pass
> > > >>
> > > >> the the compiler pipeline consisting of transform
> > > >> and encode. Why cant Logtalk or GNU-Prolog do that
> > > >> as well? Whats the Prolololoblem?
> > > >

Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

<55ea8add-57e2-4ed9-a81c-029046cf350cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=723&group=comp.lang.prolog#723

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:101a:: with SMTP id z26mr8732737qkj.261.1627118040293;
Sat, 24 Jul 2021 02:14:00 -0700 (PDT)
X-Received: by 2002:a25:e0d5:: with SMTP id x204mr11919697ybg.390.1627118040124;
Sat, 24 Jul 2021 02:14:00 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Sat, 24 Jul 2021 02:13:59 -0700 (PDT)
In-Reply-To: <0c3246ee-2263-448b-bd1c-cffc4b37e6fcn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sdf4hs$roa$1@solani.org> <sdf4k8$roa$2@solani.org>
<sdf501$s3a$1@solani.org> <f7341a1f-bec1-4341-9d14-006fd3c216fdn@googlegroups.com>
<3a6c2c75-ebfa-43e0-b337-54b3061c5f15n@googlegroups.com> <0c3246ee-2263-448b-bd1c-cffc4b37e6fcn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <55ea8add-57e2-4ed9-a81c-029046cf350cn@googlegroups.com>
Subject: Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sat, 24 Jul 2021 09:14:00 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mostowski Collapse - Sat, 24 Jul 2021 09:13 UTC

Seems that Dogelog runtime and Jekejeke Prolog will
maybe have slightly different implementation of consult/1 and
ensure_loaded/1. Was also presenting a fundamental

difference between consult/1 and ensure_loaded/1 wrongly.
In a more refined Prolog text loader both consult/1 and
ensure_loaded/1 would avoid duplicate loading.

But ensure_loaded/1 would only load/re-load changed
files, whereas consult/1 would load all Prolog texts.
So there is the following browser analogy:

- Browser Enter of Page: This corresponds to
ensure_loaded/1, will reused cached resources.

- Browser Forced Reload: This corresponds to
consult/1, will invalidate caches before loading.

This is how I have implemented consult/1 and ensure_loaded/1
in Jekejeke Prolog. consult/1 is only needed in rare cases,
like when syntax operators or term expansions change,

and a more thorough reload is neded.

Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

<18be23ad-99d7-495d-91b5-8e9f8da008bfn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=724&group=comp.lang.prolog#724

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ad4:57ac:: with SMTP id g12mr9006469qvx.32.1627118242121;
Sat, 24 Jul 2021 02:17:22 -0700 (PDT)
X-Received: by 2002:a25:abea:: with SMTP id v97mr10811016ybi.367.1627118241976;
Sat, 24 Jul 2021 02:17:21 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Sat, 24 Jul 2021 02:17:21 -0700 (PDT)
In-Reply-To: <55ea8add-57e2-4ed9-a81c-029046cf350cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sdf4hs$roa$1@solani.org> <sdf4k8$roa$2@solani.org>
<sdf501$s3a$1@solani.org> <f7341a1f-bec1-4341-9d14-006fd3c216fdn@googlegroups.com>
<3a6c2c75-ebfa-43e0-b337-54b3061c5f15n@googlegroups.com> <0c3246ee-2263-448b-bd1c-cffc4b37e6fcn@googlegroups.com>
<55ea8add-57e2-4ed9-a81c-029046cf350cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <18be23ad-99d7-495d-91b5-8e9f8da008bfn@googlegroups.com>
Subject: Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sat, 24 Jul 2021 09:17:22 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mostowski Collapse - Sat, 24 Jul 2021 09:17 UTC

But now in Dogelog runtime everything is different, since
it has explicit cache clearning via the clear() JavaScript
call, and also the cache is staged, the different stage

scope can be changed via set_stage() JavaScript call.
The Jekejeke Prolog does some cleanup after a consult,
like Prolog texts that are not anymore used,

in as far [F1,..,Fn] could be a little bit improved, I am
more assuming a single top entry for consult/1 respectively
ensure_loaded/1. Dogelog runtime works the other

way around now, it does cleanup before consult.

Mostowski Collapse schrieb am Samstag, 24. Juli 2021 um 11:14:01 UTC+2:
> Seems that Dogelog runtime and Jekejeke Prolog will
> maybe have slightly different implementation of consult/1 and
> ensure_loaded/1. Was also presenting a fundamental
>
> difference between consult/1 and ensure_loaded/1 wrongly.
> In a more refined Prolog text loader both consult/1 and
> ensure_loaded/1 would avoid duplicate loading.
>
> But ensure_loaded/1 would only load/re-load changed
> files, whereas consult/1 would load all Prolog texts.
> So there is the following browser analogy:
>
> - Browser Enter of Page: This corresponds to
> ensure_loaded/1, will reused cached resources.
>
> - Browser Forced Reload: This corresponds to
> consult/1, will invalidate caches before loading.
>
> This is how I have implemented consult/1 and ensure_loaded/1
> in Jekejeke Prolog. consult/1 is only needed in rare cases,
> like when syntax operators or term expansions change,
>
> and a more thorough reload is neded.

Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

<1d82ee8d-7366-499d-ae2b-57cc8861e3afn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=725&group=comp.lang.prolog#725

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:6214:332:: with SMTP id j18mr595305qvu.21.1627118346266;
Sat, 24 Jul 2021 02:19:06 -0700 (PDT)
X-Received: by 2002:a25:5e0a:: with SMTP id s10mr11521555ybb.247.1627118346089;
Sat, 24 Jul 2021 02:19:06 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Sat, 24 Jul 2021 02:19:05 -0700 (PDT)
In-Reply-To: <18be23ad-99d7-495d-91b5-8e9f8da008bfn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sdf4hs$roa$1@solani.org> <sdf4k8$roa$2@solani.org>
<sdf501$s3a$1@solani.org> <f7341a1f-bec1-4341-9d14-006fd3c216fdn@googlegroups.com>
<3a6c2c75-ebfa-43e0-b337-54b3061c5f15n@googlegroups.com> <0c3246ee-2263-448b-bd1c-cffc4b37e6fcn@googlegroups.com>
<55ea8add-57e2-4ed9-a81c-029046cf350cn@googlegroups.com> <18be23ad-99d7-495d-91b5-8e9f8da008bfn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1d82ee8d-7366-499d-ae2b-57cc8861e3afn@googlegroups.com>
Subject: Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sat, 24 Jul 2021 09:19:06 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Mostowski Collapse - Sat, 24 Jul 2021 09:19 UTC

But the clouds about canonical file names is slowly lifting.
SWI-Prolog is very close, it doesn’t do case conversion. For
example when I query this here I get, I don’t see any case conversion,

the flag has also the correct value on a Mac:

?- current_prolog_flag(file_name_case_handling, X).
X = case_preserving.

?- absolute_file_name('/<user>/Desktop/Dict.txt', X).
X = '/<user>/Desktop/Dict.txt'.

But whats still missing is the operating system call to retrieve the
realpath, which is Dict.TXT in my example. case_preserving would
apply to the realpath.

Mostowski Collapse schrieb am Samstag, 24. Juli 2021 um 11:17:22 UTC+2:
> But now in Dogelog runtime everything is different, since
> it has explicit cache clearning via the clear() JavaScript
> call, and also the cache is staged, the different stage
>
> scope can be changed via set_stage() JavaScript call.
> The Jekejeke Prolog does some cleanup after a consult,
> like Prolog texts that are not anymore used,
>
> in as far [F1,..,Fn] could be a little bit improved, I am
> more assuming a single top entry for consult/1 respectively
> ensure_loaded/1. Dogelog runtime works the other
>
> way around now, it does cleanup before consult.
> Mostowski Collapse schrieb am Samstag, 24. Juli 2021 um 11:14:01 UTC+2:
> > Seems that Dogelog runtime and Jekejeke Prolog will
> > maybe have slightly different implementation of consult/1 and
> > ensure_loaded/1. Was also presenting a fundamental
> >
> > difference between consult/1 and ensure_loaded/1 wrongly.
> > In a more refined Prolog text loader both consult/1 and
> > ensure_loaded/1 would avoid duplicate loading.
> >
> > But ensure_loaded/1 would only load/re-load changed
> > files, whereas consult/1 would load all Prolog texts.
> > So there is the following browser analogy:
> >
> > - Browser Enter of Page: This corresponds to
> > ensure_loaded/1, will reused cached resources.
> >
> > - Browser Forced Reload: This corresponds to
> > consult/1, will invalidate caches before loading.
> >
> > This is how I have implemented consult/1 and ensure_loaded/1
> > in Jekejeke Prolog. consult/1 is only needed in rare cases,
> > like when syntax operators or term expansions change,
> >
> > and a more thorough reload is neded.

Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

<89dd1537-ceaa-474b-8cc8-4d60bbd3fa7fn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=726&group=comp.lang.prolog#726

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:4741:: with SMTP id k1mr7272473qtp.374.1627118452223; Sat, 24 Jul 2021 02:20:52 -0700 (PDT)
X-Received: by 2002:a05:6902:1202:: with SMTP id s2mr11225100ybu.475.1627118452004; Sat, 24 Jul 2021 02:20:52 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!feeder1.feed.usenet.farm!feed.usenet.farm!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Sat, 24 Jul 2021 02:20:51 -0700 (PDT)
In-Reply-To: <1d82ee8d-7366-499d-ae2b-57cc8861e3afn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sdf4hs$roa$1@solani.org> <sdf4k8$roa$2@solani.org> <sdf501$s3a$1@solani.org> <f7341a1f-bec1-4341-9d14-006fd3c216fdn@googlegroups.com> <3a6c2c75-ebfa-43e0-b337-54b3061c5f15n@googlegroups.com> <0c3246ee-2263-448b-bd1c-cffc4b37e6fcn@googlegroups.com> <55ea8add-57e2-4ed9-a81c-029046cf350cn@googlegroups.com> <18be23ad-99d7-495d-91b5-8e9f8da008bfn@googlegroups.com> <1d82ee8d-7366-499d-ae2b-57cc8861e3afn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <89dd1537-ceaa-474b-8cc8-4d60bbd3fa7fn@googlegroups.com>
Subject: Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sat, 24 Jul 2021 09:20:52 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 79
 by: Mostowski Collapse - Sat, 24 Jul 2021 09:20 UTC

What is needed, maybe only under the hood. Some built-in that
gives access to a file system function realpath:

realpath(P, Q):
% realpath(+Atom, -Atom)
The built-in succeeds in Q with the canonical path of P, by resolving . , ..
and symbolic links. On case insensitive file systems Q is not case converted.

The good news! JavaScript has realpath, I found asynchronous
and synchronous, have to practically check what it does:

fs.realpath(path[, options], callback)
fs.realpathSync(path[, options])
https://nodejs.org/api/fs.html

Java is even more refined, it has getAbsolutePath() and
getCanonicalPath(). getAbsolutePath() corresponds to the
current SWI-Prolog absolute_file_name/2. getCanonicalPath()

adds a realpath operating system call.

Mostowski Collapse schrieb am Samstag, 24. Juli 2021 um 11:19:06 UTC+2:
> But the clouds about canonical file names is slowly lifting.
> SWI-Prolog is very close, it doesn’t do case conversion. For
> example when I query this here I get, I don’t see any case conversion,
>
> the flag has also the correct value on a Mac:
>
> ?- current_prolog_flag(file_name_case_handling, X).
> X = case_preserving.
>
> ?- absolute_file_name('/<user>/Desktop/Dict.txt', X).
> X = '/<user>/Desktop/Dict.txt'.
>
> But whats still missing is the operating system call to retrieve the
> realpath, which is Dict.TXT in my example. case_preserving would
> apply to the realpath.
> Mostowski Collapse schrieb am Samstag, 24. Juli 2021 um 11:17:22 UTC+2:
> > But now in Dogelog runtime everything is different, since
> > it has explicit cache clearning via the clear() JavaScript
> > call, and also the cache is staged, the different stage
> >
> > scope can be changed via set_stage() JavaScript call.
> > The Jekejeke Prolog does some cleanup after a consult,
> > like Prolog texts that are not anymore used,
> >
> > in as far [F1,..,Fn] could be a little bit improved, I am
> > more assuming a single top entry for consult/1 respectively
> > ensure_loaded/1. Dogelog runtime works the other
> >
> > way around now, it does cleanup before consult.
> > Mostowski Collapse schrieb am Samstag, 24. Juli 2021 um 11:14:01 UTC+2:
> > > Seems that Dogelog runtime and Jekejeke Prolog will
> > > maybe have slightly different implementation of consult/1 and
> > > ensure_loaded/1. Was also presenting a fundamental
> > >
> > > difference between consult/1 and ensure_loaded/1 wrongly.
> > > In a more refined Prolog text loader both consult/1 and
> > > ensure_loaded/1 would avoid duplicate loading.
> > >
> > > But ensure_loaded/1 would only load/re-load changed
> > > files, whereas consult/1 would load all Prolog texts.
> > > So there is the following browser analogy:
> > >
> > > - Browser Enter of Page: This corresponds to
> > > ensure_loaded/1, will reused cached resources.
> > >
> > > - Browser Forced Reload: This corresponds to
> > > consult/1, will invalidate caches before loading.
> > >
> > > This is how I have implemented consult/1 and ensure_loaded/1
> > > in Jekejeke Prolog. consult/1 is only needed in rare cases,
> > > like when syntax operators or term expansions change,
> > >
> > > and a more thorough reload is neded.

Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

<4a0d5664-a6c2-4844-ad35-dd319d25ad7cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=744&group=comp.lang.prolog#744

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:6214:d46:: with SMTP id 6mr19585881qvr.36.1627393565050; Tue, 27 Jul 2021 06:46:05 -0700 (PDT)
X-Received: by 2002:a25:e006:: with SMTP id x6mr1782263ybg.341.1627393564896; Tue, 27 Jul 2021 06:46:04 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 27 Jul 2021 06:46:04 -0700 (PDT)
In-Reply-To: <89dd1537-ceaa-474b-8cc8-4d60bbd3fa7fn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sdf4hs$roa$1@solani.org> <sdf4k8$roa$2@solani.org> <sdf501$s3a$1@solani.org> <f7341a1f-bec1-4341-9d14-006fd3c216fdn@googlegroups.com> <3a6c2c75-ebfa-43e0-b337-54b3061c5f15n@googlegroups.com> <0c3246ee-2263-448b-bd1c-cffc4b37e6fcn@googlegroups.com> <55ea8add-57e2-4ed9-a81c-029046cf350cn@googlegroups.com> <18be23ad-99d7-495d-91b5-8e9f8da008bfn@googlegroups.com> <1d82ee8d-7366-499d-ae2b-57cc8861e3afn@googlegroups.com> <89dd1537-ceaa-474b-8cc8-4d60bbd3fa7fn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4a0d5664-a6c2-4844-ad35-dd319d25ad7cn@googlegroups.com>
Subject: Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 27 Jul 2021 13:46:05 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 17
 by: Mostowski Collapse - Tue, 27 Jul 2021 13:46 UTC

Currently the work around is to use include/1 (in GNU Prolog).
But include/1 is not smart, it cannot deal with an import graph.
The main benefit of ensure_loaded/1 would be to avoid

duplicate include/1, which is not part of the requirement of
include/1. So one workaround would be if one could define
user directives, like:

:- dynamic(visited/1).

ensure_loaded(file) :-
visited(file), !.
ensure_loaded(file) ;-
assertz(visited(file)),
include(file).

Such import graph traversal is very common in JavaScript.
Its done by require() and now by import().

Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

<baf876b5-5a6f-4060-ad74-a387a5312872n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=745&group=comp.lang.prolog#745

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ad4:4e0e:: with SMTP id dl14mr14979454qvb.37.1627394397155;
Tue, 27 Jul 2021 06:59:57 -0700 (PDT)
X-Received: by 2002:a25:aaa4:: with SMTP id t33mr29552707ybi.256.1627394397008;
Tue, 27 Jul 2021 06:59:57 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 27 Jul 2021 06:59:56 -0700 (PDT)
In-Reply-To: <4a0d5664-a6c2-4844-ad35-dd319d25ad7cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sdf4hs$roa$1@solani.org> <sdf4k8$roa$2@solani.org>
<sdf501$s3a$1@solani.org> <f7341a1f-bec1-4341-9d14-006fd3c216fdn@googlegroups.com>
<3a6c2c75-ebfa-43e0-b337-54b3061c5f15n@googlegroups.com> <0c3246ee-2263-448b-bd1c-cffc4b37e6fcn@googlegroups.com>
<55ea8add-57e2-4ed9-a81c-029046cf350cn@googlegroups.com> <18be23ad-99d7-495d-91b5-8e9f8da008bfn@googlegroups.com>
<1d82ee8d-7366-499d-ae2b-57cc8861e3afn@googlegroups.com> <89dd1537-ceaa-474b-8cc8-4d60bbd3fa7fn@googlegroups.com>
<4a0d5664-a6c2-4844-ad35-dd319d25ad7cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <baf876b5-5a6f-4060-ad74-a387a5312872n@googlegroups.com>
Subject: Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 27 Jul 2021 13:59:57 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 42
 by: Mostowski Collapse - Tue, 27 Jul 2021 13:59 UTC

Because assertz/1 is called before include/1, the user directive
would also work for cyclic imports. Interestingly JavaScript
can also do cyclic imports. I have used it by accident recently,

and it worked. The ECMA standard says:

A Cyclic Module Record is used to represent information about
a module that can participate in dependency cycles with other
modules that are subclasses of the Cyclic Module Record type.
Module Records that are not subclasses of the Cyclic Module
Record type must not participate in dependency cycles with
Source Text Module Records.

[[DFSIndex]] Integer | undefined Auxiliary field used during Link
and Evaluate only. If [[Status]] is linking or evaluating, this non-negative
number records the point at which the module was first visited during
the ongoing depth-first traversal of the dependency graph.

[[DFSAncestorIndex]] Integer | undefined Auxiliary field used during
Link and Evaluate only. If [[Status]] is linking or evaluating, this is either
the module's own [[DFSIndex]] or that of an "earlier" module in the same
strongly connected component.
https://tc39.es/ecma262/multipage/ecmascript-language-scripts-and-modules.html#cyclic-module-record

Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 15:46:05 UTC+2:
> Currently the work around is to use include/1 (in GNU Prolog).
> But include/1 is not smart, it cannot deal with an import graph.
> The main benefit of ensure_loaded/1 would be to avoid
>
> duplicate include/1, which is not part of the requirement of
> include/1. So one workaround would be if one could define
> user directives, like:
>
> :- dynamic(visited/1).
>
> ensure_loaded(file) :-
> visited(file), !.
> ensure_loaded(file) ;-
> assertz(visited(file)),
> include(file).
>
> Such import graph traversal is very common in JavaScript.
> Its done by require() and now by import().

Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

<1cf49071-3692-47b4-9f8c-ada1871d214en@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=746&group=comp.lang.prolog#746

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:7310:: with SMTP id x16mr19237341qto.178.1627394554945;
Tue, 27 Jul 2021 07:02:34 -0700 (PDT)
X-Received: by 2002:a25:694f:: with SMTP id e76mr16385205ybc.247.1627394554591;
Tue, 27 Jul 2021 07:02:34 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 27 Jul 2021 07:02:34 -0700 (PDT)
In-Reply-To: <baf876b5-5a6f-4060-ad74-a387a5312872n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sdf4hs$roa$1@solani.org> <sdf4k8$roa$2@solani.org>
<sdf501$s3a$1@solani.org> <f7341a1f-bec1-4341-9d14-006fd3c216fdn@googlegroups.com>
<3a6c2c75-ebfa-43e0-b337-54b3061c5f15n@googlegroups.com> <0c3246ee-2263-448b-bd1c-cffc4b37e6fcn@googlegroups.com>
<55ea8add-57e2-4ed9-a81c-029046cf350cn@googlegroups.com> <18be23ad-99d7-495d-91b5-8e9f8da008bfn@googlegroups.com>
<1d82ee8d-7366-499d-ae2b-57cc8861e3afn@googlegroups.com> <89dd1537-ceaa-474b-8cc8-4d60bbd3fa7fn@googlegroups.com>
<4a0d5664-a6c2-4844-ad35-dd319d25ad7cn@googlegroups.com> <baf876b5-5a6f-4060-ad74-a387a5312872n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1cf49071-3692-47b4-9f8c-ada1871d214en@googlegroups.com>
Subject: Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 27 Jul 2021 14:02:34 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mostowski Collapse - Tue, 27 Jul 2021 14:02 UTC

Whats a little tricky is allow debugging, i.e reconsult.
One possible solution is to define:

:- dynamic(visited/1).

ensure_loaded(file) :-
visited(file), !.
ensure_loaded(file) ;-
assertz(visited(file)),
include(file).

consult(file) :-
retractall(visited(_)),
include(file).

So one would make a main entry file for the application
he is working on. And call consult(main) when one wants

to reconsult everything. A more smarter solution stores
last modified in visited/2, etc.. etc..

Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 15:59:57 UTC+2:
> Because assertz/1 is called before include/1, the user directive
> would also work for cyclic imports. Interestingly JavaScript
> can also do cyclic imports. I have used it by accident recently,
>
> and it worked. The ECMA standard says:
>
> A Cyclic Module Record is used to represent information about
> a module that can participate in dependency cycles with other
> modules that are subclasses of the Cyclic Module Record type.
> Module Records that are not subclasses of the Cyclic Module
> Record type must not participate in dependency cycles with
> Source Text Module Records.
>
> [[DFSIndex]] Integer | undefined Auxiliary field used during Link
> and Evaluate only. If [[Status]] is linking or evaluating, this non-negative
> number records the point at which the module was first visited during
> the ongoing depth-first traversal of the dependency graph.
>
> [[DFSAncestorIndex]] Integer | undefined Auxiliary field used during
> Link and Evaluate only. If [[Status]] is linking or evaluating, this is either
> the module's own [[DFSIndex]] or that of an "earlier" module in the same
> strongly connected component.
> https://tc39.es/ecma262/multipage/ecmascript-language-scripts-and-modules.html#cyclic-module-record
> Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 15:46:05 UTC+2:
> > Currently the work around is to use include/1 (in GNU Prolog).
> > But include/1 is not smart, it cannot deal with an import graph.
> > The main benefit of ensure_loaded/1 would be to avoid
> >
> > duplicate include/1, which is not part of the requirement of
> > include/1. So one workaround would be if one could define
> > user directives, like:
> >
> > :- dynamic(visited/1).
> >
> > ensure_loaded(file) :-
> > visited(file), !.
> > ensure_loaded(file) ;-
> > assertz(visited(file)),
> > include(file).
> >
> > Such import graph traversal is very common in JavaScript.
> > Its done by require() and now by import().

Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

<a03d1312-b6f9-4821-b73c-98f58de6d67en@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=747&group=comp.lang.prolog#747

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:75d4:: with SMTP id z20mr19479420qtq.360.1627394673049;
Tue, 27 Jul 2021 07:04:33 -0700 (PDT)
X-Received: by 2002:a05:6902:1109:: with SMTP id o9mr33662262ybu.448.1627394672932;
Tue, 27 Jul 2021 07:04:32 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 27 Jul 2021 07:04:32 -0700 (PDT)
In-Reply-To: <1cf49071-3692-47b4-9f8c-ada1871d214en@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sdf4hs$roa$1@solani.org> <sdf4k8$roa$2@solani.org>
<sdf501$s3a$1@solani.org> <f7341a1f-bec1-4341-9d14-006fd3c216fdn@googlegroups.com>
<3a6c2c75-ebfa-43e0-b337-54b3061c5f15n@googlegroups.com> <0c3246ee-2263-448b-bd1c-cffc4b37e6fcn@googlegroups.com>
<55ea8add-57e2-4ed9-a81c-029046cf350cn@googlegroups.com> <18be23ad-99d7-495d-91b5-8e9f8da008bfn@googlegroups.com>
<1d82ee8d-7366-499d-ae2b-57cc8861e3afn@googlegroups.com> <89dd1537-ceaa-474b-8cc8-4d60bbd3fa7fn@googlegroups.com>
<4a0d5664-a6c2-4844-ad35-dd319d25ad7cn@googlegroups.com> <baf876b5-5a6f-4060-ad74-a387a5312872n@googlegroups.com>
<1cf49071-3692-47b4-9f8c-ada1871d214en@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a03d1312-b6f9-4821-b73c-98f58de6d67en@googlegroups.com>
Subject: Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 27 Jul 2021 14:04:33 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mostowski Collapse - Tue, 27 Jul 2021 14:04 UTC

But this could also work as main entry, multiple
Prolog texts. Define something like:

[H|T] :-
retractall(visited(_)),
maplist(include, [H|T]).

Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 16:02:35 UTC+2:
> Whats a little tricky is allow debugging, i.e reconsult.
> One possible solution is to define:
> :- dynamic(visited/1).
>
> ensure_loaded(file) :-
> visited(file), !.
> ensure_loaded(file) ;-
> assertz(visited(file)),
> include(file).
>
> consult(file) :-
> retractall(visited(_)),
> include(file).
>
> So one would make a main entry file for the application
> he is working on. And call consult(main) when one wants
>
> to reconsult everything. A more smarter solution stores
> last modified in visited/2, etc.. etc..
> Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 15:59:57 UTC+2:
> > Because assertz/1 is called before include/1, the user directive
> > would also work for cyclic imports. Interestingly JavaScript
> > can also do cyclic imports. I have used it by accident recently,
> >
> > and it worked. The ECMA standard says:
> >
> > A Cyclic Module Record is used to represent information about
> > a module that can participate in dependency cycles with other
> > modules that are subclasses of the Cyclic Module Record type.
> > Module Records that are not subclasses of the Cyclic Module
> > Record type must not participate in dependency cycles with
> > Source Text Module Records.
> >
> > [[DFSIndex]] Integer | undefined Auxiliary field used during Link
> > and Evaluate only. If [[Status]] is linking or evaluating, this non-negative
> > number records the point at which the module was first visited during
> > the ongoing depth-first traversal of the dependency graph.
> >
> > [[DFSAncestorIndex]] Integer | undefined Auxiliary field used during
> > Link and Evaluate only. If [[Status]] is linking or evaluating, this is either
> > the module's own [[DFSIndex]] or that of an "earlier" module in the same
> > strongly connected component.
> > https://tc39.es/ecma262/multipage/ecmascript-language-scripts-and-modules.html#cyclic-module-record
> > Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 15:46:05 UTC+2:
> > > Currently the work around is to use include/1 (in GNU Prolog).
> > > But include/1 is not smart, it cannot deal with an import graph.
> > > The main benefit of ensure_loaded/1 would be to avoid
> > >
> > > duplicate include/1, which is not part of the requirement of
> > > include/1. So one workaround would be if one could define
> > > user directives, like:
> > >
> > > :- dynamic(visited/1).
> > >
> > > ensure_loaded(file) :-
> > > visited(file), !.
> > > ensure_loaded(file) ;-
> > > assertz(visited(file)),
> > > include(file).
> > >
> > > Such import graph traversal is very common in JavaScript.
> > > Its done by require() and now by import().

Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

<ee4c5722-5fb6-4a6e-93b5-1894fb3efcb9n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=748&group=comp.lang.prolog#748

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ae9:e109:: with SMTP id g9mr22954369qkm.95.1627394948323; Tue, 27 Jul 2021 07:09:08 -0700 (PDT)
X-Received: by 2002:a25:d488:: with SMTP id m130mr15318952ybf.116.1627394948098; Tue, 27 Jul 2021 07:09:08 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 27 Jul 2021 07:09:07 -0700 (PDT)
In-Reply-To: <a03d1312-b6f9-4821-b73c-98f58de6d67en@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sdf4hs$roa$1@solani.org> <sdf4k8$roa$2@solani.org> <sdf501$s3a$1@solani.org> <f7341a1f-bec1-4341-9d14-006fd3c216fdn@googlegroups.com> <3a6c2c75-ebfa-43e0-b337-54b3061c5f15n@googlegroups.com> <0c3246ee-2263-448b-bd1c-cffc4b37e6fcn@googlegroups.com> <55ea8add-57e2-4ed9-a81c-029046cf350cn@googlegroups.com> <18be23ad-99d7-495d-91b5-8e9f8da008bfn@googlegroups.com> <1d82ee8d-7366-499d-ae2b-57cc8861e3afn@googlegroups.com> <89dd1537-ceaa-474b-8cc8-4d60bbd3fa7fn@googlegroups.com> <4a0d5664-a6c2-4844-ad35-dd319d25ad7cn@googlegroups.com> <baf876b5-5a6f-4060-ad74-a387a5312872n@googlegroups.com> <1cf49071-3692-47b4-9f8c-ada1871d214en@googlegroups.com> <a03d1312-b6f9-4821-b73c-98f58de6d67en@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ee4c5722-5fb6-4a6e-93b5-1894fb3efcb9n@googlegroups.com>
Subject: Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 27 Jul 2021 14:09:08 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 91
 by: Mostowski Collapse - Tue, 27 Jul 2021 14:09 UTC

Corr.: But this here:

retractall(visited(_)).

Must be replaced by something that also flushes
(abolish) the currently consulted predicates. Or
some policy is in place, when a predicate is seen

a second time during some include, it is first flushed.
But this doesn't work so well for multifile predicates,
The flushing (abolish) can be also integrated

into ensure_loaded/1, so that in the end, retractall(visited(_))
is nevertheless enought. Not only GNU Prolog
could profit from a smarter Prolog loader, possibly

also Logtalk, which seems to be a little ossified,
concerning the proposed way how to work with it.
Although ensure_loaded/1 is part of the ISO core standard.

Have Fun!

Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 16:04:33 UTC+2:
> But this could also work as main entry, multiple
> Prolog texts. Define something like:
>
> [H|T] :-
> retractall(visited(_)),
> maplist(include, [H|T]).
> Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 16:02:35 UTC+2:
> > Whats a little tricky is allow debugging, i.e reconsult.
> > One possible solution is to define:
> > :- dynamic(visited/1).
> >
> > ensure_loaded(file) :-
> > visited(file), !.
> > ensure_loaded(file) ;-
> > assertz(visited(file)),
> > include(file).
> >
> > consult(file) :-
> > retractall(visited(_)),
> > include(file).
> >
> > So one would make a main entry file for the application
> > he is working on. And call consult(main) when one wants
> >
> > to reconsult everything. A more smarter solution stores
> > last modified in visited/2, etc.. etc..
> > Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 15:59:57 UTC+2:
> > > Because assertz/1 is called before include/1, the user directive
> > > would also work for cyclic imports. Interestingly JavaScript
> > > can also do cyclic imports. I have used it by accident recently,
> > >
> > > and it worked. The ECMA standard says:
> > >
> > > A Cyclic Module Record is used to represent information about
> > > a module that can participate in dependency cycles with other
> > > modules that are subclasses of the Cyclic Module Record type.
> > > Module Records that are not subclasses of the Cyclic Module
> > > Record type must not participate in dependency cycles with
> > > Source Text Module Records.
> > >
> > > [[DFSIndex]] Integer | undefined Auxiliary field used during Link
> > > and Evaluate only. If [[Status]] is linking or evaluating, this non-negative
> > > number records the point at which the module was first visited during
> > > the ongoing depth-first traversal of the dependency graph.
> > >
> > > [[DFSAncestorIndex]] Integer | undefined Auxiliary field used during
> > > Link and Evaluate only. If [[Status]] is linking or evaluating, this is either
> > > the module's own [[DFSIndex]] or that of an "earlier" module in the same
> > > strongly connected component.
> > > https://tc39.es/ecma262/multipage/ecmascript-language-scripts-and-modules.html#cyclic-module-record
> > > Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 15:46:05 UTC+2:
> > > > Currently the work around is to use include/1 (in GNU Prolog).
> > > > But include/1 is not smart, it cannot deal with an import graph.
> > > > The main benefit of ensure_loaded/1 would be to avoid
> > > >
> > > > duplicate include/1, which is not part of the requirement of
> > > > include/1. So one workaround would be if one could define
> > > > user directives, like:
> > > >
> > > > :- dynamic(visited/1).
> > > >
> > > > ensure_loaded(file) :-
> > > > visited(file), !.
> > > > ensure_loaded(file) ;-
> > > > assertz(visited(file)),
> > > > include(file).
> > > >
> > > > Such import graph traversal is very common in JavaScript.
> > > > Its done by require() and now by import().

Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

<b2bc6d3e-789a-4e17-a02a-0ff1032f4d67n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=749&group=comp.lang.prolog#749

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a37:7141:: with SMTP id m62mr14070657qkc.496.1627395431218;
Tue, 27 Jul 2021 07:17:11 -0700 (PDT)
X-Received: by 2002:a5b:c4a:: with SMTP id d10mr19533937ybr.38.1627395431071;
Tue, 27 Jul 2021 07:17:11 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 27 Jul 2021 07:17:10 -0700 (PDT)
In-Reply-To: <ee4c5722-5fb6-4a6e-93b5-1894fb3efcb9n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sdf4hs$roa$1@solani.org> <sdf4k8$roa$2@solani.org>
<sdf501$s3a$1@solani.org> <f7341a1f-bec1-4341-9d14-006fd3c216fdn@googlegroups.com>
<3a6c2c75-ebfa-43e0-b337-54b3061c5f15n@googlegroups.com> <0c3246ee-2263-448b-bd1c-cffc4b37e6fcn@googlegroups.com>
<55ea8add-57e2-4ed9-a81c-029046cf350cn@googlegroups.com> <18be23ad-99d7-495d-91b5-8e9f8da008bfn@googlegroups.com>
<1d82ee8d-7366-499d-ae2b-57cc8861e3afn@googlegroups.com> <89dd1537-ceaa-474b-8cc8-4d60bbd3fa7fn@googlegroups.com>
<4a0d5664-a6c2-4844-ad35-dd319d25ad7cn@googlegroups.com> <baf876b5-5a6f-4060-ad74-a387a5312872n@googlegroups.com>
<1cf49071-3692-47b4-9f8c-ada1871d214en@googlegroups.com> <a03d1312-b6f9-4821-b73c-98f58de6d67en@googlegroups.com>
<ee4c5722-5fb6-4a6e-93b5-1894fb3efcb9n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b2bc6d3e-789a-4e17-a02a-0ff1032f4d67n@googlegroups.com>
Subject: Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 27 Jul 2021 14:17:11 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mostowski Collapse - Tue, 27 Jul 2021 14:17 UTC

Sometimes I have the feeling the JavaScript programming
language developers are all former Datalog gurus,
when they write:

>>> strongly connected component <<<
https://tc39.es/ecma262/multipage/ecmascript-language-scripts-and-modules.html#cyclic-module-record

Ok thats a little overrated, strongly connected component
were discovered idependently by Robert Tarjan 1972 ?
Why do they need SCC? Dunno. Computing imported

tables more efficiently in the cyclic case? ensure_loaded/1
wouldn't go that far. Requirement is simpler. But Logtalk
could be interested in SCC algorithms?

Modern OO languages usually allow a lot of cyclic stuff,
especially on class import/export level and type import/
export level, whereby often class=type and so on.

cycles or only explicitly forbidden for example along
a single inheritance change and such stuff.

Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 16:09:09 UTC+2:
> Corr.: But this here:
>
> retractall(visited(_)).
>
> Must be replaced by something that also flushes
> (abolish) the currently consulted predicates. Or
> some policy is in place, when a predicate is seen
>
> a second time during some include, it is first flushed.
> But this doesn't work so well for multifile predicates,
> The flushing (abolish) can be also integrated
>
> into ensure_loaded/1, so that in the end, retractall(visited(_))
> is nevertheless enought. Not only GNU Prolog
> could profit from a smarter Prolog loader, possibly
>
> also Logtalk, which seems to be a little ossified,
> concerning the proposed way how to work with it.
> Although ensure_loaded/1 is part of the ISO core standard.
>
> Have Fun!
> Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 16:04:33 UTC+2:
> > But this could also work as main entry, multiple
> > Prolog texts. Define something like:
> >
> > [H|T] :-
> > retractall(visited(_)),
> > maplist(include, [H|T]).
> > Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 16:02:35 UTC+2:
> > > Whats a little tricky is allow debugging, i.e reconsult.
> > > One possible solution is to define:
> > > :- dynamic(visited/1).
> > >
> > > ensure_loaded(file) :-
> > > visited(file), !.
> > > ensure_loaded(file) ;-
> > > assertz(visited(file)),
> > > include(file).
> > >
> > > consult(file) :-
> > > retractall(visited(_)),
> > > include(file).
> > >
> > > So one would make a main entry file for the application
> > > he is working on. And call consult(main) when one wants
> > >
> > > to reconsult everything. A more smarter solution stores
> > > last modified in visited/2, etc.. etc..
> > > Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 15:59:57 UTC+2:
> > > > Because assertz/1 is called before include/1, the user directive
> > > > would also work for cyclic imports. Interestingly JavaScript
> > > > can also do cyclic imports. I have used it by accident recently,
> > > >
> > > > and it worked. The ECMA standard says:
> > > >
> > > > A Cyclic Module Record is used to represent information about
> > > > a module that can participate in dependency cycles with other
> > > > modules that are subclasses of the Cyclic Module Record type.
> > > > Module Records that are not subclasses of the Cyclic Module
> > > > Record type must not participate in dependency cycles with
> > > > Source Text Module Records.
> > > >
> > > > [[DFSIndex]] Integer | undefined Auxiliary field used during Link
> > > > and Evaluate only. If [[Status]] is linking or evaluating, this non-negative
> > > > number records the point at which the module was first visited during
> > > > the ongoing depth-first traversal of the dependency graph.
> > > >
> > > > [[DFSAncestorIndex]] Integer | undefined Auxiliary field used during
> > > > Link and Evaluate only. If [[Status]] is linking or evaluating, this is either
> > > > the module's own [[DFSIndex]] or that of an "earlier" module in the same
> > > > strongly connected component.
> > > > https://tc39.es/ecma262/multipage/ecmascript-language-scripts-and-modules.html#cyclic-module-record
> > > > Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 15:46:05 UTC+2:
> > > > > Currently the work around is to use include/1 (in GNU Prolog).
> > > > > But include/1 is not smart, it cannot deal with an import graph.
> > > > > The main benefit of ensure_loaded/1 would be to avoid
> > > > >
> > > > > duplicate include/1, which is not part of the requirement of
> > > > > include/1. So one workaround would be if one could define
> > > > > user directives, like:
> > > > >
> > > > > :- dynamic(visited/1).
> > > > >
> > > > > ensure_loaded(file) :-
> > > > > visited(file), !.
> > > > > ensure_loaded(file) ;-
> > > > > assertz(visited(file)),
> > > > > include(file).
> > > > >
> > > > > Such import graph traversal is very common in JavaScript.
> > > > > Its done by require() and now by import().

Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

<c0a22b98-3ddd-419d-8720-11075286a7dbn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=750&group=comp.lang.prolog#750

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:1227:: with SMTP id v7mr3797900qkj.3.1627397446106;
Tue, 27 Jul 2021 07:50:46 -0700 (PDT)
X-Received: by 2002:a25:3b05:: with SMTP id i5mr17997163yba.109.1627397445902;
Tue, 27 Jul 2021 07:50:45 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 27 Jul 2021 07:50:45 -0700 (PDT)
In-Reply-To: <b2bc6d3e-789a-4e17-a02a-0ff1032f4d67n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sdf4hs$roa$1@solani.org> <sdf4k8$roa$2@solani.org>
<sdf501$s3a$1@solani.org> <f7341a1f-bec1-4341-9d14-006fd3c216fdn@googlegroups.com>
<3a6c2c75-ebfa-43e0-b337-54b3061c5f15n@googlegroups.com> <0c3246ee-2263-448b-bd1c-cffc4b37e6fcn@googlegroups.com>
<55ea8add-57e2-4ed9-a81c-029046cf350cn@googlegroups.com> <18be23ad-99d7-495d-91b5-8e9f8da008bfn@googlegroups.com>
<1d82ee8d-7366-499d-ae2b-57cc8861e3afn@googlegroups.com> <89dd1537-ceaa-474b-8cc8-4d60bbd3fa7fn@googlegroups.com>
<4a0d5664-a6c2-4844-ad35-dd319d25ad7cn@googlegroups.com> <baf876b5-5a6f-4060-ad74-a387a5312872n@googlegroups.com>
<1cf49071-3692-47b4-9f8c-ada1871d214en@googlegroups.com> <a03d1312-b6f9-4821-b73c-98f58de6d67en@googlegroups.com>
<ee4c5722-5fb6-4a6e-93b5-1894fb3efcb9n@googlegroups.com> <b2bc6d3e-789a-4e17-a02a-0ff1032f4d67n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c0a22b98-3ddd-419d-8720-11075286a7dbn@googlegroups.com>
Subject: Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 27 Jul 2021 14:50:46 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mostowski Collapse - Tue, 27 Jul 2021 14:50 UTC

Quizz: What happens first:

a) Hell freezes over

b) Logtalk has ensure_loaded/1 ?

Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 16:17:11 UTC+2:
> Sometimes I have the feeling the JavaScript programming
> language developers are all former Datalog gurus,
> when they write:
>
> >>> strongly connected component <<<
> https://tc39.es/ecma262/multipage/ecmascript-language-scripts-and-modules.html#cyclic-module-record
>
> Ok thats a little overrated, strongly connected component
> were discovered idependently by Robert Tarjan 1972 ?
> Why do they need SCC? Dunno. Computing imported
>
> tables more efficiently in the cyclic case? ensure_loaded/1
> wouldn't go that far. Requirement is simpler. But Logtalk
> could be interested in SCC algorithms?
>
> Modern OO languages usually allow a lot of cyclic stuff,
> especially on class import/export level and type import/
> export level, whereby often class=type and so on.
>
> cycles or only explicitly forbidden for example along
> a single inheritance change and such stuff.
> Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 16:09:09 UTC+2:
> > Corr.: But this here:
> >
> > retractall(visited(_)).
> >
> > Must be replaced by something that also flushes
> > (abolish) the currently consulted predicates. Or
> > some policy is in place, when a predicate is seen
> >
> > a second time during some include, it is first flushed.
> > But this doesn't work so well for multifile predicates,
> > The flushing (abolish) can be also integrated
> >
> > into ensure_loaded/1, so that in the end, retractall(visited(_))
> > is nevertheless enought. Not only GNU Prolog
> > could profit from a smarter Prolog loader, possibly
> >
> > also Logtalk, which seems to be a little ossified,
> > concerning the proposed way how to work with it.
> > Although ensure_loaded/1 is part of the ISO core standard.
> >
> > Have Fun!
> > Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 16:04:33 UTC+2:
> > > But this could also work as main entry, multiple
> > > Prolog texts. Define something like:
> > >
> > > [H|T] :-
> > > retractall(visited(_)),
> > > maplist(include, [H|T]).
> > > Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 16:02:35 UTC+2:
> > > > Whats a little tricky is allow debugging, i.e reconsult.
> > > > One possible solution is to define:
> > > > :- dynamic(visited/1).
> > > >
> > > > ensure_loaded(file) :-
> > > > visited(file), !.
> > > > ensure_loaded(file) ;-
> > > > assertz(visited(file)),
> > > > include(file).
> > > >
> > > > consult(file) :-
> > > > retractall(visited(_)),
> > > > include(file).
> > > >
> > > > So one would make a main entry file for the application
> > > > he is working on. And call consult(main) when one wants
> > > >
> > > > to reconsult everything. A more smarter solution stores
> > > > last modified in visited/2, etc.. etc..
> > > > Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 15:59:57 UTC+2:
> > > > > Because assertz/1 is called before include/1, the user directive
> > > > > would also work for cyclic imports. Interestingly JavaScript
> > > > > can also do cyclic imports. I have used it by accident recently,
> > > > >
> > > > > and it worked. The ECMA standard says:
> > > > >
> > > > > A Cyclic Module Record is used to represent information about
> > > > > a module that can participate in dependency cycles with other
> > > > > modules that are subclasses of the Cyclic Module Record type.
> > > > > Module Records that are not subclasses of the Cyclic Module
> > > > > Record type must not participate in dependency cycles with
> > > > > Source Text Module Records.
> > > > >
> > > > > [[DFSIndex]] Integer | undefined Auxiliary field used during Link
> > > > > and Evaluate only. If [[Status]] is linking or evaluating, this non-negative
> > > > > number records the point at which the module was first visited during
> > > > > the ongoing depth-first traversal of the dependency graph.
> > > > >
> > > > > [[DFSAncestorIndex]] Integer | undefined Auxiliary field used during
> > > > > Link and Evaluate only. If [[Status]] is linking or evaluating, this is either
> > > > > the module's own [[DFSIndex]] or that of an "earlier" module in the same
> > > > > strongly connected component.
> > > > > https://tc39.es/ecma262/multipage/ecmascript-language-scripts-and-modules.html#cyclic-module-record
> > > > > Mostowski Collapse schrieb am Dienstag, 27. Juli 2021 um 15:46:05 UTC+2:
> > > > > > Currently the work around is to use include/1 (in GNU Prolog).
> > > > > > But include/1 is not smart, it cannot deal with an import graph.
> > > > > > The main benefit of ensure_loaded/1 would be to avoid
> > > > > >
> > > > > > duplicate include/1, which is not part of the requirement of
> > > > > > include/1. So one workaround would be if one could define
> > > > > > user directives, like:
> > > > > >
> > > > > > :- dynamic(visited/1).
> > > > > >
> > > > > > ensure_loaded(file) :-
> > > > > > visited(file), !.
> > > > > > ensure_loaded(file) ;-
> > > > > > assertz(visited(file)),
> > > > > > include(file).
> > > > > >
> > > > > > Such import graph traversal is very common in JavaScript.
> > > > > > Its done by require() and now by import().


devel / comp.lang.prolog / Re: A challenge for Logtalk and GNU-Prolog (ensure_loaded/1)

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor