[sent only to jack instead of the list by mistake]
Anfang der weitergeleiteten E-Mail
Von: "Sven Schreiber" <svetosch(a)gmx.net>
Datum: 12. März 2018 um 08:54
An: r.lucchetti(a)univpm.it
Betreff: Re: [Gretl-devel] slight inconsistency with strstr truth value
Am 12.03.18 um 08:30 schrieb Riccardo (Jack) Lucchetti
> I'm sorry I'm chiming in only at this stage, but I find the whole issue
> quite confusing. In my view, Hansl should not aim at being too clever with
> strings. There already are many tools that are much better at that than
> Hansl will ever be (Python of course springs to mind). Maybe I'm being a
> little too conservative here, but in my eyes a Boolean expression is
> something that should unambiguously map to 0 or non-zero. True, "if foo"
> (foo being a string) can be interpreted as shorthand for "if strlen(foo)",
> but then the problem arises on cases like
>
> if foo || bar
> if foo && bar
> if foo * bar
> if foo + bar
> if !foo
>
> ("bar" being some arbitrary variable, such as a string but also possibly a
> scalar, a matrix etc), etcetera, in which we would have first to guess
> whether the intended outcome is Boolean or not and then act accordingly.
>
> Too complicated IMO. If it weren't for backward compatibility, I'd ban
"if
> <string>" altogether, but at this point I would guess we could allow
"if
> foo" (where "foo" is a named string, but not something that evaluates
to a
> string) for historical reasons, but no more than
Yes, I think that s the conclusion we’ve reached as well. And because it was undocumented
“if foo” will also be banned after the respective function packages (mine, perhaps
Oleh’s?) have been adjusted. At least that’s my interpretation of the discussion.
Cheers
Sven