FP::Abstract::Pure - functional purity protocol
use FP::List; my $v= list(1); # or any other data structure that implements # FP::Abstract::Pure is UNIVERSAL::isa($v, "FP::Abstract::Pure"), 1; # Or use Safe::Isa instead of UNIVERSAL::isa, but I don't understand # why overriding isa is useful (why fake inherit as opposed to real # inheriting but then shadowing what needs to be shadowed? NEXT method # and that needs to be supported in mock classes? TODO figure out.) # but usually: use FP::Predicates; is_pure ($v) # true if $v is (officially) immutable, detectable from # inheritance of FP::Abstract::Pure or other means
Base class for all data structures that don't allow mutation (by ordinary programs), i.e. are persistent (1).
(1) as in https://en.wikipedia.org/wiki/Persistent_data_structure
More precisely, those objects that don't have methods that when called make other methods non-functions.