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/
pgpNecWz3n4T6.pgp
Description: PGP signature