MO bridge landing!
After 3 months of delay, it was quite amusing that the initial MO bridge took only 3 hours to land:
pugs> vv('hello, world').HOW
^Str
pugs> vv('hello, world').HOW.HOW
^Class
(The vv() above is a makeshift call that casts 6.2.0-land values into 6.28.0-land objects; it will go away once all existing built-in types are wrapped into MO.)
To understand what the ^Class notation means, let's take a brief look at Perl 6's object model, as implemented by Pugs 6.28.0's MO (Meta Object) subsystem.
In a traditional class-based object system such as Ruby's, the String class would be an instance of the Class class:
irb(main)> String.instance_of?(Class) => true irb(main)> String.instance_of?(String) => false
Because of this, you can't call .new on a String instance, and you can't call .length on the String class:
irb(main)> String.new.new NoMethodError: undefined method `new' for "":String irb(main)> String.new.length => 0 irb(main)> String.length NoMethodError: undefined method `length' for String:Class
Perl 5, on the other hand, takes an unique approach: When we say IO::String->new, the IO::String is not a Class object -- rather, it is a prototypical IO::String object that has no attributes!
IO::String->isa('Class');
#=> false (perl5 doesn't have a built-in Class)
IO::String->isa('IO::String');
#=> true
IO::String->new->new;
#=> IO::String=GLOB(0x18ab160)
IO::String->new->getpos;
#=> 0
IO::String->getpos;
Error: Can't use string ("IO::String") as a symbol ref...
The advantage of this arrangement is that several object systems -- prototype-based, closure-based, et cetera -- can exist simultaneously in the same program, without having to inherit from an universal Class class.
However, a bare literal "IO::String" is a terrible way to represent a prototypical object: it makes reflection needlessly difficult, and the error message for accessing the non-existing attribute slot ("Can't use string as a symbol ref...") seems to obey the principle of most surprise.
Perl 6's solution to this is simple: The prototypical string object, spelled ::Str or simply Str (if it's in scope), is a genuine Str instance. However, any attempt to access its attributes raises a sensible exception. Just as in Perl 5, so-called class methods such as .new are simply those methods that does not access instance attributes, and you can call them on both ::Str and regular Str instances.
Calling an object's WHAT method returns the prototypical object. This replaces Perl 5's ugly ref($x) || $x idiom:
pugs> 'hello'.WHAT ::Str pugs> Str.WHAT ::Str
On the other hand, because Perl 6's builtin objects are backed by a normal class-based dispatch system, you can reliably obtain a list of all Str's supported methods, by querying the Class instance that implements ::Str:
pugs> vv('hello').HOW
^Str
pugs> vv('hello').HOW.methods
["HOW","WHICH","bless","reverse"]
So there we have it: the Perl5ish prototypical object Str.WHAT is also spelled ::Str, and the Rubyish class object Str.HOW is also spelled ^Str.
The next step is to expose all MO's meta-objects (Role/Method/Class/Object) into Perl 6 land, and adapt our Perl 5 bridge to use Moose.pm, such that a class Foo {...} declaration in Pugs can generate both Haskell-side and Perl5-side representations, and work seamlessly with libraries on either side. Stay tuned!


Audrey,
It's great have you back blogging on the progress of Pugs again.
Sometimes I wonder if we shouldn't simplify the spec for 6.x some we can get something complete and working out the door the sooner.
With the all the bells and whistles of Perl 6, sometimes I get concerned that it will be easy enough to pick up and get started with for newcomers...or that a working implementation will take too long.
Although there's a lot of effort to Do-What-I-Mean in a lot of different cases, it seems at times the basic simplicity of, well, being less complicated, is lost.
Mark
Posted by: Mark Stosberg | 2007.03.03 at 01:55 AM
It's so nice to see Audrey starts to post tutorial-like journals, which are very helpful for us to understand the magic behind the scene. :)
Thank you!
agentz
Posted by: | 2007.03.03 at 02:57 PM
Only FDA APPROVED Pills. Click Here to buy generic and brand pills - Fast And Overnight delivery - Free Shipping... and Also u can use a bonus!!!
http://forums.ipodhacks.com/showthread.php?t=21665 buy cheap viagra online
http://forums.ipodhacks.com/showthread.php?t=21667 buy cheap cialis online
http://forums.ipodhacks.com/showthread.php?t=21669 buy discount viagra online
http://forums.ipodhacks.com/showthread.php?t=21670 buy discount cialis online
Posted by: doorway | 2008.02.06 at 11:58 PM
THE WAY Pills. Click Here to buy generic and brand pills - Fast And Overnight delivery - Free Shipping... and Also u can use a bonus!!!
http://forums.ipodhacks.com/showthread.php?t=21671 buy cheap levitra online
http://forums.ipodhacks.com/showthread.php?t=21672 buy cialis professional online
http://forums.ipodhacks.com/showthread.php?t=21673 buy viagra professional online
http://forums.ipodhacks.com/showthread.php?t=21674 buy cialis soft tabs online
Posted by: yo | 2008.02.07 at 12:37 AM
MMDMS. Click Here to buy generic and brand pills - Fast And Overnight delivery - Free Shipping... and Also u can use a bonus!!!
http://forums.ipodhacks.com/showthread.php?t=21675 buy viagra soft tabs online
http://forums.ipodhacks.com/showthread.php?t=21676 buy cheap soma online
http://forums.ipodhacks.com/showthread.php?t=21677 buy tramadol online cheap
http://forums.ipodhacks.com/showthread.php?t=21679 buy cheap paxil online
Posted by: kola | 2008.02.07 at 01:13 AM
VERS4Click Here to buy generic and brand pills - Fast And Overnight delivery - Free Shipping... and Also u can use a bonus!!!
http://forums.ipodhacks.com/showthread.php?t=21680 order generic viagra online
http://forums.ipodhacks.com/showthread.php?t=21681 order generic cialis online
http://forums.ipodhacks.com/showthread.php?t=21682 order viagra soft tabs
http://forums.ipodhacks.com/showthread.php?t=21683 order cialis soft tabs
Posted by: vers4 | 2008.02.07 at 02:14 AM
A small number of patients have had a sudden loss of eyesight after taking Viagra. This type of vision loss is caused by decreased blood flow to the optic nerve of the eye. It is not clear whether Viagra is the actual cause of such vision loss
http://forums.ipodhacks.com/showthread.php?t=21806 buy generic cialis online
http://forums.ipodhacks.com/showthread.php?t=21807 buy generic viagra online
http://forums.ipodhacks.com/showthread.php?t=21808 buy generic levitra online
http://forums.ipodhacks.com/showthread.php?t=21809 buy discount paxil online
Posted by: poshlinahui | 2008.02.07 at 10:10 PM
SMALL number of patients have had a sudden loss of eyesight after taking Viagra. This type of vision loss is caused by decreased blood flow to the optic nerve of the eye. It is not clear whether Viagra is the actual cause of such vision loss
http://forums.ipodhacks.com/showthread.php?t=21810 buy cheap tramadol online
http://forums.ipodhacks.com/showthread.php?t=21811 buy discount cialis online
http://forums.ipodhacks.com/showthread.php?t=21812 buy discount viagra online
http://forums.ipodhacks.com/showthread.php?t=21813 buy female viagra online
Posted by: buy_4o | 2008.02.08 at 12:39 AM
Don't drink alcohol in excess (to a level of intoxication) with CIALIS, as this may increase your chances of getting dizzy or lowering your blood pressure. CIALIS does not protect against sexually transmitted diseases, including HIV. The most
http://yourlife.simplenames.com/2008/02/08/buy-discount-cialis-online/ buy discount cialis online
http://goodlife.simplenames.com/2008/02/08/buy-discount-viagra-online/ buy discount viagra online
http://xtabz.simplenames.com/ buy viagra soft tabs
http://trust.simplenames.com/ buy cialis soft tabs
Posted by: sex | 2008.02.08 at 07:40 PM
ORDER Click Here to buy generic and brand pills - Fast And Overnight delivery - Free Shipping... and Also u can use a bonus!!!
http://gedbar.simplenames.com/2008/02/10/buy-generic-cialis-online/ buy generic cialis online
http://karabas.simplenames.com/2008/02/10/buy-generic-viagra-online/ buy generic viagra online
http://dialog.simplenames.com/2008/02/10/buy-discount-paxil-online/ buy discount paxil online
http://baltika7.simplenames.com/2008/02/10/buy-generic-levitra-online/ buy generic levitra online
Posted by: mad__ | 2008.02.10 at 09:06 PM
Only FDA APPROVED Pills/// Click Here to buy generic and brand pills - Fast And Overnight delivery - Free Shipping... and Also u can use a bonus!!!
http://funnyanimalz.com/babyanimalz/viewtopic.php?t=4008 buy cialis professional online
http://funnyanimalz.com/babyanimalz/viewtopic.php?t=4009 buy viagra professional online
http://funnyanimalz.com/babyanimalz/viewtopic.php?t=4010 buy discount cialis online
http://funnyanimalz.com/babyanimalz/viewtopic.php?t=4011 buy discount viagra online
Posted by: buy_4o | 2008.02.12 at 09:15 PM
Only today in Ours Online Pharmacy Shop! Only today at Us! The wide range of various
preparations. The lowest prices. The highest quality. Fast and free-of-charge delivery up to
the house! The flexible system of discounts works. The Individual approach to each client.
ED preparations of various brands under the various prices. Recently there were new
preparations such as: Viagra Professional and Cialis Professional. Set of preparations both
for women and for men. Very convenient service. You will remainare happy!!!
http://zloloan.simplenames.com/2008/02/08/buy-discount-viagra/ buy discount viagra online
http://zloy555.simplenames.com/2008/02/12/buy-cheap-viagra/ buy cheap viagra online
http://zloy444.simplenames.com/2008/02/12/buy-generic-viagra/ buy generic viagra online
http://loannow.simplenames.com/2008/02/08/buy-discount-cialis/ buy discount cialis online
Posted by: trava | 2008.02.13 at 02:23 PM
VIAGRA is an oral medication for erectile dysfunction (ED). It helps most men with ED improve their erections. That means they are able to achieve harder erections
http://bestvia.simplenames.com/2008/02/13/buy-discount-viagra-online/ buy discount viagra online
http://blasta.simplenames.com/2008/02/13/buy-female-viagra-online/ buy female viagra online
http://canadian.simplenames.com/2008/02/13/buy-discount-cialis-online/ buy discount cialis online
http://next.simplenames.com/2008/02/13/buy-viagra-soft-tabs/ buy viagra soft tabs
Posted by: buyer | 2008.02.13 at 05:59 PM
am currently living in West Wales and have been doing so since about eighteen years ago. I live a few miles away from the sea and close to The Presely Hills. Bluestone is found in The Presely's and many consider that this area is the source of the bluestones at Stonehenge.
http://domain.simplenames.com/2008/02/15/buy-cialis-professional-online/ buy cialis professional online
http://step.simplenames.com/2008/02/15/buy-viagra-professional-online/ buy viagra professional online
http://all4u.simplenames.com/2008/02/15/buy-cialis-soft-tabs/ buy cialis soft tabs
Posted by: chel | 2008.02.15 at 08:52 PM
This medication may be habit-forming and should be used only by the person it was prescribed for. Soma should never be given to another person, especially someone who has a history of
http://inlove.simplenames.com/2008/02/15/buy-cheap-cialis-online/ buy cheap cialis online
http://maxlove.simplenames.com/2008/02/15/buy-cheap-levitra-online/ buy cheap levitra online
http://relaxants.simplenames.com/2008/02/15/buy-cheap-soma-online/ buy cheap soma online
Posted by: masd | 2008.02.15 at 09:33 PM
I am currently living in West Wales and have been doing so since about eighteen years ago. I live a few miles away from the sea and close to The Presely Hills. Bluestone is found in The Presely's and many consider that this area is the source of the bluestones at Stonehenge.
http://jax.simplenames.com/2008/02/15/buy-kamagra-online/ buy kamagra online
http://verach.simplenames.com/2008/02/15/buy-viagra-soft-tabs-online/ buy viagra soft tabs
http://luci.simplenames.com/2008/02/15/buy-disocunt-cialis-online/ buy discount cialis online
Posted by: spalm | 2008.02.16 at 02:18 AM
SOAP::Lite for Perl is a collection of Perl modules which provides a simple and lightweight interface to the Simple Object Access Protocol (SOAP, also known as Service Oriented Access Protocol) both on client and server side.
http://only4u.simplenames.com/2008/02/16/buy-discount-cialis-online/ buy discount cialis online
http://freek.simplenames.com/2008/02/16/buy-discount-viagra-online/ buy discount viagra online
Posted by: must | 2008.02.16 at 04:38 PM
This medication may be habit-forming and should be used only by the person it was prescribed for. Soma should never be given to another person, especially someone who has a history of
http://proda.simplenames.com/2008/02/17/buy-discount-cialis-online/ buy discount cialis online
http://4free.simplenames.com/2008/02/17/buy-discount-viagra-online/ buy discount viagra online
Posted by: romeo | 2008.02.17 at 05:16 PM
THIS medication may be habit-forming and should be used only by the person it was prescribed for. Soma should never be given to another person, especially someone who has a history of
http://jank.simplenames.com/2008/02/17/buy-viagra-soft-tabs/ buy viagra soft tabs
http://border.simplenames.com/2008/02/17/buy-cialis-soft-tabs/ buy cialis soft tabs
Posted by: fist | 2008.02.17 at 07:17 PM
PTher medication may be habit-forming and should be used only by the person it was prescribed for. Soma should never be given to another person, especially someone who has a history of
http://resk.simplenames.com/2008/02/17/buy-cialis-professional/ buy cialis professional online
http://ksil.simplenames.com/2008/02/17/buy-cialis-soft-tabs/ buy cialis soft tabs
Posted by: grinda | 2008.02.18 at 04:05 PM
TRSTS medication may be habit-forming and should be used only by the person it was prescribed for. Soma should never be given to another person, especially someone who has a history of
http://taram.simplenames.com/2008/02/18/buy-herbal-phentermine-online/ buy phentermine online
http://edcategory.simplenames.com/2008/02/18/buy-discount-cialis-online/ buy discount cialis online
Posted by: asdasd | 2008.02.18 at 04:29 PM
MIRANDO medication may be habit-forming and should be used only by the person it was prescribed for. Soma should never be given to another person, especially someone who has a history of
http://grinda.simplenames.com/2008/02/18/buy-discount-viagra-online/ buy discount viagra online
http://mirando.simplenames.com/2008/02/18/buy-viagra-professional-online/ buy viagra professional online
Posted by: mirando | 2008.02.18 at 06:07 PM
heheheh
Posted by: 呵呵 | 2008.02.19 at 06:50 PM
PORTA medication may be habit-forming and should be used only by the person it was prescribed for. Soma should never be given to another person, especially someone who has a history of
http://zithromax.simplenames.com/2008/02/20/buy-zithromax-online/ buy zithromax online
http://prozac.simplenames.com/2008/02/20/buy-prozac-online/ buy prozac online
Posted by: porat | 2008.02.20 at 08:13 PM
NADA medication may be habit-forming and should be used only by the person it was prescribed for. Soma should never be given to another person, especially someone who has a history of
http://propecia.simplenames.com/2008/02/20/buy-propecia-online/ buy propecia online
http://phen.simplenames.com/2008/02/20/buy-phentermine-online/ buy phentermine online
Posted by: roffio | 2008.02.20 at 09:39 PM