Hi!

string a = "";
string b;

writeln(a ? "a" : "null");
writeln(b ? "b" : "null");


This program outputs:
a
null



What?

I suppose this is by design, but are there any plans to deprecate this?

I understand this happens because in this context, string.ptr is evaluated, but should a string really have the semantics of string.ptr depending on the context?

Having 2 empty strings evaluate differently is very unintuitive and error-prone, in my opinion.

Reply via email to