develooper Front page | perl.perl6.language | Postings from March 2005

Re: Parameter and trait questions - just how 'only' _is_ 'read-only'?

Thread Previous | Thread Next
From:
Larry Wall
Date:
March 31, 2005 08:51
Subject:
Re: Parameter and trait questions - just how 'only' _is_ 'read-only'?
Message ID:
20050331165126.GA24147@wall.org
On Thu, Mar 31, 2005 at 06:35:06PM +0200, Thomas SandlaƟ wrote:
: Is typing optional in the sense that it is no syntax error but
: otherwise ignored? To me this is pain but no gain :(

Well, you guys keep ignoring the answer.  Let me put it a bit more
mathematically.  The information in

    my X $a;

is *necessary* but not *sufficient* to do method existence testing in
standard Perl 6 at compile time.  You can do it IFF you have the class
information AND the classes are willing to cooperate in your scheme.
In the current design, you can pragmatically request that all classes
cooperate, and you will get the cooperation of all classes that haven't
specifically been requested to be non-cooperative.  This is what all
the mumbo-jumbo about open/closed and final/non-final classes comes
down to.

One additional wrinkle is that *anyone* is allowed to declare a
class non-cooperative (open or non-final) during *any* part of the
compilation, so your method existence checking cannot be done at
reduction time, but must be done as a separate pass from a CHECK
block at the end of whatever lexical scope requested cooperation.
CHECK blocks are construed to be the end of "normal" compilation;
Perl 6 very much follows the Perl 5 model here.

I hope this clears things up a little.

Larry

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About