September 2017 Archives

graphql-perl - MooX::Thunking - Deferred computation attributes

As part of porting GraphQL to Perl (sponsored by Perl Careers), one of my goals is to use the best possible practice in making rigorous code. One way to use this is to imitate the style of the JavaScript reference implementation's use of immutable data structures.

One problem arising is creating objects that have a reference to themselves. If the objects created were mutable, then one would simply create the object, then set the relevant attribute to include the object reference. If the objects are immutable this is not possible. For example:

About Mohawk

user-pic I blog about Perl.