swarm-support
[Top][All Lists]
Advanced

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

Re: Compiling problem


From: Sorin Lerner
Subject: Re: Compiling problem
Date: Sun, 14 Feb 1999 22:57:00 -0500

Thank you for the information on SWARM's memory conventions. My program was
just ment as a simple repro case that illustrates the point, but I am glad
you cleared up some the SWARM issues. Thanks!


> >>>>> "SL" == Sorin Lerner <address@hidden> writes:
>
> SL> `+(ObjectA *)SorinNew:(int)a' example.m:13: warning: also found
> SL> `+(ObjectB *)SorinNew:(int)a'
>
> Objective C is a dynamically typed language in which a method's
> identity is characterized by its name (and argument keys), and not by
> types of its parameters.
>

Yes, but there are a few questions:

1) Why does it compile without a problem when I don't include the
SwarmObject.h file?

2) If Objective C only looks at the name of the method, then how come I can
declare two object messages ('-' messages) of the same name in two different
classes, and have the compiler disambiguate between them as long as I use a
typed pointer to call the method?

For example:
In class A: - foo: (int) a;
In class B: - foo: (id) a;

id anObject = [A create];
[anObject foo: 5]; /* compiler complains that there are multiple
             definitions of foo, as expected */

/* However ... */
A* a = [A create];
[a foo: 5]; /* works without a problem!*/
[a foo: nil]; /* compiler complains  ("makes integer from pointer
         without a cast") which means that it knows that I am
          refering to A's foo */

Sorin


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]