Day 111: Hyper operators and named blocks.

autrijus on 2005-05-23T00:36:49

I mentioned yesterday that hyperoperators are coming soon. As expected, today iblech and I hacked them in. Now all prefix, infix and postfix operators have hyper forms, regardless of whether they are user-defined or builtin:

pugs> (1,2,3) >>-<< (4,5,6)
(-3, -3, -3)
pugs> -<< (4,5,6)
(-4, -5, -6)
pugs> sub postfix: { [*] 1..$_ }; (4, 5, 6) >>!
(24, 120, 720)
But it gets scarier when you mix hyper metaoperator with reduce metaoperators:
pugs> [+]<< ([1,2], [3,4]);
(3, 7)
pugs> [+]<<<< ([[1,2], [3,4]], [[5,6], [7,8]])
((3, 7), (11, 15))

iblech implemented FIRST {...} with trailing undef, INIT {...}, and CHECK {...}. Together with the existing support for BEGIN {...} and END {...}, we have a pretty good coverage of global closure traits now. Next in sight would be things like PRE and POST...

clkao is working on Benchmark.pm, which really wants times() support. I walked him through the implementation and testing in 30 minutes; Corion then ported the underlying getProcessTimes Haskell function to Win32.

clkao tweaked cmp_ok() from Test.pm to show the name of the comparison operator used. I hacked in &code.name to support this, as well as &code.arity.

Juerd added quickref/reduction for reduction metaoperators, and iblech contributed some more examples to it.

Backtrace in error messages is now much more legible:

$ ./pugs -e 'sub{ sub {die "Error!"}.() }.()'
*** Error!
    at -e line 1, column 1-32
       -e line 1, column 6-28
       -e line 1, column 11-23

iblech added the ability of dumping raw AST structure to the interactive shell. Following that, I reorganised all commands in the shell to being with :. Hopefully this will eliminate the confusing situation of !1 evaluating to 1 in the shell.

Stevan continued to study metaclass koans, aiming for grokking the inner working of Perl 6's OO model. He recorded his current understanding in the Perl 6 Meta Meta Class Hierarchy document.

Also in the metamodel front, mugwump updated Perl 6 Meta Model with the latest insights.

asavige added some precedence tests, more todo tests to assign, and reported that 1..Inf as parsed as &.Inf(1). I fixed it a while later.

I also implemented the three "yada" literals: ??? that warns, !!! that dies, and ... that fails -- i.e. dies when use fatal is in effect, otherwise return a delayed error that dies when actually evaluated.

gaal added missing signatures for the Win32-specific parts of source code. With this, Haddock will finally recognise all our toplevel functions.

knewt, our new committer, made the backend part in command line parsing case-insensitive, so pugs -Bparrot will also work.

Aankhen added support for stringifying cookies to CGI.pm, un-evalled passing OO tests, and cleaned up operator_overloading.t.

adehohum added many tests, ranging from OO, syntax, operators to rules. scook0 also added tests for exclusive-range operators.

eric256 improved the wizard.p6 game by adding rooms and more enemies -- it seems that the player doesn't stand a chance against the Skeleton -- but curiously, fleeing from the room made the enemy disappear. This bug would probably not last for long...