KJS::Value::isValid()
Maciej Stachowiak
mjs@apple.com
Fri, 24 Jan 2003 17:19:40 -0800
On Friday, January 24, 2003, at 05:14 PM, Harri Porten wrote:
> In KDE 3.1 I introduced Value::isValid() and deprecated isNull().
>
> --- value.h Sun Jan 12 02:47:49 2003
> +++ value.h Sat Jan 25 01:45:22 2003
> @@ -179,17 +160,28 @@
> ~Value();
>
> Value& operator=(const Value &v);
> + /**
> + * Returns whether or not this is a valid value. An invalid value
> + * has a 0 implementation pointer and should not be used for
> + * any other operation than this check. Current use: as a
> + * distinct return value signalling failing dynamicCast() calls.
> + */
> + bool isValid() const { return rep != 0; }
> + /**
> + * @deprecated
> + * Use !isValid() instead.
> + */
> bool isNull() const { return rep == 0; }
>
> Latter's name was an endless source of confusion with the Null type.
> Now
> it might be time to drop isNull() in its current form completely. I'd
> rather like to see a series of isNull(), isNumber(), isString() etc.
> functions for convenient type checks.
>
> It would be great if you could also add this function in JavaScriptCore
> and go through the code and replace all occurences of isNull() with
> !isValid() and vice versa. I admit that's a bit tedious. Be careful :)
I'll work on incorporating this change. Are there other particularly
important changes we should pick up from 3.1?
- Maciej