Slash Boxes
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.
More | Login | Reply
Loading... please wait.
  • This is certainly an idea from Smalltalk that has been lost for the ages.

    As originally designed in Smalltalk, I think that the category descriptions for methods were done using metadata (comments):

    "methods for parsing"
    "methods for error handling"

    The code browser would respect these comments scattered about the code and use that information to simplify the display in the code browser.

    Putting this information into the op tree sorta sounds good, but modifying the syntax of the language (th

    • The catch with that approach is that the putative browser has to start parsing the source file to work out what's going on.

      If category information is just another attribute on the coderef then the browser doesn't have to start looking in the source to build its browsable structure, it only has to worry about it when you want the method listing.

      Of course, if B::Deparse's perl6 equivalent can be relied on to work in all cases, you don't even need to see the source, it can be regenerated from what's in memory.

      I'm wondering though if we're going to need to distinguish between the executable optree and some higher level abstract syntax tree. The AST would be far easier for tools/macros/whatever to monkey with but would (usually) get thrown away once you reach runtime...
      • The catch with that approach is that the putative browser has to start parsing the source file to work out what's going on.

        ....then that's a good argument to adopt macros or otherwise tweak the parser to take a =category comment as a way of specifying a category attribute on a sub.

        The category {...} syntax you propose looks like it's adding another level of lexical scope, when all it's doing is adding metadata. That sounds like an impedence mismatch to me.

        I'm less concerned about how the internals

        • The 'new scope thing' is a very good point; most of the time you really don't want to do that. And I don't want to have to think about

          class foo {
            my category private is private {
              sub foo {...}
              sub bar {...}

          I am convinced. I'm not sure I like your proposed syntax though.

          However, quibbling over syntax is beside the point. The point is that Perl6 is going to make it possible for us to do this sort of categorization.