discuss-gnustep
[Top][All Lists]
Advanced

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

NSString methods returns GSUnicodeString, why?


From: Laurent Julliard
Subject: NSString methods returns GSUnicodeString, why?
Date: Mon, 02 Jul 2001 17:32:12 +0200

All,

I'm in the process of writing a Ruby to GNUstep binding. And I have
difficutlies to understand the following problem. A simple piece of Ruby
code illustrates the problem (irb is the Ruby interactive shell):

irb> a = NSString.new    # create a new NSString object
irb> a.initWithCString("GNUstep forever")
irb> a.length
15

Everything seems to be working fine. But...

irb> a.cString
Uncaught exception NSCharacterConversionException, reason: Can't get
cString from Unicode string.

Right after the initWithCString method call I have put some logs showing
that initWithCString actually returns a GSUnicodeString object instead
of a NSString object as you would expect. It looks like GSUnicodeString
is a subclass of GSString which in turn is a subclass of NSString. So
why isn't the cString method call working?

Any idea is welcome.

Thanks

PS: Right now the approach we have taken on the Ruby-GNUstep binding is
entirely dynamic. We don't use any declarative approach a la SWIG an i
would like to keep it this way.

-- 
Laurent JULLIARD - XR&T Technology and Alliances Office -  Open Source
team
Xerox / 3400 Hillview Ave. PAHV 121 / Palo-Alto CA 94304 / USA
Tel/Fax US: +1 650 813 7168 / 6860  - France: +33 4 76 61 5048 / 5199
 . Host your Xerox Software project on CodeX: http://codex.xerox.com
 . Xerox Open Source community: http://bazaar.adoc.xerox.com
 . Linux@Xerox community: http://xww.linux.world.xerox.com



reply via email to

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