[Rubycocoa-devel 1253] Re: NSString duck typing via method_missing

Back to archive index

Satoshi Nakagawa snaka****@infot*****
Thu Nov 22 12:10:34 JST 2007


Done.

I removed method_missing from NSString, NSArray and NSDictionary.
And then I added some NSString methods.
Now all methods except =~ and match are working.

--
Satoshi Nakagawa

On 2007/11/14, at 3:37, Laurent Sansonetti wrote:

> I also agree. This will eliminate confusion and the users will
> probably report us some feedback about the missing methods, which will
> be helpful for the next revision.
>
> Laurent
>
> On Nov 13, 2007, at 5:35 PM, Eloy Duran wrote:
>
>> I agree, we should remove it.
>>
>> Eloy
>>
>> On 13 nov 2007, at 17:34, Satoshi Nakagawa wrote:
>>
>>> Hi,
>>>
>>> I suggest that we should remove NSStirng#method_missing.
>>>
>>> Because an index number for NSString is character based, while one
>>> for
>>> Ruby String is byte based.
>>>
>>> I ported many Ruby String methods to NSString, and these are
>>> character
>>> based.  So now NSString have both character based methods and byte
>>> based methods.
>>>
>>> For example, scan method.
>>>
>>> I haven't ported the scan method.  So when I call NSString#scan, it
>>> causes a method_missing call and it would be passed to String#scan.
>>>
>>> Therefore,
>>>
>>> "あいうえお".to_ns.scan(/い/) {|a| puts $~.begin(0) }
>>> # => 3 (should be 1)
>>>
>>> I got 3 in result.  But it should be 1 if NSString uses character
>>> based indexes.  It's confusing.  I want to make NSString methods
>>> confirmed to be character based.
>>>
>>> What do you think?
>>>
>>> --
>>> Satoshi Nakagawa




More information about the Rubycocoa-devel mailing list
Back to archive index