Subject: Re: Please help me with strings

From: Jan Wielemaker <[email-masked]>
Date: Mon, 29 Nov 1999 10:30:15 +0100

On Mon, 29 Nov 1999, Uwe Lesta wrote:
>Hello,
>
>assume that style_check(+string) is true.
>
>If i ask interactive in the toplevel window
>        20 ?- string("string").
>        Yes
>        21 ?-
>But this program fails cause "string" is readed as a list of chars.
>
>t_str:-
>    style_check(+string),
>    string_to_atom(Str, 'string'),
>    string(Str),

This succeeds (at least by me)

>    string("string"),
>    Str == "string".

But this will fail unless the style-check was active at read-time.
Please note that style-check(+string) is mapped to the prolog
flag double_quotes, which is module-local.

>What must I do that this is true ??
>
>t_str2:-
>    string_to_atom(Str, 'string'),
>    Str == "string".

As long as the prolog flag is fine, there is no problem.  In general
however stay away from strings.   This is especially true for 3.3.0
beta-4 that will have an atom-garbage collector.  There is just too
much confusion about how a string is represented.

	Regards --- Jan