[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problems with createActionTo and arg types...
From: |
Alex Lancaster |
Subject: |
Re: Problems with createActionTo and arg types... |
Date: |
Wed, 27 Aug 1997 23:11:41 +1000 |
Folks,
Thanks for all the suggestions. I had thought about making turning the
amplitude
into an object - but not representing the float as a series of integers.
These
are all good workarounds - but my basic question is still - is this
limitation
intentional or an unavoidable consequence of implementation? If so, is the
limitation
at the level of gcc or ObjC (i.e. is it just *not possible* to cast a float
to an id)
- or of the Swarm activity library itself? In other words, is this a *known*
limitation of this method?
If this is "just the way" it is - I think making the float into an object is
probably the way to go - it just seems like somewhat of an overkill to pass
objects
when you only really want to pass a number! (No offence to Pietro!)
Alex
At 11:46 AM 27/8/97 +0200, you wrote:
>At 00.39 27/08/97 -0400, you wrote:
>>Alex Lancaster wrote:
>>>
>>> Dear Swarm folks,
>>>
>>> I am trying to create a dynamic schedule using a createActionTo message.
>>>
>>> The Swarm interface guide says that when creating an action to with one or
>>> more arguments, the argument needs to be cast to the Objective C id type,
>>> to whit:
>>>
>>> [createActionTo: neurone message: M(receivePulse:) : (id) pulseAmplitude]
>>>
>>> This seems fine if the type of the argument (i.e. pulseAmplitude in the
>>> above e.g.) is an integer. But gcc won't allow compilation if the argument
>>> is a float, with an error message to the effect "can't cast that arg to a
>>> pointer". (I can send the exact code and error message if necessary).
>>>
>>> Is this a known problem? If so, are there any workarounds? I really
need my
>>> arguments to be floats, as integers are far too coarse to represent the
>>> variables in my model.
>>>
>>> Any ideas?
>>
>>This might be a stupid suggestion, but what if you divided up the float
>>into the mantissa and the exponent, and store both of these as integers
>>(or long integers) and then pass them into the method as integers cast
>>to ids, and then inside the method "reconvert" them back to floats?
>>I know theres got to be a simplier way....
>>
>>Brad.
>
>An other solution (the previous is not a stupid suggestion; my attempt, may
>be ...):
>
>to have pulseAmplitude in an object; to transfer to neurone the address of
>that object, which have to reply to a method like givePulseAmplitude when
>is accessed by neurone;
>
>i.e. to replace
>
>[createActionTo: neurone message: M(receivePulse:) : (id) pulseAmplitude];
>
>with something like
>
>[createActionTo: neurone message: M(keepPulseFrom:) :
>anObjectContainingPulseAmplitude];
>
>Yours, Pietro
>
>
>
> ==================================
> 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.
> ==================================
>
>
////////////////////////////////////////////////////////////
Alex Lancaster
e-mail: <address@hidden> tel: +61-2-9565-5774 (H)
web: http://www.real.net.au/~alex
////////////////////////////////////////////////////////////
==================================
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.
==================================