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

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

Thread Previous | Thread Next
From:
=?ISO-8859-1?Q?Thomas_Sandla=DF?=
Date:
April 5, 2005 08:37
Subject:
Re: Parameter and trait questions - just how 'only' _is_ 'read-only'?
Message ID:
4252B09E.3080802@orthogon.com
HaloO Larry,

you wrote:
> 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.

That is clear, especially the part where you talk about necessary and
sufficient.  Please consider myself a disciple from now on :)

Actually I'm not obsessed with the compile time checking but with the
semantics. Which to me means that with the above declaration a method
must come from *this X or its supertypes* in the scope of the declaration.
To illustrate consider the following 4 cases:

             | state when $a.m() |
declaration | is attempted      | semantics
------------+-------------------+--------------------------------
1) my   $a; | $a doesn't m()    | ignored or undef or exception
2) my   $a; | $a does m()       | call $a.m()
3) my X $a; | X doesn't m()     | type error
4) my X $a; | X does m()        | call most specific Xish $a.m()

The semantics of case 1) will be augmented by pragma I guess.

The above becomes more interesting if considering MMD. Then it
must be ensured that there is exactly one unique, most specialized
implementation available for handling type X. Note that this is a
stronger constraint than that the dispatch would succed for the
value of $a in question---and not achievable with a Manhattan metric.

And one more: when the runtime system doesn't manage to find a matching
X it could call into the compiler, class composer, type engine or however
this subsystem is called and try to make an appropriate type and a class
implementing it! And *that* is what I consider a dynamic language---or
meta language on the Parrot level.


Regards,
-- 
TSa (Thomas Sandlaß)




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