Re: Dollar sign.
"Richard A. O'Keefe" <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 29/01/2014, at 10:02 PM, Jan Wielemaker wrote: > See > > http://www.swi-prolog.org/pldoc/doc_for?object=section%28%27sec:topvars%27%29 "Reuse of top-level bindings" says what $X means when X is a variable. From that description, I for one expected this to be a *lexical* thing, so that $X saved value of X $(X) error $foo error etc. It is way too confusing if $foo is '$'(foo) but $Foo is not '$'(Foo). Consider also ?- ?- Y = true, $Y. ERROR: variable `Y' does not exist I see that, and say "WTH? Y most certainly does exist, look, there it is". It would be clearer if this message were ERROR: the interactive level has not yet saved any value for Y. I suggest that $<variable> should be handled in the parser, and that $ should *not* be a predefined operator. The reason I suggest that is this example: ?- V =.. [$,_], portray_clause(g(V, V)). => g($A, $A). V = $_G1611. The system should not (by default) *produce* $<variable> in output. The simplest way to ensure that is to stop $ being an operator.