From: matz@... (Yukihiro Matsumoto) Date: 2002-01-22T09:37:41+09:00 Subject: Re: ruby binary handling Hi, In message "Re: ruby binary handling" on 02/01/22, Niko Schwarz writes: |We have two problems here, imho: |a) characters should be all general, i.e. not just ascii or unicode but |being subclassable to all the existing keycodes. |that, in turn, would require a completely different string->character |translation, because the char-code depends on the charset. This one is achieved by Ruby M17N; not by subclassing though. string.encoding = "binary" # sting works like binary string.encoding = "utf-8" # sting works like utf-8 And where's another problem? |in any way, there should be two different classes for strings and binary |data, for a few reasons: |- binary data doesnt need methods like capitalize! |- string data doesnt need methods like xor I guess it's OK to have redundant methods if you can tell it's an error. |- for string data its not certain at all that one character will consist of |one byte. It's done by M17N. |so, summed up, my ideas would be: |- a common superclass for strings and binaries |- different intern handling of those, depending on the size and the type |theyre used The latter is an interesting idea. Could you tell me more? matz.