This is my first attempt at birthing an RFC, so forgive me for not
doing this quite right.
I propose the introduction of an "unbless" functionality that simply
undoes what "bless" does.
Based on my research, there are 2 modules that do this:
* Data::Structure::Util (river pos. score of "2")
* Acme::Damn
There is another, but this doesn't really count:
* Function::Fallback::CoreOrPP (wrapper around A::D, falls back to
dclone)
Other than providing an inverse operation to "bless", there are
a couple of use cases that I can see this really providing some
benefit:
1. eliminate, for most cases, the need to define a TO_JSON in
objects that one is wishing to serialize; idk about anyone reading
this but implementing this method always seem to just work around
the issue and rebuild the hashref based on the blessed reference
(i.e., I don't use any 'unbless' from CPAN)
2. somewhat related to #1, but it would greatly simplify "modern"
web framework request handling (e.g., Dancer2) by both encouraging
organized code reflective of RESTful API (object/verb friendly)
but make it easy to easily just send a hash reference for
serialization by the content fileter (e.g., JSON).
Obvious Solutions:
a. find an existing module for dual-use, and include it with core;
perhaps add this to Scalar::Util (seems like a good fit).
b. implement "unbless" internally
Looking forward to any thoughts on this one. If there is a positive
reaction to my pre-pre-RFC; I'm happy doing the research to look
for evidence of wide spread use of:
* Data::Structure::Util
* TO_JSON implementations
* other serializations done by effective/manual "unblessing"
My suspicion is this is a common pain point; I know it is for me.
And if we had an 'unbless' that was easily at hand, I would be
using it a lot and writing much less code to do something I know
should be available in a default installation of Perl.
Cheers,
Brett
--
--
oodler@cpan.org
oodler577@sdf-eu.org
SDF-EU Public Access UNIX System - http://sdfeu.org
irc.perl.org #openmp #pdl #native
doing this quite right.
I propose the introduction of an "unbless" functionality that simply
undoes what "bless" does.
Based on my research, there are 2 modules that do this:
* Data::Structure::Util (river pos. score of "2")
* Acme::Damn
There is another, but this doesn't really count:
* Function::Fallback::CoreOrPP (wrapper around A::D, falls back to
dclone)
Other than providing an inverse operation to "bless", there are
a couple of use cases that I can see this really providing some
benefit:
1. eliminate, for most cases, the need to define a TO_JSON in
objects that one is wishing to serialize; idk about anyone reading
this but implementing this method always seem to just work around
the issue and rebuild the hashref based on the blessed reference
(i.e., I don't use any 'unbless' from CPAN)
2. somewhat related to #1, but it would greatly simplify "modern"
web framework request handling (e.g., Dancer2) by both encouraging
organized code reflective of RESTful API (object/verb friendly)
but make it easy to easily just send a hash reference for
serialization by the content fileter (e.g., JSON).
Obvious Solutions:
a. find an existing module for dual-use, and include it with core;
perhaps add this to Scalar::Util (seems like a good fit).
b. implement "unbless" internally
Looking forward to any thoughts on this one. If there is a positive
reaction to my pre-pre-RFC; I'm happy doing the research to look
for evidence of wide spread use of:
* Data::Structure::Util
* TO_JSON implementations
* other serializations done by effective/manual "unblessing"
My suspicion is this is a common pain point; I know it is for me.
And if we had an 'unbless' that was easily at hand, I would be
using it a lot and writing much less code to do something I know
should be available in a default installation of Perl.
Cheers,
Brett
--
--
oodler@cpan.org
oodler577@sdf-eu.org
SDF-EU Public Access UNIX System - http://sdfeu.org
irc.perl.org #openmp #pdl #native