[Prev][Next][Index][Thread]

Re: Interfaces



Scott McKay swm@mediaone.net on  2000-07-03 23:15 wrote:

> 
> Kim Barrett wrote in message <200007031924.PAA16768@life.ai.mit.edu>...
> 
> [Quote from Moon]
> 
>> Dylan does not require programmers to make a textual copy of portions
>> of the definitions of items exported by a module, like a C header file
>> or an  Ada package declaration.  In my opinion Dylan modules still have
>> a  well-defined interface; the difference is that we assume there will
>> be the  obvious development tools for printing out that interface,
>> instead of requiring programmers to pretend to be tools and copy text
>> from one file to  another.  (Except of course Dylan still requires
>> programmers to copy the -names- of the exports from their definitions
>> into the define module statement.  We haven't thought of a good way to
>> avoid that.)
> 
> 
> If you want to declare an "interface" in Dylan right now, you copy the
> names of functions into a module definition, and you copy the signature
> from some set of methods into a 'define generic' form.  So Dylan does,
> in fact, require you to make "a textual copy of portions of the definitions
> of items exported by a module" if you want to collate this into an
> "interface".
> And you get to copy a little bit into one place, and another bigger bit
> into another place.  So I find Moon's argument less than persuasive...

I would consider the generic's signature to be the original, not a copy.
Then you implement the interface by writing methods that "subset" that
signature.  A default method might copy the signature of the generic, but
any more specific methods must have a more constrained signature.

> I have in the past proposed deprecating 'define generic' and augmenting
> 'define module' to take its place.  I haven't thought about this for a year,
> and I haven't written a real proposal, so don't bother to quiz me on it.

I suppose if you could write the generic in your module declaration then you
wouldn't have to copy the name, as Moon complains.  But you would still need
'define generic' for intra-module use, would you not?



Follow-Ups: References: