Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

autrijus (1505)

autrijus
  (email not shown publicly)
http://pugs.blogs.com/

Journal of autrijus (1505)

Sunday May 15, 2005
12:28 PM

Day 104: ./juerd('rocks!')

[ #24705 ]
Yesterday's punctuation dilemma was fixed by Juerd's nice proposal, namely using ./method as a shorthand for $?SELF.method. Larry calls it terminally cute, and I promptly implemented it in Pugs. Juerd++!

Lots of OO works were done today after I got my laptop back:

  • Inheritance in the form of class Foo is Bar { ... }
  • Private method definition with method :foo { ... }
  • Private method invocation with .:method
  • Private attributes now generates private accessor methods: has $:attr
  • Method interpolation in strings no longer eats up trailing whitespace, e.g. the space in "$obj.hello() World".
  • Parameterised return types is now parsed: method foo returns Hash of Int. I need to ask about how to define such parameterised classes some day...
  • Dereferencing: @{...} and %$foo etc.
  • Finally, I tweaked both wizards.p6 and Locale::KeyedText to use the new syntax.

Much thanks to Stevan, eric256, Darren and chromatic for their early adoption of Pugs OO. I'm happy to see that Locale::KeyedText, the first non-core Perl 5 module ported to Perl 6, is back to ext/ as it works now. Was it really only two months ago? :-)

In other news, in non-embedded mode (such as on Win32, by neccessity), Pugs 6.2.3 spawns one Parrot process for each Perl 6 rule match, which is horribly slow. I've written some more PIR so only one Parrot process is kept now.

Juerd helpfully informed me that the use of infix:<!> to construct none() junctions has been denied, so it's gone from Pugs.

eric256 p6ified life.p6 a bit, but notes that it's still slow. Well, that's what the Prarot compilation backend is for. Speak of which...

...Much to my delight, jhorwitz started hacking Pugs's Parrot codegen in earnest, in order to get mod_pugs working in mod_parrot. Hrm, should we call Pugs/Parrot people lambdabirds? :-)

scook0 and bsb diligently added more Haddock to Prim, Run and Monads modules. skew begins looking into the type tree implementation in Context.hs; hopefully we'll making it a proper directed graph some day to facilitate faster queries.

Stevan started writing tests for Test::Builder, which is dangerously close to fully functional now. He also updated meta_meta_classes.pod with a snippet of discussion between gaal and him, to explain the raison d'être of MetaMetaModels.

The ever-inventive iblech implemented an IRC log to HTML converter in Perl 6. It's not huge -- 300ish lines -- but neatly shows how real world Perl 6 scripts looks like.

Oh, and I submitted two talks to Euro OSCON today: Perl 6 in the Real World, and Learning Haskell. I think I may be a bit overboard on the description for the latter:

What's faster than C++, more concise than Perl, more regular than Python, more flexible than Ruby, more typeful than C#, more robust than Java, and has absolutely nothing in common with PHP? It's Haskell!

Tired of writing unit tests to cover corner cases? Let the computer write them for you with QuickCheck. Find regex-based parsing unmaintainable? Learn how to write a complete parser for Perl 6's grammar in 15 minutes with Parsec. Stuck in deadlocks and race conditions? STM solves all your concurrency woes. XS and SWIG gives you headaches? FFI lets you embed C code quickly and safely.

Haskell is an emerging general-purpose functional language, with unique features that enables extremely rapid development of bug-free, concise and maintainable code. This talk shows how to apply Haskell to day-to-day tasks, tips for integrating it with other languages, and secrets for boosting your productivity by an order of magnitude.

I blame the poignant why the lucky stiff for the influence. :-)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I am not so sure about meta-meta-classes, or at least not that name.

    Suppose you have a class Book. You refer to the class as Book, and instances of the class as Books. The same name is used interchangeably without confusion. I think that the same should apply to 'meta-class'. Just as Books are instances of the Book class, I think meta-classes are instances of the meta-class class.

    AFAIK The C<Class> class is the meta-class class in perl 6, and meta-classes are instances of C<Class> (what you ge
    • Hmm, my understanding is that meta-meta-class does not exist in the language per se; it is a concrete implementation of the metaclass in the compiler or interpreter itself. The user would have no way to directly access or manipulate meta-meta-classes -- it is essentially an "out of system" thing of interest only to language implementors.
    • Tom,

      As Autrijus pointed out, the meta-meta-class is not accesible in the "user space", but a language implementation level object. And the reason we are calling it the meta-meta-class is that it actually is not MetaClass itself, but a MetaClass is an instance of the MetaMetaClass. (it's confusing I know)

      To expand on your example: the class Book {} can be called "Book". When you call the meta method on Book, you will get an instance of the Class metaclass for Book, not the Class class.

      At some point

      --
      -stvn
      • Hi

        Thanks for your detailed response and amazing work getting oo going in pugs. Still twisting my brain into the right shape to fit this stuff in :-)

        As you say, calling C<meta> on the C<Book> class yields an instance of the C<Class> metaclass that describes the C<Book> class. My example takes this one step further by calling the C<meta> method on this metaclass and (by my assumption) getting an instance of the C<Class> metaclass that describes the C<Class> class. T
        • Tom

          Let me first say that we are venturing into unspecced territory here. So anything I say is subject to the whim of @larry.

          What said you is correct, with one minor adjustment. You said:

          My example takes this one step further by calling the meta method on this metaclass and (by my assumption) getting an instance of the Class metaclass that describes the Class class. This is based on my assumption that there is a cycle at the Class level

          But you missed a few metas :)

          My example takes this one ste

          --
          -stvn
  • Have you ever given consideration to writing a "Haskell in the Trenches" type of book? I don't know how big the market for such a book would be, but I know it would fill a much needed gap. Most Haskell texts seem to be aimed at the novice/beginning programmer. (e.g they spend chapters describing recursion, and devote only two sentences to using arrays). Haskell seems to have enough libraries and users and existing code out there to have progressed beyond the academic language stage. What is missing is