[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell
Subject:    The generality of dictionary passing style
From:       Satish Thatte <satish () sun ! mcs ! clarkson ! edu>
Date:       1991-03-07 11:12:57
Message-ID: 9103062058.AA17164 () sun ! mcs ! clarkson ! edu
[Download RAW message or body]

Original-Via: uk.ac.nsf; Thu, 7 Mar 91 10:15:45 GMT
Date: Wed, 6 Mar 91 15:58:17 EST
From: Satish Thatte <satish@sun.mcs.clarkson.edu>
To: haskell <haskell%edu.yale.cs@clvm.clarkson.edu>
Subject: The generality of dictionary passing style
Sender: haskell-request@cs.glasgow.ac.uk

I recently had the following exchange with Simon Payton-Jones about
the generality of the dictionary-passing solution to overloading
resolution (the indented question in Simon's reply is mine).
I would be interested in other reactions to this issue.  Phil
Wadler thinks that the laziness of Haskell is not
essential for the viability of dictionaries.

Satish

P.S.  'Mark's "example"' in the text below refers to an example in
a related message posted recently by Mark Jones.

To: Satish Thatte <satish@sun.mcs.clarkson.edu>
Cc: wadler@cs.glasgow.ac.uk
Subject: Re: Haskell static semantics
Date: Wed, 06 Mar 91 11:57:16 +0000
From: Simon L Peyton Jones <simonpj@cs.glasgow.ac.uk>

I don't really know the answer to this... but it seems like a good
question!

| 
| The question really is: how workable is the dictionary-passing style
| *in general*, e.g., for languages that are *not* lazy.  Since the
| classes idea has nothing to do with laziness, it would be nice to find
| an implementation that does not rely on laziness for its viability.
| For instance, suppose one had a large hierarchy of subclasses
| (pardon the loose notation)
| 
| 	C a => D a => E a => F a
| 
| and each class had (a,b) as an instance, given that a and b belonged to
| the class also.  Now if F is used in a function definition such as
| in Mark's "example", a potentially large amount of dictionary
| construction (for the pair-instances of C, D, E and F using the
| dictionaries for a and b) must take place even if it is done only once.
| Most of this work is likely to be wasted since only an operation
| defined in class F, say, is used. Now in a lazy language, the
| dictionary construction is itself lazy, and so the work doesn't
| actually happen until the corresponding function is used (I presume).
| But this won't work in Standard ML, say.  My concern is that
| *in principle* the work implied by the translation does not seem
| proportional to what is actually needed, and I am wondering if
| this is a real problem in the generality of the solution or there is
| something I am missing.
| 
| Satish
| 




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic