Search the web
Sign In
New User? Sign Up
elfdata
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
ElfDataDictionary inside an ElfDataDictionary   Message List  
Reply | Forward Message #40 of 450 |
Re: [elfdata] ElfDataDictionary inside an ElfDataDictionary

Yes, I knew I could, I just wanted to know if the object was unnecessarily
copied when accessing the subdictionary.

So, it's really an object reference, and not the actual object that is
stored? Hmm, that's good. Come to think of it, it's the only logical way,
but with RB you never know.

What I'm using it for? For exposing the class through the RBScript context.
So, users can do:
dim d As WhatevernameIgaveIt, and use the dictionary (by means of the
methods and properties I also exposed, of course). The reference to this
EDictionary is then stored in the main Context_Objects ElfDataDictionary.
Personally, the only class I'm using myself this way (in my templates, I
mean) is the FastString class, but perhaps someone might like or need to use
any of the other classes too (like Date, Dictionary, ...).

Your suggestion of using prefixes however is worth exploring as a possible
solution too, but only if it is faster. If needing to avoid object creation
is the only incentive then it's not worth it. There are not that many
objects, plus they're only created once during the entire RBScript run.

Ronald Vogelaar
--
http://www.rovosoft.com

----- Original Message -----
From: "Theodore H. Smith" <delete@...>
To: <elfdata@yahoogroups.com>
Sent: Friday, September 01, 2006 10:24 AM
Subject: Re: [elfdata] ElfDataDictionary inside an ElfDataDictionary


>
> On 1 Sep 2006, at 07:39, Ronald Vogelaar wrote:
>
>>
>> Hi Theo,
>>
>> I was just wondering, If I store an ElfDataDictionary in another
>> ElfDataDictionary, like so:
>>
>> Dim ed As ElfData
>> Dim d, e As ElfDataDictionary
>> d=New ElfDataDictionary
>> e=New ElfDataDictionary
>>
>>
>> ed="somekey"
>>
>> e.Value(ed)=d
>>
>>
>> ...if I were then to access ElfDataDictionary d (within e), do I
>> have access to it directly, or is a copy created every time I
>> access it?
>>
>>
>> Dim i As Integer
>> i=ElfDataDictionary(e.Value(ed)).Count
>
> Of course you can :) Everything is stored as an object reference just
> like any other object variable in RB.
>
> Just curious what are you using this for?
>
> Another idea could be to use prefixes. So instead of storing
> something in a subdictionary, store it with a prefix. Maybe: e.Value
> ("d.somekey") = Something
>
> Could save creating extra objects.
>



Fri Sep 1, 2006 9:22 am

enter@...
Send Email Send Email

Forward
Message #40 of 450 |
Expand Messages Author Sort by Date

Hi Theo, I was just wondering, If I store an ElfDataDictionary in another ElfDataDictionary, like so: Dim ed As ElfData Dim d, e As ElfDataDictionary d=New...
Ronald Vogelaar
enter@...
Send Email
Sep 1, 2006
6:39 am

... Of course you can :) Everything is stored as an object reference just like any other object variable in RB. Just curious what are you using this for? ...
Theodore H. Smith
boytheouk
Offline Send Email
Sep 1, 2006
8:25 am

Yes, I knew I could, I just wanted to know if the object was unnecessarily copied when accessing the subdictionary. So, it's really an object reference, and...
Ronald Vogelaar
enter@...
Send Email
Sep 1, 2006
9:26 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help