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

Re: How are types related to classes and roles?

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
February 24, 2005 09:18
Subject:
Re: How are types related to classes and roles?
Message ID:
20050224171750.GH99668@plum.flirble.org
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


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