Re: How do you feel about utf-8 in ruby code?
Gerald Bauer <[email protected]>
| Newsgroups | gmane.comp.lang.ruby.general |
|---|---|
| Message-ID | <CAAxEZd8HzyEH4WACxLfRgWHC2Uw41OHyAbcume0KEpRW33iuqA@mail.gmail.com> |
Hello,
In the safestruct [1] library / gem I'm using unicode (utf-8)
identifiers for typesafe class constants. For example:
Instead of this "generated" name:
Hash_Address_x_Hash_Address_x_Game for a nested Hash with a Hash of
Game structs the library uses:
Hash‹Address→Hash‹Address→Game››
And yes, that's a valid class constant! Here's another "real
world" example with arrays:
Instead of "classic" Array_Array_Integer_x3 the library uses:
Array‹Array‹Integer››×3
Conclusion: Yes, unicode (utf-8) identifiers rock!
Cheers. Prost.
PS: Try this - yes, it works:
pp Hash‹Address→Hash‹Address→Game››
pp Hash‹Address→Hash‹Address→Game››.new
pp Array‹Array‹Integer››×3
pp Array‹Array‹Integer››×3.new
and so on
[1] https://github.com/s6ruby/safestruct
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>