Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can someone explain why macro needs to have 2 dots?
Message
From
20/02/2007 09:33:34
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
19/02/2007 12:56:57
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
Miscellaneous
Thread ID:
01196999
Message ID:
01197263
Views:
21
>>>>
with getpem(thisform, m.abc)
>>>>     .Visible = .t.
>>>>endwith
>>>>
>>>
>>>Yes! It's something that I always forget:)
>>>Cetin
>>
>>Same here. Probably best to avoid cause it's not really obvious what's happening.
>
>What do you mean, not obvious? GetPem returns a property - which could be an object since VFP3.

Hi Dragan

Please let me try to explain.

STORE "Dragan" TO m.lcName is obvious.
m.lcName = "Dragan" is slightly less obvious.

lcCmd = "STORE 'Dragan' to m.lcName"
*lots of code.
*lots of code.
*lots of code.
*lots of code.
&lcCmd.

Is far less obvious but may be necessary for the program.

GETPEM returning an object - is purely a performance trick. It isn't necessary.

In this case
LOCAL m.loLabel
A=SECONDS()
FOR X = 1 TO 100000
  m.loLabel = GETPEM(THISFORM,"Label1")
ENDFOR
?SECONDS()-M.A

A=SECONDS()
FOR X = 1 TO 100000
  m.loLabel = eval("THISFORM.Label1")
ENDFOR
?SECONDS()-M.A
Normally I want every iota of performance. GetPem took .289 seconds and eval took .380, but there's more to consider such as maintainability and readability. Code shouldn't be a puzzle.

It is not documented, it is not even indicated from the function name that it will return an object contained in another object. Maybe it should be called GetPOEM. :)

m.luSomething = getpem(THISFORM,"iuSomething")

Please tell me exactly what that code does. Would you agree that if you can't, it cannot be called "readable"? How many people can get it correct? You'd probably be able to figure it out from context, but that takes extra time.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform