J
JKop
The other day I had to write some code to manipulate a Micrsoft Excel
spreadsheet. I had to write it in Visual Basic, which I haven't used for
about 5 years. Anyway, it slowly started creeping back to me and I began to
understand terms like:
ByVal (by value)
ByRef (by reference)
I remember how excited I was switching to C++, working with a better, more
controllable language.
But now going back and using VB I've realized how much I love the
simplicity. One thing I particularly like is re-seatable references:
Dim k as Zone
The above is an object definition. "k" is the name of the object and "Zone"
is the type. It would be akin to:
Zone k;
in C++. Anyway, while in C++, that would create an object, all it does in VB
is create a re-seatable reference. For example, if I try to do this:
Dim k as Zone
k.SomeMemberFunction
Then there will be a runtime error, it would be like doing the following in
C++:
Zone* k;
k->SomeMemberFunction();
Here's how you actually work with it:
Dim k as Zone
Set k = New Zone
k.SomeMemberFunction
Anyway, I love the idea of re-seatable references. Sure, we can re-seat
pointers, but then that adds all the bullshit of dodgy syntax.
So anyway, I'd just like to hear general opinions on the simplicity in other
languages. I particulary like how VB uses actual words instead of symbols,
eg.:
//start VB code
Public Sub DoStuff(ByRef r as integer)
r = 12
End Function
//end VB code
would be the equivalent of:
void DoStuff(int &r)
{
r = 12
}
****
Before I go and write one myself, has anyone written a class for a re-
seatable reference? I think I'll use macros to achieve syntax something
like:
int% a; //a re-seatable reference
int k;
Set a = k;
a = 4; //changes k's value
int z;
Set a = z;
a = 9; //changes z's value
-JKop
spreadsheet. I had to write it in Visual Basic, which I haven't used for
about 5 years. Anyway, it slowly started creeping back to me and I began to
understand terms like:
ByVal (by value)
ByRef (by reference)
I remember how excited I was switching to C++, working with a better, more
controllable language.
But now going back and using VB I've realized how much I love the
simplicity. One thing I particularly like is re-seatable references:
Dim k as Zone
The above is an object definition. "k" is the name of the object and "Zone"
is the type. It would be akin to:
Zone k;
in C++. Anyway, while in C++, that would create an object, all it does in VB
is create a re-seatable reference. For example, if I try to do this:
Dim k as Zone
k.SomeMemberFunction
Then there will be a runtime error, it would be like doing the following in
C++:
Zone* k;
k->SomeMemberFunction();
Here's how you actually work with it:
Dim k as Zone
Set k = New Zone
k.SomeMemberFunction
Anyway, I love the idea of re-seatable references. Sure, we can re-seat
pointers, but then that adds all the bullshit of dodgy syntax.
So anyway, I'd just like to hear general opinions on the simplicity in other
languages. I particulary like how VB uses actual words instead of symbols,
eg.:
//start VB code
Public Sub DoStuff(ByRef r as integer)
r = 12
End Function
//end VB code
would be the equivalent of:
void DoStuff(int &r)
{
r = 12
}
****
Before I go and write one myself, has anyone written a class for a re-
seatable reference? I think I'll use macros to achieve syntax something
like:
int% a; //a re-seatable reference
int k;
Set a = k;
a = 4; //changes k's value
int z;
Set a = z;
a = 9; //changes z's value
-JKop