Day 44: Fashion you may call() it; .goto, .goto

autrijus on 2005-03-16T21:12:54

During my refactoring of arith.t, I noticed the need of wrapping the ok() and preserve the error reporting done inside with $?CALLER::POSITION, so I queried how to extend this Perl 5 trick into Perl 6, perhaps with the wrap()/call() combination:

{
    local @_ = ($lhs == $rhs, $todo);
    goto &ok;
}

Shortly after, Larry answered that while caller() may choose to ignore the call() scope, it does not really erase the current scope from the calling chain; to do that, he suggested the .goto() form would be good too. That makes me very happy, so I promptly hacked it together in 10 minutes. So now this works:

&ok.goto( $lhs == $rhs, $todo );

Another thing that took me much longer is tracking down the annoying GHC bug that prevents it from using the wint_t type available from FreeBSD libc, which renders Unicode programs like sub 常式 ($變數) { ... } unparsable. Annoyed by the multitude of bugs, I hacked together Unicode.hsc and Unicode.c , converted from Perl 5.8.6's unicore/ data. I really like GHC's ability to practically inline any C code, and I'm happy to report the Unicode semantic now applies across all platforms, with no noticeable performance penalty.

In other news, lightstep hacked :l into the interactive shell, so we can more easily debug modules. He also improved error reporting in the shell, and conspired with me on moving the pad into the new VThunk type, as well as plans on producing a real compiler that may target any(<Haskell Parrot C-->).

Speaking of VThunk, it was added today to rescue our mad golfer from the punishing sand trap. So short-circuit works again in Pugs now; as an added bonus, I also implemented nor.

I have also spent some time to convert the group p6ification project Algorithm::Dependency into the selfless style, namely replacing all $self.method calls into .method and member variables into $.var. I have but done the two main modules, so volunteers welcome to complete the rest.

There have been various reports that some versions of Win32 fails to build Pugs; Ingy today got to the bottom of it and proclaims that it is now Fixed For Real. Win32 users, please update to the latest repository trunk and try again; thanks for your patience! :)

malarie asked various insightful question on #perl6, culminating in the successful implementation of rindex(). We still need a better grasp of when to use multi subs and when to use optional parameters, but we are learning as we go. Plus, Rod's S29: Builting functions looks like a promising start toward this direction. It even comes with reference implementations, which is one of the many things I like about the Haskell Report. Wonderful.

On the test front, Stevan continues to improve Test.pm, including the test suite for Test.pm itself. nothingmuch collected tests from various sources, including asavige, and committed them in. scw added comprehensive tests for his favourite ternary operator ?? ::. mattc, our newest committer, added tests for time, times, localtime and gmtime. I also restored basic.t to sanity.

By the way, today my total commits fell below 50% -- we are at the 813th revision, and I'm responsible for only about 400 of them. I expect the percentage to continue falling as Pugs matures; this makes me really, really grateful to the wonderful team of committers. Thank you, folks!

So, with YAPC's Hackathon drawing near, I'm drawing up plans on 6.2.0 and beyond: the use of thunks, ITypes and Perl5 "magics", meta model of the Class system, and the Rules parser are among the many things I'm experimenting with. Stay tuned!