Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • while is just sugar for recursion.

    • Aye. Had I needed to emulate while, I might have gone down that route. Better have that tail-call optimizer ready, though, or longer loops will blow the stack.
  • Code generation is OK if it's transient -- passed straight to a compiler and run. If instead it's written to disk as a template, then it's just formalized copy-and-paste, with all of the maintenance downsides.

    The biggest drawback to runtime code generation is obscurity. It's opaque to static analysis and smat editors, and to most humans too.

    • The biggest drawback to runtime code generation is obscurity. It's opaque to static analysis and smat editors, and to most humans too.

      Indeed. A static analyzer would have to be really smart to figure out that I'm collecting together little pieces of code as I traverse the AST...

      Oh, and there seems to be another cardinal law involved in code generation: whatever happens, don't ever expect both your programs to look nicely indented anymore.

      • In the worst case, you can use templates for the generated code. That pulls the odd indentation out of the main code.

        • I might give it a try. It does solve the templating issue, but it introduces distance between the templates and the place(s) where they're used. It's a bit of a lesser-of-two evils situation.

          • True. Java is actually lucky in this area: it's trivial to embed an arbitrary file in a Jar file right next to the .class that uses it.

  • You have discovered the criteria for Turing completeness. :-)

    • Well yes, but not just that. I'm using the property of universality to bend a burgeoning language to my will. It's taking the general stance described in my blog post "Attitude [perl.org]" (that most bugs or missing features have a workaround), and applying it to control flow.

      Maybe the point I'm proving is mainly for myself, but if I can make GGE behave like PGE (only slower), I've shown something about the capabilities of Rakudo.