Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.scripting.vbscript > #12345
| From | "Mayayana" <mayayana@invalid.nospam> |
|---|---|
| Newsgroups | microsoft.public.scripting.vbscript |
| Subject | Re: Modifying array elements in a dictionary is ineffective? |
| Date | 2021-04-10 08:04 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <s4s49f$2ng$1@dont-email.me> (permalink) |
| References | <s8ls3gg24yv1$.flt0oavzanef$.dlg@40tude.net> <s4r4na$rlf$1@dont-email.me> <1fpdxfmzawglq$.c348yad4gvp0.dlg@40tude.net> |
"JJ" <jj4public@gmail.com> wrote | Your code changes the value in the dictionary item itself. Not just changing | the value contained in the dictionary item (which is the array). i.e. it | basically changes the whole array. | No. It just gets a pointer to the array variable first, rather than trying to do it in one step. The problem seems to be that the array is not part of a dic object model, so you can't reference it that way. | Even though that workaround works, it'll cause performace decrease for large | arrays because the array needs to be copied two times. But that can't be | helped, since it seems to be the only workaround. | It will probably slow things down. If you're doing something big I wonder if a dictionary class could be better. I use them in VB6. But everything's slow in VBS due to the constant data conversion. I do a similar thing to unpack MSI files and it works reasonably well. I process all the data into an object model by using numerous dictionaries to store it. I assume you know you can access the items as a Keys array. But of course that, not typically useful unless you just want to walk the array. It defeats the purpose of accessing one item directly by its keyy name. | My guess for problem, is due to the fact that the array or any value is | stored in a COM object instead of the script engine itself, because COM | properties can only have either `propget`, `propput`, and `propputref`. | There is no `propgetref`. And Dictionary COM doesn't expose any method which | can return the reference of an item's content. The script engine can not | know the direct reference of a property content because the property content | is managed by an external library. Sounds right. In other words, there's no object model. With something like DOM you can have document.DivA(3).borderstyle, but that's because the whole thing is an object model. The variable pointer here is to the dictionary. Dictionary members are not variables until you reference them. I hadn't thought of it that way, but it makes sense.
Back to microsoft.public.scripting.vbscript | Previous | Next — Previous in thread | Next in thread | Find similar
Modifying array elements in a dictionary is ineffective? JJ <jj4public@gmail.com> - 2021-04-10 07:46 +0700
Re: Modifying array elements in a dictionary is ineffective? "Mayayana" <mayayana@invalid.nospam> - 2021-04-09 23:05 -0400
Re: Modifying array elements in a dictionary is ineffective? JJ <jj4public@gmail.com> - 2021-04-10 17:08 +0700
Re: Modifying array elements in a dictionary is ineffective? "Mayayana" <mayayana@invalid.nospam> - 2021-04-10 08:04 -0400
Re: Modifying array elements in a dictionary is ineffective? "R.Wieser" <address@not.available> - 2021-04-10 10:39 +0200
Re: Modifying array elements in a dictionary is ineffective? "Mayayana" <mayayana@invalid.nospam> - 2021-04-11 15:41 -0400
Re: Modifying array elements in a dictionary is ineffective? JJ <jj4public@gmail.com> - 2021-04-12 09:13 +0700
Re: Modifying array elements in a dictionary is ineffective? "Mayayana" <mayayana@invalid.nospam> - 2021-04-12 09:51 -0400
Re: Modifying array elements in a dictionary is ineffective? JJ <jj4public@gmail.com> - 2021-04-13 00:08 +0700
csiph-web