Prove me you are good!!! 
Author Message
 Prove me you are good!!!

You have to concatenate two variables to declare one other variable...
How can You do that?

Option Explicit
Dim test As String
Dim a As String

Private Sub Form_Load()
    test = "celso"
    a = "01"
    Dim (test $ a) As Integer
    celso01 = celso01 + 1
    MsgBox celso01
    End
End Sub



Fri, 01 Sep 2000 03:00:00 GMT  
 Prove me you are good!!!

You can't. And why would you want to?



Quote:
> You have to concatenate two variables to declare one other variable...
> How can You do that?

> Option Explicit
> Dim test As String
> Dim a As String

> Private Sub Form_Load()
>     test = "celso"
>     a = "01"
>     Dim (test $ a) As Integer
>     celso01 = celso01 + 1
>     MsgBox celso01
>     End
> End Sub



Fri, 01 Sep 2000 03:00:00 GMT  
 Prove me you are good!!!

And even if you could you still wouldn't use + to concatenate strings use &
instead.

Quote:

>You have to concatenate two variables to declare one other variable...
>How can You do that?

>Option Explicit
>Dim test As String
>Dim a As String

>Private Sub Form_Load()
>    test = "celso"
>    a = "01"
>    Dim (test $ a) As Integer
>    celso01 = celso01 + 1
>    MsgBox celso01
>    End
>End Sub



Fri, 01 Sep 2000 03:00:00 GMT  
 Prove me you are good!!!

There are times when this would be helpful.  Depends on your approach to
problem solving.  In other languages (Smalltalk) where this "type" of code
(ie. very dynamic) is possible, this is a common idiom...

Quote:

>You can't. And why would you want to?



>> You have to concatenate two variables to declare one other variable...
>> How can You do that?

>> Option Explicit
>> Dim test As String
>> Dim a As String

>> Private Sub Form_Load()
>>     test = "celso"
>>     a = "01"
>>     Dim (test $ a) As Integer
>>     celso01 = celso01 + 1
>>     MsgBox celso01
>>     End
>> End Sub



Fri, 01 Sep 2000 03:00:00 GMT  
 Prove me you are good!!!

On Mon, 16 Mar 1998 08:12:46 -0800, "Russ McClelland"

Quote:

>There are times when this would be helpful.  Depends on your approach to
>problem solving.  In other languages (Smalltalk) where this "type" of code
>(ie. very dynamic) is possible, this is a common idiom...

Looks like an xbase programmer wanting the macro decompiler to me!

Blake

Please remove the 454 from my email address if responding
by email (SPAM protection):



Fri, 01 Sep 2000 03:00:00 GMT  
 Prove me you are good!!!


Quote:
>There are times when this would be helpful.  Depends on your approach to
>problem solving.  In other languages (Smalltalk) where this "type" of code
>(ie. very dynamic) is possible, this is a common idiom...

Could you give an example? It sounds to me like someone wants to declare
variables like var1, var2...etc. and never heard of ReDim. :)


Fri, 01 Sep 2000 03:00:00 GMT  
 Prove me you are good!!!

One of the things Smalltalk is good at is dynamic programming because
nothing is "bound" at compile time.  For instance:

Say you have a group of radio buttons and depending on which radio button is
selected, you send a different message to an object.  In Smalltalk, the
value of a radio button is not true/false or a number(index), it's anything
I want it to be, including the name of a message.  So my code looks like
this:

Setup 3 radio buttons:
rdoName -> selection value = #name
rdoAge -> selection value = #age
rdoSSN -> selection value = #ssn

The following code will display a message box with either the name, age, or
SSN of an object:

Dialog warn: ( anObject perform: buttonValue )

anObject is the receiver.  buttonValue is a variable that is automatically
update with the selected radio button's value.

BTW, the selection value can also be any other type of object (since
everything in ST is an object), which means I can also choose between 3
different receivers like this:

Dialog warn: ( buttonValue name )

The value can also be a class (since classes are objects in ST as well) so I
can create one of 3 different classes like this:

buttonValue new

All this instead of something like VB:

Select Case Index
    Case 1
        'do this
    Case 2
        'do that
    Case 3
        'yada yada yada
End Select

Much more elegant code and less complex because there are fewer decision
trees.

Quote:



>>There are times when this would be helpful.  Depends on your approach to
>>problem solving.  In other languages (Smalltalk) where this "type" of code
>>(ie. very dynamic) is possible, this is a common idiom...

>Could you give an example? It sounds to me like someone wants to declare
>variables like var1, var2...etc. and never heard of ReDim. :)



Fri, 01 Sep 2000 03:00:00 GMT  
 Prove me you are good!!!

On Mon, 16 Mar 1998 13:57:15 -0800, "Russ McClelland"

Quote:

>One of the things Smalltalk is good at is dynamic programming because
>nothing is "bound" at compile time.  For instance:

>Say you have a group of radio buttons and depending on which radio button is
>selected, you send a different message to an object.  In Smalltalk, the
>value of a radio button is not true/false or a number(index), it's anything
>I want it to be, including the name of a message.  So my code looks like
>this:

>Setup 3 radio buttons:
>rdoName -> selection value = #name
>rdoAge -> selection value = #age
>rdoSSN -> selection value = #ssn

>The following code will display a message box with either the name, age, or
>SSN of an object:

>Dialog warn: ( anObject perform: buttonValue )

>anObject is the receiver.  buttonValue is a variable that is automatically
>update with the selected radio button's value.

>BTW, the selection value can also be any other type of object (since
>everything in ST is an object), which means I can also choose between 3
>different receivers like this:

>Dialog warn: ( buttonValue name )

>The value can also be a class (since classes are objects in ST as well) so I
>can create one of 3 different classes like this:

>buttonValue new

>All this instead of something like VB:

>Select Case Index
>    Case 1
>        'do this
>    Case 2
>        'do that
>    Case 3
>        'yada yada yada
>End Select

>Much more elegant code and less complex because there are fewer decision
>trees.

Yes, but which code is the most readable?

/Jonas



Sat, 02 Sep 2000 03:00:00 GMT  
 Prove me you are good!!!

If you're used to OO programming, constructs like switch, select and if
aren't used as much.  The mechanism for handling decisions in OO is through
polymorphism, ie.  I don't care which object as long as it responds to a
specific interface.  Certainly you can see that the ST way elimiates most of
your UI code.  So, while it may "seem" to be less readable at first, you
have 90% less code to understand, especially when coupled with the fact that
ST widgets can be directly bound to attributes of an object without writing
any code.  You simply elimiate all the code that copies values to and from
your widgets.

Quote:

>On Mon, 16 Mar 1998 13:57:15 -0800, "Russ McClelland"

>>One of the things Smalltalk is good at is dynamic programming because
>>nothing is "bound" at compile time.  For instance:

>>Say you have a group of radio buttons and depending on which radio button
is
>>selected, you send a different message to an object.  In Smalltalk, the
>>value of a radio button is not true/false or a number(index), it's
anything
>>I want it to be, including the name of a message.  So my code looks like
>>this:

>>Setup 3 radio buttons:
>>rdoName -> selection value = #name
>>rdoAge -> selection value = #age
>>rdoSSN -> selection value = #ssn

>>The following code will display a message box with either the name, age,
or
>>SSN of an object:

>>Dialog warn: ( anObject perform: buttonValue )

>>anObject is the receiver.  buttonValue is a variable that is automatically
>>update with the selected radio button's value.

>>BTW, the selection value can also be any other type of object (since
>>everything in ST is an object), which means I can also choose between 3
>>different receivers like this:

>>Dialog warn: ( buttonValue name )

>>The value can also be a class (since classes are objects in ST as well) so
I
>>can create one of 3 different classes like this:

>>buttonValue new

>>All this instead of something like VB:

>>Select Case Index
>>    Case 1
>>        'do this
>>    Case 2
>>        'do that
>>    Case 3
>>        'yada yada yada
>>End Select

>>Much more elegant code and less complex because there are fewer decision
>>trees.

>Yes, but which code is the most readable?

>/Jonas



Sat, 02 Sep 2000 03:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. I am proved wrong!

2. Prove me you are good!!!

3. I am looking for a good place to buy dev software online

4. I am a VB newbie, looking for good manual

5. Timer Question - I have explained better what I am looking for

6. I am looking for the best book for learning VB.

7. Am I better off without MTS (more...)?

8. .NET PERFORMANCE ?? (PROVE)

9. .NET PERFORMANCE ?? (PROVE)

10. NET PERFORMANCE ?? (PROVE)

11. Proving the NP Conjecture

12. Byref or Byval, (which is faster and be able to prove it)

 

 
Powered by phpBB® Forum Software