[Dbix-class] Operator Overloads in DBIC?

Paul Bennett paul.w.bennett at gmail.com
Tue Mar 8 05:36:34 GMT 2016


On Mar 7, 2016 07:57, "Peter Rabbitson" <rabbit+dbic at rabbit.us> wrote:
>
> On 03/07/2016 01:25 PM, Paul Bennett wrote:
>>
>> Hi, DBICers,
>>
>> I have most of a spec (and a tiny bit of pseudocode) prepared for
>> adding operator overloads to Result Sets, to make it easier to write &
>> reuse pieces of queries in a style more like Relational Algebra &
>> Tuple-Relational Calculus.
>
> This is an interesting experiment.

Thanks. You wouldn't believe the mess I got into trying to spec it before
DBIC came into my life.

> It is especially intriguing how the above will deal with corner cases of
non-trivial-selection resultsets.
>

I can't say that I don't expect interesting times.

> Please continue pursuing this ;)

Your enthusiasm has doubled my resolve.

>> However, if I subclass, then I (or someone) would end up writing
>> Dancer2::Plugin::DBIC::Algebra (or whatever the naming ends up being),
>> and so on

> Your relational algebra plugin has no bearing on such an orthogonal
concept as "web framework model" - your users would simply
'load_components()' your plugin as part of their base resultset class.
>
> However as I described in the rest of my reply - the immutability of
DBIx/Class/ResultSet.pm is of little consequence. Your idea belongs
squarely in an extension/component, which due to DBIC's design is rather
natural and least-effort way to gain extra functionality.
>
> For extra inspiration look through this library of ResultSet components:
>
https://metacpan.org/source/FREW/DBIx-Class-Helpers-2.032000/lib/DBIx/Class/Helper/ResultSet

See, there are two words already that I wish I'd known before: helper &
component. Some very interesting stuff there.

> Feel free to ask further questions - the underlying work is very
interesting!
>

Thanks again. I hope I haven't bitten off more than I can chew, but time
will tell.

--
Paul W Bennett
P/PW/PWBENNETT
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20160308/e51a1655/attachment.htm>


More information about the DBIx-Class mailing list