I should have mentioned it in the main post, but I wanted to avoid eval for several reasons:
- There is a pretty hefty performance penalty when doing string eval
- What do I do with syntax errors? If I'm stitching subrefs, I know they compile.
- 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:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.