Re: Warning: argument option processing changes

Boris Vassilev <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CAFw8osLR+1ff+DA9N8_tZdZPZxE_4LRXZ+Ecigj1XvVACQsn5Q@mail.gmail.com>
Hello,

Is this section of the manual still correct:

http://www.swi-prolog.org/pldoc/man?section=plscript

In particular, is it still possible to have a file (hello.pl) like this:

#!/path/to/swipl -q -t main -f
main :- format('hello world~n'), halt.

which can then be run with
$ ./hello.pl
(right now Prolog gives me back the help message when I try this)

Reading the email above I understand that this shouldn't be used / is
wrong, because of the multiple options passed. However, the email also
talks about script files, starting with header #! line, but what is it
for if I can drop the #! header altogether and run:
$ swipl -q -t main -f hello.pl

Thank you,
Boris


On Mon, Aug 19, 2013 at 10:49 PM, Jan Wielemaker <[email protected]> wrote:
> Hi,
>
> Prolog can be started in many ways and the new stuff around Carlo's
> console and the Mac makes it even more complicated.  I spent most of
> the day sorting out command line processing.  Pushed the changed,
> which introduces some INCOMPATIBLE changes.  It does improve
> compatibility with some other systems though.  Outline:
>
>  - The Prolog flag =argv= now only provides `user arguments'.  I.e.,
>    arguments processed by Prolog are not there.  This is compatible
>    with at least YAP and SICStus.   All arguments are still available
>    with the new flag =os_argv=.
>
>  - I removed all stuff trying to be clever with arguments from #!
>    scripts.  Most of this didn't work anyway, leading to all sorts
>    of hard to debug platform dependent surprises.  This concretely
>    means that options in #! under Windows have no meaning.  On
>    Unix systems, only #!/path-to-executable [option] (using only
>    one option) is (AFAIK) fully portable.
>
>    Anything that can be handled using options can be handled with
>    directives these days, so functionality-wise nothing changes.
>
>  - swipl [option ...] prolog-file ... loads the given Prolog files
>    (extensions .pl and .qlf; this is processed *before* ~/.plrc).
>
>  - swipl [option ...] script-file arg ... processes script-file and
>    passes the remaining options in the flag argv.  A script file
>    is a file with any extension that starts with #!
>
> Updated all packages.  Also updated ClioPatria to deal with this.
>
> Sorry for the inconvenience.  Notably the change of the =argv=
> flag will force changing some programs.  I think this was
> unavoidable, considering established practice.
>
> If you see opportunities to further simplify things or reduce
> compatibility impact, let me know.
>
>         Cheers --- Jan
> _______________________________________________
> SWI-Prolog mailing list
> [email protected]
> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.