realbasic-nug
[Top] [All Lists]

Re: String as Dictionary string

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: String as Dictionary string
From: Jason Essington <jasone at GreenRiverComputing dot com>
Date: Thu, 30 Dec 2004 13:09:17 -0700
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <r02010400-1037-13104EBC5A8511D98FE9000A95C8DD62 at [192 dot 168 dot 0 dot 25]> <92C006B8-5A97-11D9-88DA-000D932CC652 at GreenRiverComputing dot com> <0CCA7654-5A99-11D9-BA8A-000A957CB4CC at desuetude dot com> <7A4E321E-5A9A-11D9-88DA-000D932CC652 at GreenRiverComputing dot com> <C990F307-5A9B-11D9-BA8A-000A957CB4CC at desuetude dot com>
On Dec 30, 2004, at 12:48 PM, Charles Yeomans wrote:


On Dec 30, 2004, at 2:39 PM, Jason Essington wrote:

On Dec 30, 2004, at 12:28 PM, Charles Yeomans wrote:


On Dec 30, 2004, at 2:18 PM, Jason Essington wrote:

how hard is it to just subclass dictionary something like:


Right now it's pretty hard; I don't think that methods of intrinsic classes can be overridden.

Funny, that was exported source from a little test class that I made to do just that. It appeared to work just fine for me (RB 5.5.4).

my test case looked something like:

  dim d As new StringKeyDictionary()

  d.value("abc") = "lowercase"
  d.value("aBc") = "mixed case"
  d.value("ABC") = "uppercase"

  MsgBox "abc "+d.value("abc")
  MsgBox "aBc "+d.value("aBc")
  MsgBox "ABC "+d.value("ABC")

  d.value(34) = "number" // throws exception
  MsgBox "34 "+d.value(34) // would also throw exception



Appearances can be deceiving -- try changing the first line above to

dim d as Dictionary

and see what happens.


yup, that causes RB to fail to follow class hierarchy . . . which is a bug in my opinion.

never the less if you define the variable as a StringKeyDictionary it works as expected.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>