Perl has a special boolean false, which is simply a dualvar, zero in numeric context and the empty string in string context. You can get it from !! 0.
JSON supports \0 and \1 as shortcuts to JSON::true and JSON::false, but it would be very helpful if it could detect a ref to this dualvar and resolve accordingly.
That would turn constructs like this
($value ? \1 : \0)
into
(!! $value)
Which, although mildly awkward, seems like the sort of idiom we get in Perl, and is understandable after the first encounter.
Perl has a special boolean false, which is simply a dualvar, zero in numeric context and the empty string in string context. You can get it from
!! 0
.JSON supports
\0
and\1
as shortcuts toJSON::true
andJSON::false
, but it would be very helpful if it could detect a ref to this dualvar and resolve accordingly.That would turn constructs like this
($value ? \1 : \0)
into
(!! $value)
Which, although mildly awkward, seems like the sort of idiom we get in Perl, and is understandable after the first encounter.