Newsgroups: comp.lang.dylan
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!udel!gatech!howland.reston.ans.net!news.moneng.mei.com!uwm.edu!reuter.cse.ogi.edu!qiclab.scn.rain.com!europa.com!franka
From: franka@europa.com (Frank Adrian)
Subject: Re: What's a generic function?
Message-ID: <D7E67t.678@europa.com>
Sender: news@europa.com
Nntp-Posting-Host: thetics.europa.com
Organization: Europa |||| Portland, OR
X-Newsreader: TIN [version 1.2 PL2]
References: <3mnrf2$288r@acs6.acs.ucalgary.ca> <3mq5av$pd5@lll-winken.llnl.gov> <3ms6ip$4rf@stc06.ctd.ornl.gov>
Date: Fri, 21 Apr 1995 15:40:41 GMT
Lines: 33

Kennel (mbk@jt3ws1.etd.ornl.gov) wrote:
: Is the choice of "which actual method to call" made at compile time or
: run-time?

: For instance that is the distinction in Sather between overloading
: (compile time selection based on compile time types of arguments) and
: dispatching upon an abstract type (run-time selection as a function of
: the actual concrete type of "myself').

: I'd imagine that without a distinguished subject this would have
: to be different.

No, not really.  As long as the compiler can determine the type of the
parameters at compile-time, it can always generate the most efficient set
of tests for the selection of a particular generic function.  The more
tightly bounded are the sets of the possible types, the more efficient
can be the call.  If you know all of the types (say add(1.0, 2)) you
could even inline the (uniquely specified) procedure.  The problem
comes if you allow run-time modification of methods.  This means that
all test sequences need to be regenerated (or you're stuck with a generic
dispatch, which can be slower).  Dylan limits possible type ambiguity using
its module structures and sealed classes.

On the other hand, I find most programmer's opinions of their coding
skills (with regards to efficiency) to be so highly inflated that I
doubt that any decrease in calling sequence efficiency would be noticable.
___________________________________________________________________________
Frank A. Adrian           ancar technology            Object Analysis,
franka@europa.com         PO Box 1624                   Design,
                          Portland, OR 97207              Implementation,
                          Voice: (503) 281-0724             and Training...
                          FAX: (503) 335-8976

