> Is the rule of 'if-non-null' changed?

Yes.  This is a good question.  I hope it is answered in the 4.0
release notes but I do not have a copy with me.

Curl has always disallowed comparisons that do not make sense,
such as comparing a String to an int:

    {if "hello" == 7 then ...}

Writing such code indicates a programming error and is therefore
disallowed.

Similarly, comparing null to a value which cannot be null, such as a
String, is also a common programming error.  There is no reason to
write 'if-non-null' for a value which cannot be null, so the compiler
now disallows it.  Previously it would only disallow it if you turned
on compiler-directives such as 'stringent? = true'.  But the treatment
of useless null comparisons was inconsistent with other useless
comparisons for no good reason so we made them the same.

If you actually want a value which can be either a String or null, you
should use the #String type instead.  if-non-null will work fine with
that.

Usually this error message indicates a bug in the code, and the code
should be fixed to eliminate the useless comparison to null.  However,
rare 3.0 code used null comparisons to see if a String held the
special value {uninitialized-value-for-type String}, in other words a
String value which was not yet assigned.  If you have such code, you
can either change the type of the variable to #String, or if that is
too hard, use "asa #String" where you are getting the error.
This will work in both 3.0 and 4.0.

I hope this helps!

-Mat

*******************************************
To unsubscribe from this list, send a mail to:
mailto:[EMAIL PROTECTED]
To contact a human list administrator, send a mail to:
mailto:[EMAIL PROTECTED]
To recieve a list of other options for this list, send a mail to:
mailto:[EMAIL PROTECTED]

Reply via email to