[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: NSString methods returns GSUnicodeString, why?
From: |
Mondragon, Ian |
Subject: |
RE: NSString methods returns GSUnicodeString, why? |
Date: |
Mon, 02 Jul 2001 11:07:44 -0500 |
i don't know exactly how you're implementing this internally, and i don't
know if this is the root of *this* problem, but a 'new' method in
objective-c typically is implemented as a simple combination of 'alloc' and
'init'; therefore, you're 2nd init method would be redundant.
just my 2 cents.
- ian
> -----Original Message-----
> From: Laurent Julliard [SMTP:Laurent.Julliard@xrce.xerox.com]
> Sent: Monday, July 02, 2001 10:32 AM
> To: discuss-gnustep@gnu.org
> Subject: NSString methods returns GSUnicodeString, why?
>
> 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
>
> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> http://mail.gnu.org/mailman/listinfo/discuss-gnustep