Re: (Un)expected syntax error

Jan Wielemaker <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
On 07/30/2013 10:30 AM, Abramo Bagnara wrote:
>
> Is the following behavior expected?
>
> ?- writeln('volatile').
> volatile
> true.
>
> ?- writeln('volatile' : a).
> ERROR: Syntax error: Operator expected
> ERROR: writeln('volatile' :
> ERROR: ** here **
> ERROR: a) .
> ?- writeln(('volatile' : a)).
> ERROR: Syntax error: Operator expected
> ERROR: writeln(('volatile' :
> ERROR: ** here **
> ERROR: a)) .

Yes.  volatile is a high priority operator.
Putting it in '...' doesn't stop that (which I
still think is a mistake; only the many misconceptions
illustrate that).  So,

   ?- writeln((volatile):a).

or

   ?- writeln(:(volatile,a)).

are -I think- both legal according to the standard.

	--- Jan
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.