[OGo-Developer] _e_info in NSException.h
Sebastian Reitenbach
developer@opengroupware.org
Wed, 23 Jan 2008 17:48:39 +0100
developer@opengroupware.org wrote:
> developer@opengroupware.org wrote:
> > Hi,
> > developer@opengroupware.org wrote:
> > > On 14.01.2008, at 11:35, Sebastian Reitenbach wrote:
> > > > while changing to gnustep-make 2.0 I tried to compile sope against
> > > > gnustep-base 2.15.2. In sope there is a private variable of
> > > > NSException
> > > > used: _e_info. which got replaced by _reserved.
> > > > Therefore I asked about it on the discuss-gnustep@ mailing list.
> > > > As it is generally a bad idea to access private methods and
> > > > variables of I
> > > > thing Richard is right, and it should be changed in sope.
> > >
> > > Hm, yes. This is because before MacOS 10.2(?) there was a public -
> > > setUserInfo: method. This was removed from the public headers but is
> > > still provided in the implementation (of Cocoa).
> > >
> > > Now I think GNUstep removed the method completely (not just from the
> > > header), hence I needed to provide an own implementation (which used
> > > the _e_info private field ...).
> > >
> > > > What would be the preferred way?
> > > > Adding a general NSException(UserInfo) category?
> > > > Or change all occurences where this happens, I think it is only one
> > > > place in NGImap4...
> > >
> > > We should (carefully!) remove all calls to -setUserInfo: (check
> > > whether userinfo fields are required by callers etc).
> > Ok, I'll take a look, and will try to remove/replace these calls.
> >
>
> I took a look at the usage of setUserInfo for exceptions in sope, and I
> found a place where the problem was solved like this:
>
> #if NeXT_Foundation_LIBRARY || APPLE_FOUNDATION_LIBRARY || \
> COCOA_Foundation_LIBRARY
> exception = [NSException exceptionWithName:[exception name] reason:
> [exception reason] userInfo:ui];
> #else
> [exception setUserInfo:ui];
> #endif
>
> The other places where I found the setUserInfo, it looks like there could
be
> done the same, but I would add GNUSTEP_BASE_LIBRARY to the #if clause.
>
> But then, it could be exchanged with:
> #if LIB_FOUNDATION_LIBRARY
> [exception setUserInfo:ui];
> #else
> COCOA_Foundation_LIBRARY
> exception = [NSException exceptionWithName:[exception name] reason:
> [exception reason] userInfo:ui];
> #endif
>
> But as the exceptionWithName should work on any foundation library, I'd
just
> prefer to not use setUserInfo at all and only use sth. like the line
below:
>
> exception = [NSException exceptionWithName:[exception name] reason:
> [exception reason] userInfo:ui];
>
> before I go on, what would be the preferred way?
>
no answer? Then I assume any way would be fine, and I take the last one.
Sebastian