Subject: | Cached accessors - minor problem |
I just saw 1.12_01 being released - the cached accessor stuff is an
awesome awesome idea. It in fact obviates the need for me to deal with
the CAG inherited type we were talking about (more detail about
implementation here:
https://metacpan.org/source/RIBASUSHI/Class-Accessor-Grouped-0.10004/lib/Class/Accessor/Grouped.pm#L237)
However there is a problem - the method names. First of all they are
short and common enough to virtually guarantee clashes with existing
software. For example I can not add a _set method to the DBIC
ResultClass inheritance chain, as there is an extremely high chance an
actual user of said library already has such methods. I propose
something like _xsa_cached_get / _xsa_cached_set.
Furthermore the way you implemented this it will be quite complicated to
retrofit it into larger frameworks like Moo or Class::Accessor::Grouped,
as we now need to implement a flexible accessor dispatch table inside
the _set/_get subs (i.e. what to do on 'foo', what to do on 'bar', etc).
Again CAG is a good example on why this is a problem:
https://metacpan.org/source/RIBASUSHI/Class-Accessor-Grouped-0.10004/lib/Class/Accessor/Grouped.pm#L100.
We currently only use XSA for the 'simple' type (and go to hreat lengths
to make sure we do not short-circuit a user-defines get/set_simple, e.g.
https://metacpan.org/source/RIBASUSHI/Class-Accessor-Grouped-0.10004/lib/Class/Accessor/Grouped.pm#L654)
Is it possible to compile the accessor name into the method as well?
Something like _xsa_cached_get_foo / _xsa_cached_set_foo?
Cheers!