Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!versatc!leadsv!esl!dml From: dml@esl.UUCP (Denis Lynch) Newsgroups: comp.sys.next Subject: Re: Deferred methods and strong typing Message-ID: <934@esl.UUCP> Date: 8 Jul 89 03:21:15 GMT References: <130007@gore.com> <3312@stpstn.UUCP> Reply-To: dml@esl.UUCP (Denis Lynch) Organization: ESL, Inc., Sunnyvale, CA. Lines: 32 In article <3312@stpstn.UUCP> andyn@stepstone.com (Andy Novobilski) writes: > >Correct type information can be given to the compiler by: > >1) Typing the method: > [(B *)anInstanceOfB someMethod]; > >2) Declaring anInstanceOfB to be type B: > B *anInstanceOfB; Isn't it true that the warning is generated because of the *declaration* of someMethod, not its use? (Of course the run-time problem happens because of the use). This seems to be pretty much required because of the *possibility* of dynamic binding: the compiler needs to be able to figure out what someMethod will return under any circumstances, especially since common usage is to type everything as id. (I know I could go try this on my machine, but it's in another room...) This seems to be one of the prices to be paid for using dynamic binding in a language that doesn't fully support it. In Smalltalk there is no such problem, since someMethod will return whatever it wants. In C we don't have that luxury. -- Denis Lynch ESL Incorporated decwrl!borealis!\ ARPA: dml%esl.ESL.COM@ames.arc.nasa.gov ucbcad!ucbvax!- ames!- esl!dml SMAIL: dml@esl.ESL.COM lll-lcc!/