swarm-support
[Top][All Lists]
Advanced

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

Re: [Swarm-Support] Re: Swarm 2.2 on Intel (and PPC) Mac OSX Tiger


From: Marcus G. Daniels
Subject: Re: [Swarm-Support] Re: Swarm 2.2 on Intel (and PPC) Mac OSX Tiger
Date: Mon, 24 Jul 2006 07:35:18 -0600
User-agent: Thunderbird 1.5.0.4 (Windows/20060516)

Bill Northcott wrote:
Having said this, it seems to me to be a good idea to eradicate them now from the Swarm code base rather than wait until something breaks.

While I'm happy to see Scott's helpful #ifdef workarounds in CVS for this, I'm not convinced at all it improves Swarm to code in this way. In some cases he had to pass around nearly a dozen parameters. Nested functions facilitate passing functions as arguments, capturing state that is intended to be invariant for that iteration. It implements lexical scope for C. It's both efficient and easy to understand what is intended because the iterated action is defined in the immediate context, and only the parameter that changes is passed. Objective C is a reasonable place to use these kinds of C extensions since Objective C is not ISO 99 C. As far as worries about an stack exploit go (which assume that someone wants to run models from web servers or as root), those opportunities are reduced by the compiler turning on and off stack executability in narrow windows of time.

To make this kind of change in Swarm as a preference and not just a workaround, I'd suggest making structures for the invariant state and passing that single extra parameter around. Another option would be to reorganize the code around objects and pass method selectors around, or their associated pre-dispatched IMPs.

To disable this feature sounds fishy and a bit fascist to me, like "when something is hard or confusing, forbid it". On the other hand, having a portable pure C or C++ implementation of Swarm interfaces would be great but that's a completely different argument.

Marcus


reply via email to

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