Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Pugs-PIL: Containers adopts Roles.

0 views
Skip to first unread message

Audrey Tang

unread,
Jan 2, 2006, 2:53:28 PM1/2/06
to perl6-c...@perl.org

Today Stevan started writing out Roles for container types, so there can be multiple classes that implements the Hash/Array/Scalar interface, so operations like .{} and .[] can apply to user-defined types as well.

This is similar to the Perl 5 way of using the "tie" interface, as well as overloading @{} and %{}, but because Perl 5 is a strongly typed language with only five ($@%&*) container types, ultimately you need to decompose the user-defined class to one of those five things, XS-based solutions like PDL notwithstanding.

With roles, user-defined classes can be first class citizens that conform to various interfaces (pair, args, sigs, list, ranges, etc...), and it'd be much easier to write an ordered hash class that does both the Array and Hash interface.

We are working toward something like Scala's traits hierarchy, starting with the bare minimum already defined in docs/quickref/data.

As the main Bootstrap.pil is getting huge with the container type interfaces, I factored them out into multiple small files in src/PIL/Native/Bootstrap/. The next step for me is to create another surface syntax for PIL2 -- this time a bare subset of syntactically-valid Perl 6 -- and compile it to the already-running-fine bootstrapped PILN runcore.

The compiler itself will have access to an object space, and simply serialize the final (garbage-collected) state as the executable image, ready to be run by invoking the main routine in &*::(''). Once we can pass the t/01-sanity/ tests with this compiler, the rest of the job is to port all desugaring, primitives, as well as other assorted magics from the old runcore over, a process not unlike what iblech has been doing for the JavaScript runcore. Stay tuned...

signature.asc
0 new messages