Article View: comp.lang.clos
Article #156Re: Beginner's question and method lookup
From: kanderso
Date: Thu, 20 Aug 1992 08:53
Date: Thu, 20 Aug 1992 08:53
38 lines
2261 bytes
2261 bytes
To: comp.lang.clos@cis.ohio-state.edu
Date: Thu, 20 Aug 1992 07:23:55 GMT
Organization: The Ohio State University Department of Computer and Information Science
From: john@linus.mitre.org
Sender: commonloops-request@cis.ohio-state.edu
Subject: Re: Beginner's question and method lookup
Eric Smith (eric@tfs.com) asks:
But doesn't that make method dispatch very time consuming? It
seems like it would involve searching for the method in tables, and
that the amount of time consumed would depend on how many methods
were in those tables and how many class arguments each method had.
and David C. Martin (dcmartin@msi.com) replies:
Yes, if you did things that way. In fact, you can determine at
compile time what the argument types are and then put in the
appropriate call to the appropriate function.
I think this is often true, but not in general, even with extensive
declarations. If you have a very rich class hierarchy, the compiler
may only be able to narrow the type to partway down the hierarchy, or
to a disjunction of types, not to a leaf. A SSC may be able to make
use of this information, but I'm not sure many commercial CLOSes could.
In the most ridiculous case, an argument to a generic-function may be
computed via a call to READ; there's little the compiler can do then.
READ is not a ridiculous case, it is a ridiculously important one. It is
typical of any interaction with the user that could return an arbitrary
object. While C++ may be clever about using compile time type information,
one of its short coming is it does not support run time typing adequately
enough, READ being a good example.
If there were sufficiently smart compilers, there would be no programmers.
k
Technical Details
Message-ID:
<9208201657.AA18244@news.cis.ohio-state.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!bbn.com!kandersoReferences:
<9208201523.AA01165@thelonius.mitre.org>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.clos Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!bbn.com!kanderso From: kanderso@bbn.com Subject: Re: Beginner's question and method lookup Message-ID: <9208201657.AA18244@news.cis.ohio-state.edu> Sender: daemon@cis.ohio-state.edu Organization: The Ohio State University Department of Computer and Information Science References: <9208201523.AA01165@thelonius.mitre.org> Date: Thu, 20 Aug 1992 08:53:25 GMT Lines: 38