in reply to Re: Composing or chaining subroutines
in thread Composing or chaining subroutines

I should have mentioned it in the main post, but I wanted to avoid eval for several reasons:
  1. There is a pretty hefty performance penalty when doing string eval
  2. What do I do with syntax errors? If I'm stitching subrefs, I know they compile.
  3. How do I stitch closures together?

The impetus for this was this syntax:

class Foo => { class_method 'c_foo' => signature (Int, Num(5)), body => { ... }; method 'foo' => signature (Any, Hash), returns ( Int ), body => { ... }; }; Foo->add_post_process( methods => 1, class_methods => 0, action => sub { ... }, );
The idea being that you first have a check for if the referent is a class name or a blessed reference into that class. Then, you have a check on the parameters being passed in. All of these are really easily done as closures. Except, now every single method call has some 10-40 subroutines that stack 2-3 above the body of the method which, itself, is stacked. That's a massive performance penalty, plus it makes debugging errors extremely difficult.

My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?