Introduce new internal SV value PL_sv_not_exists
acting like PL_sv_undef
in most cases (in every case when feature is not enabled).
PL_sv_not_exists
will be used when value is not initialized yet.
- when key lookup doesn't exist (without autovivification)
- when optional parameter is not provided
- when variable is not initialized
- to be able to distinguish between uninitialized value and value initialized to
undef
- hash slices - to be able to distinguish between "key didn't exist in master hash"
vs. "key set to
undef
in master hash" - to prevent autovivification (overlaps with RFC-0021 but optional chaining is implicit)
- leads to:
Data::Path
-like extension capable to set value tonot_exist
-ing lookup (with necessary autovivification)
Some overview of changes in language (lot of boring details omitted)
- new feature
not-exists
- new internal constant SV
PL_sv_not_exists
will be treated likePL_sv_undef
except ofPL_sv_not_exists
specific behaviour - every dereference of
not_exists
will result intonot_exists
- new postfix operator
?
- returning
not_exists
forundef
,not_exists
,builtin::false
- returning
- new postfix operator
!
- returning
undef
when argument isnot_exists
- returning
exists
- will accept also scalar (holding
not_exists
value)
- will accept also scalar (holding
delete
- will accept also scalar
- will set value to
not_exists
- SQL and its
NULL
- Javascript and its
undefined
- previous thread https://perl.markmail.org/message/lupj45g6bxkw2hrl
- PerlX::Maybe
- RFC-0021 - optional chaining
this pre-RFC wraps intended usage of optional chaining completely with small difference,
instead of single operator
?->
there will two operators?
->