Too much interesting subprojects going on simultaneously, plus I lost a half-formed journal due to accidental battery draining, so here is just some random sketches. (Also see my preliminary Hackathon-Plan for some starting points.)
11 months ago, I noted that getting Leo on IRC was the wisest course of action I made during Pugs development did till that Day -- now I think it's appropriate to express that sentiment again, as Larry is now on #perl6 and #parrot as TimToady!
In other news, I've been ghost-writing for Larry, committing various Synopses changes that cleared up much of the warnocked ambiguities raised on p6l and #perl6, which were blocking proper code generation to Perl 5 and Parrot:
- "package Foo; our $x; package Bar; $x" no longer leaks across package scopes, because switching packages in the middle of a file is disallowed -- "package Foo { our $x; package Bar { $x } }" is still fine, with the usual explicit lexical scoping semantics.
- Consequently, "sub foo" and "our sub foo" are now completely synonyms.
- "my $x = sub foo { ... }" is now legal, because named declaration forms are now expressions, just like their anonymous counterparts. Therefore the dreaded a/an anonymizer is gone for good -- just use "my $x = my Int sub foo { ... }".
- "my Dog $fido .= new" is fully explained -- $fido is bound to ::Dog in compile time as soon as it's declared. The ::Dog prototype object is both undefined and false (but has an .id and .isa(Dog)), and dispatches .new as any other Dog instance would.
- Consequently, "method meth { self ?? self.instance_method !! self.class_method }" becomes an idiom much like "sub meth { ref($_[0]) ? $_[0]->instance_method : $_[0]->class_method }" in Perl 5.
- Rules now assumes full parser combinator power, by allowing "/(\d+) { return $0.sqrt } /" to match against a number but captures its square root. They also live in the same namespace as methods.
- Consequently, "grammar Foo { method bar {...}; method baz {<bar>} }" is valid.
- use_ok() is now implementable and can import into the compiling lexical scope. It can be written as:
macro use_ok ($module, *@import) {
require $module :COMPILING<@import>;
KEEP { return q:code { say "ok" } }
UNDO { return q:code { say "not ok" } }
} - The above works because we cleared up the semantics of return inside KEEP/UNDO, made require capable of importing into lexical scopes, plus the capability of doing quasiquoting via CODE.
- "./pugs -O" can close the packages and disallow runtime introduction of new symbols, which affects GLOBAL as well. This allows early binding for almost everything, though the object code needs to be saved under a different extension, as the linker cannot handle linking of mixed optimised/unoptimised modules.
- "self.foo" now has context-hinted shorthands: "$.foo", "@.foo", "%.foo" etc. This works because "accessors" are dispatched exactly like methods now, so they are made into methods.
- Consequently, "@.foo(1,2,3)" means the same thing as "list self.foo(1,2,3)".
There's more -- much much more, as the sheer productivity of ten lambdamøøse are unstoppable (and nearly unbackloggable) -- but I'll split them into separate journal entries. :-)
Hey, any photos about the Hackathon? :) I want photos about geek people together!!!
Posted by: András Bártházi | 2006.02.24 at 05:40 AM