chromatic said:
> On Tue, 29 Oct 2002 14:19:59 -0800, Paul Johnson wrote:
>
>> So I would like to see able to tag arbitrary information onto just
>> about everything, including files, packages, classes, subroutines,
>> blocks, control structures, statements, lines, expressions, variables
>> and whatever else I've forgotten about.  Properties can be attached to
>> some of these.  Can we generalise this at all?
>
>> Of course, the applicability of this is not limited to code coverage,
>> so it would be nice to have something as general and multi purpose as
>> possible.
>
>> But I don't want language support for saying that, that seems to be a
>> problem for the applications that want the data, although I'd be glad
>> to be shown that I am wrong and that the language can support that in
>> a clean and concise way. Instead, I just want somewhere to hang
>> arbitrary data.
>
> Dan started a thread about bytecode in p6i:
>
>       http://archive.develooper.com/perl6-internals@;perl.org/msg13377.html
>
> I jumped on the "arbitrary metadata" soapbox, and finally distilled my
> thoughts down to this:
>
>       http://archive.develooper.com/perl6-internals@;perl.org/msg13443.html
>
> It sounds like we're thinking along the same lines.  This would be very
> handy for introspective tools (code coverage, refactoring browsers,
> IDEs...).


Yes, and this is the thread that insired me to post, or at least to post
now.  As I mentioned, the internals support is coming along fine, but what
I'm concerned about here is support at the language level.

For example, using the coverage property:

  sub check coverage(callable => $Debug && $OS ne "...")
  {
      my $v = shift;

      if ($v > 5).coverage(id => my $cond_id = $Id++)
      {
            ...
      }

      ...

      if ($v > 5).coverage(id => $Id++, same_as => $cond_id)
      {
            ...
      }

      if (($a ¦¦ $b).coverage(truth_table => [[1, 1], [1, 0]],
                              comment => '$a and $b can't both be true') ¦¦
          ($c && $d).coverage(truth_table => [[0, 1], [1, 1]],
                              comment => '$c and $d can't both be false'))
      {
          ...
      }

      exec $something;

      die("Whoops").coverage(coverable => 0);
  }

Coming up with sensible small examples is not easy, but hopefully you get
the idea.  How does the programmer tag the metadata onto the appropriate
construct?


-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net



Reply via email to