I know round trip conversion can't be perfect because Perl 6 has more null types than can be represented in JSON, but I suggest that null should mean Any whenever there's no other constraint, since this is the default Perl 6 type. (A variable with no constraint or value will be Any.)
> class MyClass { has $.foo; } # MyClass.new will serialize as '{"foo": null}'
(MyClass)
> unmarshal('{"foo": null}', MyClass);
MyClass.new(foo => Mu) # should be MyClass.new(foo => Any), equivalent to MyClass.new()
Interestingly, this already works if the variable has an Any type constraint on the variable (which I would have expected to have no significance):
> class HasAny { has Any $.foo; }
(HasAny)
> unmarshal('{"foo": null}', HasAny);
HasAny.new(foo => Any)
I know round trip conversion can't be perfect because Perl 6 has more null types than can be represented in JSON, but I suggest that
null
should meanAny
whenever there's no other constraint, since this is the default Perl 6 type. (A variable with no constraint or value will be Any.)Interestingly, this already works if the variable has an
Any
type constraint on the variable (which I would have expected to have no significance):