Chained mutators can
in reply to Mutator chaining considered harmful
Here's a snippet from my own code. This probes a
real-time audio application with a five channel
- Save typing
- Create symmetry
- Result in clearer code.
Want to see another channel? Call anatrace again.
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)
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