minkoo.seo@gmail.com
2/11/2006 11:14:00 AM
What I want to do with OpenStruct is to store bigram in hash table.
(bigram can be thought as two consecutive strings)
So, I have two choices. First one is to define new class. The other
option is to use OpenStruct. However, OpenStruct can't be used
as key of hash, so I made my own class.
At first, I thought that OpenStruct might be implemented by
adding methods and instance variables on the fly. But, it's
hashtable. Also, it doesn't have automatic hash, eql? method
generation.
I understand that computing good hash value is beyond
the scope of langauge design, but I'm talking about library.
OpenStruct might use one of the field for computing hash
key, stating in the docuement that "default implementation
is not efficient enough. If you want, override hash."
If such a implementaion is available, people like me, who is
developing a prototype sysmte, will gladly use the default.
That being said, what's the benefit of OpenStruct? If OpenStruct
is nothing but a hashtable with syntactic sugar, I see reason
of using it. Am I missing something?
Best,
Minkoo Seo