http://qs1969.pair.com?node_id=417951


in reply to Mutator chaining considered harmful

Chained mutators can Here's a snippet from my own code. This probes a real-time audio application with a five channel OpenGL oscilloscope:
my $s= Scope->new('probe' => $netlist) ->anatrace('in', 'System input', 'active', 1) ->anatrace('out_1', 'Lpf bank1', 'active', 1) ->anatrace('out_2', 'Lpf bank2', 'active', 1024) ->anatrace('out', 'System output', 'active', 1) ->anatrace('bank2', 'Switch pos', 'active', 1) ->generate();
Want to see another channel? Call anatrace again.

I don't think that features with potential downsides should be 'considered harmful'.

It is possible to create a 'little language' out of chained method calls. I avoid creating little languages because I have seen a few of them grow into voracious blood-sucking monsters. I can enjoy chaining method calls without fear of triggering a science-related memetic disorder.

It should work perfectly the first time! - toma