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

Re: How are types related to classes and roles?

Thread Previous | Thread Next
From:
Autrijus Tang
Date:
February 24, 2005 08:48
Subject:
Re: How are types related to classes and roles?
Message ID:
20050224164545.GA22305@aut.dyndns.org
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.

Ugh.  Pugs currently does return-value based MMD, and it has indeed
the core reason behind my recently-reported dilemma on MMD tiebreaking.
If we lose retval-MMD, many sensible cases can then be resolved without
the need of "is default".

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.

So, I think late binding is a sensible (and practical) default, but
do you think it may be a good thing to have a type inference mode that
assign static contexts to expressions, and prebind as much as possible?
It may be possible to enable via a pragma or a compiler switch...

Thanks,
/Autrijus/

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