On 12/5/05, Gaal Yahas <[EMAIL PROTECTED]> wrote:
> There's a bikeshedding question of some visibility: now that we have a
> C<fail> builtin, what do we do with C<Test::fail>?

Is it possible to do nothing with it?  That is, can we coerce the Test
module to understand when the main program "fail"s?  This may be
problematic, as it is occasionally desirable to call "fail" from
within a function while you are testing.

There's another problem that I've been thinking about with regard to
Test.  We have the prefix:<is> builtin, used like so:

    class Foo {
        is Bar;
    }

Which can be interpreted as a regular compile-time function (I guess
we call those macros) that acts on some topic container (think io[1]).
 So we seem to have stolen that from Test, too.

I wonder if there is a macroey thing that we can do here.  That is,
could we make:

    ok(1);
    is(1, 1);
    like("foo", /foo/);

Into:

    ok(1);
    ok(1 == 1);
    ok("foo" ~~ /foo/);

And lexically analyze the argument to ok() to find out how to report
the error?  Something in the style of Smart::Comments which looks at
subexpressions and tells you about them automatically.

The only downside is that you can't refer to &ok as a coderef.  I
think that is a small price to pay for such a wonderful DWIMmity.

Luke

[1] http://www.iolanguage.com

Reply via email to