pike.git / lib / modules / Val.pmod

version» Context lines:

pike.git/lib/modules/Val.pmod:88:   //! They produce @expr{1@} and @expr{0@}, respectively, when cast to   //! integer, and @expr{"1"@} and @expr{"0"@} when cast to string. They   //! do however not compare as equal to the integers 1 and 0, or any   //! other values. @[Val.true] only compares (and hashes) as equal with   //! other instances of @[True] (although there should be as few as   //! possible). Similarly, @[Val.false] is only considered equal to   //! other @[False] instances.   //!   //! @[Protocols.JSON] uses these objects to represent the JSON   //! literals @expr{true@} and @expr{false@}. + //! + //! @note + //! The correct way to programmatically recognize these values is + //! something like + //! + //! @code + //! if (objectp(something) && something->is_val_true) ... + //! @endcode + //! + //! and + //! + //! @code + //! if (objectp(something) && something->is_val_false) ... + //! @endcode + //! + //! respectively. See @[Val.null] for rationale.      //! @class Null   //! Type for the @[Val.null] object. Do not create more instances of   //! this - use @[Val.null] instead.      constant Null = Builtin.Null;      //! @endclass      Null null = Null();
pike.git/lib/modules/Val.pmod:125:   //! @expr{null@}.   //!   //! @note   //! Do not confuse the null value with @[UNDEFINED]. Although   //! @[UNDEFINED] often is used to represent the lack of a real value,   //! and it can be told apart from an ordinary zero integer with some   //! effort, it is transient in nature (for instance, it automatically   //! becomes an ordinary zero when inserted in a mapping). That makes   //! it unsuitable for use as a reliable null value.   //! + //! @note + //! The correct way to programmatically recognize @[Val.null] is + //! something like + //! + //! @code + //! if (objectp(something) && something->is_val_null) ... + //! @endcode + //! + //! That way it's possible for other code to replace it with an + //! extended class, or create their own variants which needs to behave + //! like @[Val.null]. + //!   //! @fixme   //! The Oracle glue currently uses static null objects which won't be   //! affected if this object is replaced.