August 2008

Sun Mon Tue Wed Thu Fri Sat
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Recently on this blog
Recently on other blogs

Map

Audrey

My Photo

License

« Perl 6 mailing list summary for the month of June, 2006 | Main | Perl 6 mailing list summary for the month of July, 2006 »

2006.08.12

Val migration

The primary difficulty in moving over to the new internals are that it's hard to make a huge all-encompassing change in a project. We're not just changing the internal representation of strings from one form to another. Encapsulation and type inference would make that task certainly manageable. The present change affects virtually all Perl types, obsoletes the widely-used VRef, and changes the way AST expressions are strung together.

Another problem is that the new AST is much more detailed than the old one, and putting all its definitions in one file makes it hard to maintain/understand all at once. Also, although this AST definition should be shared by all Perl 6 implementations, the native value representations are backend-specific.

Armed with techniques from this paper, we can address both issues at the same time. Instead of a closed datatype for Val (starting from values instead of expressions makes migration easier), we make use of typeclasses where appropriate. A new (:>:) class lets us stipulate subset relationships cleanly, so a single cast method convers (old) Strings to (new) ByteStrings, but also a value to its Id when in Id context.

The work is going along nicely. We've added a VV node type in the old AST, and already we can construct newstyle values from pugs by casting them with the interim vv prim. This helps to keep us honest, as our code comes under constant scrutiny of the type checker and actually gets to be executed.

    pugs> vv "Moose"
    VPure (MkStr "Moose")      # look, not VStr!
    pugs> vv 42
    VPure (IFinite 42)
    pugs> vv 3.1415
    VPure (NRational (6283%2000))
    pugs> vv "22"/7
    VPure (NDouble 3.142857142857143)

Comments

Thanks for the update. Speaking of "Moose", I'm looking forward to object.meta.class_precendence_list working. :)

That's the one missing feature I've noticed that I need for the port of CGI::Application to Perl6.

Mark: Which tests in t/ tests that? :-)

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment