swarm-support
[Top][All Lists]
Advanced

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

[Swarm-Support] messages to nil and all that


From: Bill Northcott
Subject: [Swarm-Support] messages to nil and all that
Date: Thu, 17 Aug 2006 17:53:12 +1000

On 17/08/2006, at 12:00 PM, Marcus G. Daniels wrote:
Paul Johnson wrote:
All I'm saying, which nobody seems to confirm, is that the Swarm runtime used to stop when a message was sent to nil. I mean, it used to segfault and gdb would backtrace to expose the problem.
(But not only moved -- disabled too.)

2003-02-26  Bill Northcott <address@hidden>

       * internal.m move nil_method to libobjc/nil_method.c

I certainly committed that patch, but it had been discussed at some length in Jan/Feb 2003, which is three and a half years ago.

It was first brought up on this list by Marc-Antoine:
Also, I forgot to mention another linking issue i had:
there is
id nil_method(id receiver, SEL op, ...)
in both libobjc/nil_method.c and src/defobj/internal.m
I disabled (#ifdef 0) the former, as the linker complained about the
duplication.

Cheers to all,
Marc-Antoine

As Scott wrote recently:
I think if you provide your own implementation of the nil_method
function in your code, it will override the one in the ObjC runtime.
This relies upon a linking trick so it may not work on all
platforms.  Try adding this into one of your source files

This is what was done in the code prior to Feb 2003 and sure enough it broke with the different linker on MacOS X.

At that time, I really had no idea what this code did. I tried asking questions but nobody volunteered replies. Here is what I wrote on 17 Jan 2003:
c) Prevent the duplication of nil_method between libobjc/nil_method.c
and src/defobj/internal.m


What problem is this the solution for?

and on 14 Feb 2003

3.nil_method duplicate definition
<map>id nil_method(id receiver, SEL op, ...)
in both libobjc/nil_method.c and src/defobj/internal.m
I disabled (#ifdef 0) the former, as the linker complained about the
duplication.
MAP> Excellent point. That looks like a hangover. Given that Swarm will

not
compile with gcc2.8, it seems to me at first glance that the internal.m
version should be moved to the runtime.  I will check this with the
others.


<BN> What is this about?

I think it was Marc-Antoine who contributed the final form of the patch.

Having woffled on about all that, the problem remains about how to fix it, if at all.

The current version of the code with the #ifdef should allow libraries to be built that provide the error message which Paul wants. Also it does not depend on any platform specific linker tricks which is nice.

OTOH this is an undocumented feature in Swarm which clearly at odds with the documented behaviour of Objective-C. Further, if as planned we move Swarm to GNUstep and use the standard runtimes then the feature will go away as it needs either a modified runtime or a platform specific linker trick that is probably undocumented and quite likely to break in the future.

Does anyone have a long enough memory to know why it got done in the first place?

My own inclination is to regard it as not a problem, because the current behaviour is as documented which is as things should be. The nil object is a bit bucket like /dev/null that just eats any messages you send to it. Also I have an aversion to using undocumented platform specific tricks, which will only come back to bite us again in the future just like this one has.

Maybe we should document the debug feature and also deprecate it unless someone has a portable way of getting the same effect.

Cheers
Bill



reply via email to

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