Re: operation on module arguments



Brooks Moses wrote:

The thing is that what "real A" means is "allocate a certain bit of memory for storing a real variable, and let the variable name 'A' refer to that bit of memory."

You're asking for it to potentially mean, instead, "allocate a certain bit of memory for storing a real variable, and let any attempts to update the variable name 'A' invoke a set of procedures as well as referring to this bit of memory." (But it would only mean this if something was defined in relation to it.)

Other languages/object models do have this feature. With COM objects, all objects have "properties", which are always accessed through getter and setter routines. VB (and extensions to C++) make this work like a variable on the client side.

e.g.
(class module Foo)

Private m_bar As Long

Public Property Let Bar(ByVal rhs As Long)
m_bar = rhs
' or you could do other stuff here...
End Property

Public Property Get Bar() As Long
Bar = m_bar
' or you could do other stuff here...
End Property

'It's not mandatory to have both getter and setter, you could omit one
'to have a read-only or write-only property, although a function will
'generally be more appropriate for the latter.

(client code)
Dim myFoo As New Foo
Dim baz As Long

myFoo.Bar = 5
baz = MyFoo.Bar
.



Relevant Pages

  • Re: performance and memory usage.
    ... you're just storing a lot of data. ... 1- Is there a more efficient way of storing this in memory, ... The only difference is that in Java, objects carry an additional 8 bytes ... You should, ideally, use a database for storing large data sets. ...
    (comp.lang.java.programmer)
  • aspnet_state.exe Internals Info Needed
    ... I noticed when storing large amounts of information in the StateServer ... Service that this does not increase in size, the worker process itself seems ... I thought the State Server actually stored the session data itself, ... seem from my example that this is not the case and that the memory space ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: A challenging file to parse
    ... algorithm problem and found a Orun-time and Omemory solution, ... Do the same thing, but when storing in an array, store it at ...
    (comp.lang.c)
  • Re: Security of data in memory
    ... > I have a unix program that reads in an encrypted file, decrypts it and ... > prior to exiting, not storing any of the data in a temporary file, etc. ... Storing it "in memory" risks having it written out to swap, ...
    (SecProg)
  • Re: A challenging file to parse
    ... memory and I see no strategy where I can hold a subset of lines in ... this time ignoring the first 0.5MB from each ... line, storing the next 0.5MB, and ignoring the tails. ... Write that second batch out, rewind, rinse, and repeat. ...
    (comp.lang.c)