![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
If a is an object and b is the name of a property or column, what is the best way of accessing the property/column? I was using a.&b but tried to use name substitution, namely a.(b) The former works, but the latter does not. What is the correct way for using name substitution here? |
#3
| |||
| |||
|
|
How about this: To get the value of the property/column: ? eval("a."+b) To set the value of the property: STORE (value) TO ("a."+b) NOTE: ("a."+b) = (value) doesn't work. Interesting "feature" of the ol' STORE command. To assign a value to a column: REPLACE ("a."+b) WITH (value) Hope this helps, |
#4
| |||
| |||
|
|
Eric Selje <eric_selje (AT) vid (DOT) uscourts.gov> wrote: How about this: To get the value of the property/column: ? eval("a."+b) To set the value of the property: STORE (value) TO ("a."+b) NOTE: ("a."+b) = (value) doesn't work. Interesting "feature" of the ol' STORE command. To assign a value to a column: REPLACE ("a."+b) WITH (value) Hope this helps, That is horribly ugly. I will stick with a.&b Why does a.(b) not work? I can not see a reason why it should not work. It is consistent with other uses of (). |
#5
| |||
| |||
|
|
That is horribly ugly. I will stick with a.&b Why does a.(b) not work? I can not see a reason why it should not work. It is consistent with other uses of (). |
#6
| |||
| |||
|
|
Gene Wirchenko wrote: That is horribly ugly. I will stick with a.&b Why does a.(b) not work? I can not see a reason why it should not work. It is consistent with other uses of (). I guess beauty is in the eye of the programmer. I cringe when I see macro substitution because I think "performance penalty." I think this was justified a few years back with some testing. |
#7
| ||||
| ||||
|
|
On Tue, 14 Sep 2004 08:08:38 -0700, Gene Wirchenko genew (AT) mail (DOT) ocis.net> wrote: |
|
That is horribly ugly. I will stick with a.&b Why does a.(b) not work? I can not see a reason why it should not work. It is consistent with other uses of (). I don't see it as consistent with other uses. All of the other uses that I am aware of have the () replacing a single text string (e.g. REPLACE (abc) ...) in a command. In this case you want to replace |
|
part of a syntactic expression that can occur almost anywhere including in expressions. |
|
It would make expressions be a little strange. a = (b).c would use replacement but a = (b) would not. Parentheses would have two meanings in expressions which might be confusing. |
#8
| |||
| |||
|
|
Given the choice of something that runs fast and is a bear to verify and something that can be easily verified but runs more slowly, I will generally go for the second. Correct answers trump incorrect answers. |
#9
| |||
| |||
|
|
"Gene Wirchenko" <genew (AT) mail (DOT) ocis.net> wrote in message Given the choice of something that runs fast and is a bear to verify and something that can be easily verified but runs more slowly, I will generally go for the second. Correct answers trump incorrect answers. Absolute truth in programming: Cheap, fast, accurate. Pick two. |
![]() |
| Thread Tools | |
| Display Modes | |
| |