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

Re: How are types related to classes and roles?

Thread Previous | Thread Next
Nicholas Clark
February 24, 2005 09:18
Re: How are types related to classes and roles?
Message ID:
On Fri, Feb 25, 2005 at 12:45:45AM +0800, Autrijus Tang wrote:
> On Wed, Feb 23, 2005 at 12:17:19PM -0800, Larry Wall wrote:
> > : And how does all this combine with the notion of context?
> > 
> > Lazily, for the most part.  In some cases we can determine context at
> > compile time, but often not.  Certainly a subroutine cannot determine
> > what context it was called in until it's actually called, unless we
> > venture into return-value MMD, which has problems resolving against
> > parameter MMD.

> However, retval-based MMD is neccessary to ensure compile-time
> dispatch, and plays really well with type inferencing in general.
> So another solution is to mark ambiguate retval-based dispatches as
> ill-typed, and let the programmer resolve it by explicit type
> annotation.  But making it default is probably too much B&D.

Not that the tail should wag the dog, but as I remember it, parrot can do
return-value MMD "for free", because the continuation-passing style of
function calling means that actually there's no difference between a
function call and a function return. [It's all just one maze of non-local
gotos :-)] So if I understand it correctly, there's no speed hit in doing
return- value MMD. Just a sanity hit.

Nicholas Clark

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About