[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: return type for a method parameter & assigning probe buttons
From: |
Marcus G. Daniels |
Subject: |
Re: return type for a method parameter & assigning probe buttons |
Date: |
07 Sep 1999 12:11:19 -0700 |
User-agent: |
Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4 |
>>>>> "WS" == William S Shu <address@hidden> writes:
WS> Problem 1: Objective-C) How can one pass a method as an argument
WS> as well as the type of its return value?
In Swarm, the way selectors are called is via the `perform' method.
Since this method is typed to return an object, selectors should all be for
methods that return objects.
Generic return typing is hairy problem. If you really want to be
able to return generic types you need to use GCC builtins and the
performv: method. Something like this:
- (double)call: (SEL)sel
{
__builtin_return ([self performv: sel : __builtin_apply_args ()]);
}
Unfortunately the __builtin_{return/apply_args} are deprecated in GCC
and actually fail on some platforms (e.g. Sparc). (For Java things,
we take care of argument frame packing and unpacking by hand, using platform
specific code.)
WS> // valueOf takes *no* argument
WS> - (Real)getValueBL: (Point)bL TR: (Point)tR
WS> class: (id)aClass order: (int)type value: (SEL)valueOf {
WS> id obj;
WS> int i, j;
WS> Real val;
WS> ...
WS> obj = [self getWorldObjectAtX: i Y: j];
WS> if ([obj isKindOf: aClass]) {
WS> ....
WS> val += [obj valueOf] <====== **** return type assumed to be id
This is actually invalid syntax. You'd have to say [obj perform: valueOf].
WS> How do I get to probe both objects (in fact any object) on the
WS> raster by using the same mouse button.
WS> [worldRaster setButton: ButtonRight // use Right button
WS> Client: personDisplay
WS> Message: M(makeProbeAtX:Y:)];
Send a different message, one that has the effect of calling
makeProbeAtX:Y: twice.
==================================
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.
- 3rd Problem Installing Swarm2.0 in LinuxPPC R5, (continued)
- 3rd Problem Installing Swarm2.0 in LinuxPPC R5, Darren Schreiber, 1999/09/05
- Re: 3rd Problem Installing Swarm2.0 in LinuxPPC R5, Marcus G. Daniels, 1999/09/05
- 4th Problem Installing Swarm2.0 in LinuxPPC R5, Darren Schreiber, 1999/09/06
- Re: 4th Problem Installing Swarm2.0 in LinuxPPC R5, Marcus G. Daniels, 1999/09/06
- Re: 4th Problem Installing Swarm2.0 in LinuxPPC R5, Darren Schreiber, 1999/09/07
- Using forEach:, Darren Schreiber, 1999/09/07
- Re: Using forEach:, Norberto Eiji Nawa(0.3.31), 1999/09/07
- Re: Using forEach:, Ken Cline, 1999/09/07
- Re: 4th Problem Installing Swarm2.0 in LinuxPPC R5, Marcus G. Daniels, 1999/09/07
- return type for a method parameter & assigning probe buttons, William S. Shu, 1999/09/07
- Re: return type for a method parameter & assigning probe buttons,
Marcus G. Daniels <=
- Re: return type for a method parameter & assigning probe buttons, William S. Shu, 1999/09/07
- [no subject], DARREN MATTHEW SCHREIBER, 1999/09/07
- Re: none, Marcus G. Daniels, 1999/09/07
- Dendogram, Darren Schreiber, 1999/09/08
- Re: Dendogram, Marcus G. Daniels, 1999/09/08
- Display direction, Jayshree Sarma, 1999/09/08
- Re: Display direction, Marcus G. Daniels, 1999/09/08
- Error Message - Swarm-1.4.1, Jayshree Sarma, 1999/09/09
- Re: Error Message - Swarm-1.4.1, Marcus G. Daniels, 1999/09/09
- Re: Error Message - Swarm-1.4.1, Jayshree Sarma, 1999/09/09