swarm-support
[Top][All Lists]
Advanced

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

Re: A story about [self Class] (continued...)


From: mcmullin
Subject: Re: A story about [self Class] (continued...)
Date: Thu, 10 Apr 1997 13:48:19 -0600 (MDT)

On 10 Apr, Ludo Pagie wrote:
> A seemingly straightforward question is in that case:
> WHY IS IT THAT: "BOOL is not int" ???????

I can only speculate; but one presumes that the idea
was to reduce memory usage for BOOL variables; since
they strictly only need one bit, it seems reasonable to
at least only allocate one addressible unit (typically
one byte) rather that a whole word (typically 4 bytes).

And of course, the problem of a conflict between
int/pointer and BOOL only arises for code which is
"sloppy" in the sense of relying on the equivalence of
int/pointer and logical values, rather than using
explict logical operators.

On the other hand: it does introduce an unnecessary
avenue for new bugs; and may, in some circumstances
actually involve a time performance penalty (in
converting ints to BOOL and vice versa); and hey,
memory is cheap (;-)


Anyway: the only real point in this is that that is the
way it is - and it need not be a problem as long as
y'all are aware of it...


POSTSCRIPT:  The final version of
-isProbeMapDefinedFor: which I proposed in my last
mesage was:


  -(BOOL) isProbeMapDefinedFor: (Class) aClass {
    return ([classMap containsKey: aClass]);
  }

and I said this would probably be the version appearing
in the next release.  That is still true - but Glen
tells me that it will *not* work right now, because it
seems that "containsKey" is one of those funny methods
that currently exists only in the documentation ... so,
if you want to fix this for yourselves right now, stick
with:

  -(BOOL) isProbeMapDefinedFor: (Class) aClass {
    return ([classMap at: aClass] != nil);
  }


Cheers,

Barry.

-- 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| Barry McMullin, ALife Group,               |    address@hidden |
| Santa Fe Institute, 1399 Hyde Park Road,   |  Voice: +1-505-984-8800 |
| Santa Fe, NM 87501, USA.                   |  FAX:   +1-505-982-0565 |
| http://www.eeng.dcu.ie/~mcmullin           |                         |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



                  ==================================
   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]