* Nicholas Clark <nick@ccl4.org> [2021-07-06 12:57:31 +0000]:
> On Tue, Jul 06, 2021 at 10:03:56AM +0000, Nicholas Clark wrote:
>
> > Also, JSON can't serialise all things that Perl objects can contain.
> > Most blatantly, references to scalars:
>
> > There isn't actually anything "blessed" here - I think that this object in
> > the error message is part of the internal implementation.
>
> No, the problem is that the tide went out in my coffee mug.
>
> perl -MCpanel::JSON::XS -lwe 'my $j = Cpanel::JSON::XS->new(); print $j->encode(\$a)'
> cannot encode reference to scalar 'SCALAR(0x556b542a3918)' unless the scalar is 0 or 1 at -e line 1.
>
> The rest still holds:
>
> > So "unbless" doesn't just solve the problem of TO_JSON. There will still
> > be objects that need to be thought about.
> >
> > And as (I think) Chris Prather observed, if one "unblesses" an object, that
> > likely will break any object that was relying on DESTROY.
> >
> >
> > "unbless" might be a reasonable idea, but it doesn't safely solve the
> > general problem of serialisation of data structures containing objects.
> > Likely trying to use it to would actually make things worse.
So what I've gathered from most replies is:
1. "unbless" is a reasonable idea
2. some don't like my reason why it's reasonable for my use cases
Can you tell me why you think it's reasonable? And rather than try
to disprove my personal reasons for thinking its also reasonable,
can we focus on why it's generally reasonable - since consensus
seems to be that it is, in fact, a positive suggestion? This might
help us generate even more "reasonable" ideas, and help us tune
into what sort of reasons are used to determine this for more
healthy and productive discussions.
We even might be able to learn as a group how to collaborate, or
maybe I'll just learn how to be a better contributor.
FWIW, I am not trying to solve the general issue of "serialization".
Sometimes I just want to "unbless" something that I have previously
blessed. Nothing fancy, no recursion (we don't expect 'bless' to
act recursively).
Also, I very much appreciate all the positive comments and Paul's
willingness to add this to Scalar::Util.
Cheers,
Brett
>
> Nicholas Clark
--
--
oodler@cpan.org
oodler577@sdf-eu.org
SDF-EU Public Access UNIX System - http://sdfeu.org
irc.perl.org #openmp #pdl #native
> On Tue, Jul 06, 2021 at 10:03:56AM +0000, Nicholas Clark wrote:
>
> > Also, JSON can't serialise all things that Perl objects can contain.
> > Most blatantly, references to scalars:
>
> > There isn't actually anything "blessed" here - I think that this object in
> > the error message is part of the internal implementation.
>
> No, the problem is that the tide went out in my coffee mug.
>
> perl -MCpanel::JSON::XS -lwe 'my $j = Cpanel::JSON::XS->new(); print $j->encode(\$a)'
> cannot encode reference to scalar 'SCALAR(0x556b542a3918)' unless the scalar is 0 or 1 at -e line 1.
>
> The rest still holds:
>
> > So "unbless" doesn't just solve the problem of TO_JSON. There will still
> > be objects that need to be thought about.
> >
> > And as (I think) Chris Prather observed, if one "unblesses" an object, that
> > likely will break any object that was relying on DESTROY.
> >
> >
> > "unbless" might be a reasonable idea, but it doesn't safely solve the
> > general problem of serialisation of data structures containing objects.
> > Likely trying to use it to would actually make things worse.
So what I've gathered from most replies is:
1. "unbless" is a reasonable idea
2. some don't like my reason why it's reasonable for my use cases
Can you tell me why you think it's reasonable? And rather than try
to disprove my personal reasons for thinking its also reasonable,
can we focus on why it's generally reasonable - since consensus
seems to be that it is, in fact, a positive suggestion? This might
help us generate even more "reasonable" ideas, and help us tune
into what sort of reasons are used to determine this for more
healthy and productive discussions.
We even might be able to learn as a group how to collaborate, or
maybe I'll just learn how to be a better contributor.
FWIW, I am not trying to solve the general issue of "serialization".
Sometimes I just want to "unbless" something that I have previously
blessed. Nothing fancy, no recursion (we don't expect 'bless' to
act recursively).
Also, I very much appreciate all the positive comments and Paul's
willingness to add this to Scalar::Util.
Cheers,
Brett
>
> Nicholas Clark
--
--
oodler@cpan.org
oodler577@sdf-eu.org
SDF-EU Public Access UNIX System - http://sdfeu.org
irc.perl.org #openmp #pdl #native