-
GOSUB vs. Macros vs. Nested Functions
Most of the arguments for GoSub also apply for Macros and Nested Functions.
So lets take some time to consider if we really need GoSub, or if one of the
other two options are more applicable.
--
Jonathan Allen
My Bigfoot email account was rejecting messages for no apparent reason.
Therefore I am now using greywolf@cts.com as my email address.
-
Re: GOSUB vs. Macros vs. Nested Functions
> Most of the arguments for GoSub also apply for Macros and Nested
Functions.
> So lets take some time to consider if we really need GoSub, or if one of
the
> other two options are more applicable.
Nested functions, of course.
-
Re: GOSUB vs. Macros vs. Nested Functions
Jonathan Allen wrote:
>
> Most of the arguments for GoSub also apply for Macros and Nested Functions.
> So lets take some time to consider if we really need GoSub, or if one of the
> other two options are more applicable.
>
Macros like C #Define statements?
Bill
-
Re: GOSUB vs. Macros vs. Nested Functions
On Mon, 5 Mar 2001 09:57:22 -0800, "Jonathan Allen" <greywolf@cts.com>
wrote:
>Most of the arguments for GoSub also apply for Macros and Nested Functions.
>So lets take some time to consider if we really need GoSub, or if one of the
>other two options are more applicable.
The language already has this functionality, it's just implemented
using the GoSub keyword. In fact, instead of doing the compiler
implementation like they did in VB5/6 (embedded pseudostack sorta
thing) they could easily implemente GoSub as a macro substitution by
the compiler.
****, if they'll just give the Return keyword back and provide compile
triggered macros I'll do the damned thing as a preprocessor.
Dan
Language Stability is a *feature* I wish VB had!
(#6)
-
Re: GOSUB vs. Macros vs. Nested Functions
On Mon, 5 Mar 2001 15:08:10 -0800, "Sjoerd Verweij"
<nospam.sjoerd@sjoerd.org> wrote:
>> Most of the arguments for GoSub also apply for Macros and Nested
>Functions.
>> So lets take some time to consider if we really need GoSub, or if one of
>the
>> other two options are more applicable.
>
>Nested functions, of course.
Those would be handy, but why change from what is already there? To
eliminate the GoSub functionality and simply reimplement it another
way doesn't seem very "Language Stable" to me. What's it gonna be
next time?
Dan
Language Stability is a *feature* I wish VB had!
(#6)
-
Re: GOSUB vs. Macros vs. Nested Functions
Sorry, newbie question.
I understand GoSub (although I never used it), and Nested Functions sound
interesting (but I don't know why I'd use it), but what the heck are Macros
in this context?
Ian.
"Jonathan Allen" <greywolf@cts.com> wrote in message
news:3aa40587@news.devx.com...
> Most of the arguments for GoSub also apply for Macros and Nested
Functions.
> So lets take some time to consider if we really need GoSub, or if one of
the
> other two options are more applicable.
>
> --
> Jonathan Allen
>
> My Bigfoot email account was rejecting messages for no apparent reason.
> Therefore I am now using greywolf@cts.com as my email address.
>
>
>
>
>
-
Re: GOSUB vs. Macros vs. Nested Functions
Well Dan, MSIL is publicly documented. Sounds like you're the man to write
GWBASIC.NET.
That product should apease the "give-me-back-the-old-technology" crowd. And
who knows, you might just make a buck 
-Rob
Dan Barclay <dbarclay@ih2000.net> wrote:
>
>The language already has this functionality, it's just implemented
>using the GoSub keyword. In fact, instead of doing the compiler
>implementation like they did in VB5/6 (embedded pseudostack sorta
>thing) they could easily implemente GoSub as a macro substitution by
>the compiler.
>
>****, if they'll just give the Return keyword back and provide compile
>triggered macros I'll do the damned thing as a preprocessor.
>
>Dan
>Language Stability is a *feature* I wish VB had!
> (#6)
-
Re: GOSUB vs. Macros vs. Nested Functions
> Those would be handy, but why change from what is already there?
It is not already there, nor has it ever been there. Until you stop thinking
about VB.Net from a VB6 perspective, your going to keep hitting the same
brick wall.
--
Jonathan Allen
My Bigfoot email account was rejecting messages for no apparent reason.
Therefore I am now using greywolf@cts.com as my email address.
"Dan Barclay" <dbarclay@ih2000.net> wrote in message
news:kgh8atgftp7h8uvjnmcspgi1tu9ijdvs76@4ax.com...
> On Mon, 5 Mar 2001 15:08:10 -0800, "Sjoerd Verweij"
> <nospam.sjoerd@sjoerd.org> wrote:
>
> >> Most of the arguments for GoSub also apply for Macros and Nested
> >Functions.
> >> So lets take some time to consider if we really need GoSub, or if one
of
> >the
> >> other two options are more applicable.
> >
> >Nested functions, of course.
>
> Those would be handy, but why change from what is already there? To
> eliminate the GoSub functionality and simply reimplement it another
> way doesn't seem very "Language Stable" to me. What's it gonna be
> next time?
>
> Dan
> Language Stability is a *feature* I wish VB had!
> (#6)
-
Re: GOSUB vs. Macros vs. Nested Functions
> Macros like C #Define statements?
Possibly. Then again, maybe there is a better way.
--
Jonathan Allen
My Bigfoot email account was rejecting messages for no apparent reason.
Therefore I am now using greywolf@cts.com as my email address.
"William Cleveland" <WCleveland@Mediaone.Net> wrote in message
news:3AA42FE9.4FA11874@Mediaone.Net...
> Jonathan Allen wrote:
> >
> > Most of the arguments for GoSub also apply for Macros and Nested
Functions.
> > So lets take some time to consider if we really need GoSub, or if one of
the
> > other two options are more applicable.
> >
> Macros like C #Define statements?
>
> Bill
-
Re: GOSUB vs. Macros vs. Nested Functions
> but what the heck are Macros
> in this context?
Take this outline...
Sub Test()
'some code
'a big block of code we'll call ZZZ
'some more code
'ZZZ (again)
'yet more code
'ZZZ (yet again)
End Sub
Same code, using GoSub to make it cleaner
Sub Test()
'some code
GoSub MyLabel
'some more code
GoSub MyLabel
'yet more code
GoSub MyLabel
Exit Sub
MyLabel:
'a big block of code we'll call ZZZ
Return
End Sub
The same code with a Macro instead
#Macro ZZZ
'a big block of code we'll call ZZZ
#End Macro
Sub Test()
'some code
#ZZZ
'some more code
#ZZZ
'yet more code
#ZZZ
End Sub
As you can see, in this kind of situation a macro can be cleaner than a
GoSub. However, a nested function (to some people) is cleaner still.
--
Jonathan Allen
My Bigfoot email account was rejecting messages for no apparent reason.
Therefore I am now using greywolf@cts.com as my email address.
"Ian Lowe" <idlowe@home.com> wrote in message news:3aa45163@news.devx.com...
> Sorry, newbie question.
>
> I understand GoSub (although I never used it), and Nested Functions sound
> interesting (but I don't know why I'd use it), but what the heck are
Macros
> in this context?
>
> Ian.
>
> "Jonathan Allen" <greywolf@cts.com> wrote in message
> news:3aa40587@news.devx.com...
> > Most of the arguments for GoSub also apply for Macros and Nested
> Functions.
> > So lets take some time to consider if we really need GoSub, or if one of
> the
> > other two options are more applicable.
> >
> > --
> > Jonathan Allen
> >
> > My Bigfoot email account was rejecting messages for no apparent reason.
> > Therefore I am now using greywolf@cts.com as my email address.
> >
> >
> >
> >
> >
>
>
-
Re: GOSUB vs. Macros vs. Nested Functions
I too think you should go for it.
Don't call GW-BASIC though. The GW stands for "Gee Wiz", which is kind of
corny. But then again, "Gosh Darn-It Basic" does have a nostalgic ring to
it. Nice a friendly like.
--
Jonathan Allen
My Bigfoot email account was rejecting messages for no apparent reason.
Therefore I am now using greywolf@cts.com as my email address.
"Rob Teixeira" <RobTeixeira@@msn.com> wrote in message
news:3aa4622a$1@news.devx.com...
>
> Well Dan, MSIL is publicly documented. Sounds like you're the man to write
> GWBASIC.NET.
> That product should apease the "give-me-back-the-old-technology" crowd.
And
> who knows, you might just make a buck 
>
> -Rob
>
> Dan Barclay <dbarclay@ih2000.net> wrote:
> >
> >The language already has this functionality, it's just implemented
> >using the GoSub keyword. In fact, instead of doing the compiler
> >implementation like they did in VB5/6 (embedded pseudostack sorta
> >thing) they could easily implemente GoSub as a macro substitution by
> >the compiler.
> >
> >****, if they'll just give the Return keyword back and provide compile
> >triggered macros I'll do the damned thing as a preprocessor.
> >
> >Dan
> >Language Stability is a *feature* I wish VB had!
> > (#6)
>
-
Re: GOSUB vs. Macros vs. Nested Functions
Just to stir things up a bit....
I've been using Vb since version 3 and have never used a single GoSub or
macro in any application I've written. To my mind GoSubs went out with the
ark.What's wrong with calling a function or procedure ?It's cleaner, it makes
code more readable to my mind and you don't get procedures that go on for
pages and pages. { )
"Jonathan Allen" <greywolf@cts.com> wrote:
>> but what the heck are Macros
>> in this context?
>
>Take this outline...
>
>Sub Test()
> 'some code
> 'a big block of code we'll call ZZZ
>
> 'some more code
> 'ZZZ (again)
>
> 'yet more code
> 'ZZZ (yet again)
>End Sub
>
>
>Same code, using GoSub to make it cleaner
>
>Sub Test()
> 'some code
> GoSub MyLabel
>
> 'some more code
> GoSub MyLabel
>
> 'yet more code
> GoSub MyLabel
>Exit Sub
>
>MyLabel:
> 'a big block of code we'll call ZZZ
> Return
>End Sub
>
>The same code with a Macro instead
>
>#Macro ZZZ
> 'a big block of code we'll call ZZZ
>#End Macro
>
>Sub Test()
>
> 'some code
> #ZZZ
> 'some more code
> #ZZZ
> 'yet more code
> #ZZZ
>End Sub
>
>As you can see, in this kind of situation a macro can be cleaner than a
>GoSub. However, a nested function (to some people) is cleaner still.
>
>--
>Jonathan Allen
>
>My Bigfoot email account was rejecting messages for no apparent reason.
>Therefore I am now using greywolf@cts.com as my email address.
>
>
>
>"Ian Lowe" <idlowe@home.com> wrote in message news:3aa45163@news.devx.com...
>> Sorry, newbie question.
>>
>> I understand GoSub (although I never used it), and Nested Functions sound
>> interesting (but I don't know why I'd use it), but what the heck are
>Macros
>> in this context?
>>
>> Ian.
>>
>> "Jonathan Allen" <greywolf@cts.com> wrote in message
>> news:3aa40587@news.devx.com...
>> > Most of the arguments for GoSub also apply for Macros and Nested
>> Functions.
>> > So lets take some time to consider if we really need GoSub, or if one
of
>> the
>> > other two options are more applicable.
>> >
>> > --
>> > Jonathan Allen
>> >
>> > My Bigfoot email account was rejecting messages for no apparent reason.
>> > Therefore I am now using greywolf@cts.com as my email address.
>> >
>> >
>> >
>> >
>> >
>>
>>
>
>
-
Re: GOSUB vs. Macros vs. Nested Functions
Gosubs are completely different from Functions and Subs in the way that they
do not accept a parameterlist.
When you are coding a real project with GoSubs it is impossible to keep
track of which portion of the code changes which variables. That for me is
the main reason never to use GoSubs.
This also implies that the argument that SubFunctions are allready in the
language through GoSubs is nonsense ...
Jens
"Dan Barclay" <dbarclay@ih2000.net> wrote in message
news:qah8at4rd7ul47h0rau5i0e388u9np2rvt@4ax.com...
> On Mon, 5 Mar 2001 09:57:22 -0800, "Jonathan Allen" <greywolf@cts.com>
> wrote:
>
> >Most of the arguments for GoSub also apply for Macros and Nested
Functions.
> >So lets take some time to consider if we really need GoSub, or if one of
the
> >other two options are more applicable.
>
> The language already has this functionality, it's just implemented
> using the GoSub keyword. In fact, instead of doing the compiler
> implementation like they did in VB5/6 (embedded pseudostack sorta
> thing) they could easily implemente GoSub as a macro substitution by
> the compiler.
>
> ****, if they'll just give the Return keyword back and provide compile
> triggered macros I'll do the damned thing as a preprocessor.
>
> Dan
> Language Stability is a *feature* I wish VB had!
> (#6)
-
Re: GOSUB vs. Macros vs. Nested Functions
Jonathan Allen wrote:
>
> > Macros like C #Define statements?
>
> Possibly. Then again, maybe there is a better way.
>
I always thought that sort of macro was a hack for inline functions,
just like GoSub was a hack for nested subroutines. Inline functions
might be interesting, but VB's not a systems programming language.
Bill
-
Re: GOSUB vs. Macros vs. Nested Functions
Dan Barclay wrote:
>
> On Mon, 5 Mar 2001 15:08:10 -0800, "Sjoerd Verweij"
> <nospam.sjoerd@sjoerd.org> wrote:
>
> >> Most of the arguments for GoSub also apply for Macros and Nested
> >Functions.
> >> So lets take some time to consider if we really need GoSub, or if one of
> >the
> >> other two options are more applicable.
> >
> >Nested functions, of course.
>
> Those would be handy, but why change from what is already there? To
> eliminate the GoSub functionality and simply reimplement it another
> way doesn't seem very "Language Stable" to me. What's it gonna be
> next time?
>
For one thing, with nested subs, the upgrade wizard should be able to
handle converting your GoSub sections.
Bill
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|