For a start you will never debug it. Wanting to do this is a sign that
your design is very wrong.
jBC is a compiled language, therefore the line numbers have no meaning
except in the debugger. There are some compiled languages that annotate
lines but they are compiling broken languages.
The reason that you are wanting to do this is either that you have used
GOTO elsewhere in this program, or that you have called nested
subroutines, discovered an error and now want to back out of all the
GOSUBs until you can return from the subroutine. Either way, it means
that you need to redesign your subroutine. Each GOSUB should check an
error return and back out accordingly. This type of thing is why more
modern languages have exceptions that can cascade back up the chain and
be caught at an appropriate point. However jBC does not have this
functionality so you must program accordingly.
Now, personally, I think that the language should have had separate
notation for subroutine vs gosub return, but it doesn't, so you are
stuck with it. Review your design here - when you have to ask how to do
something like this, it means the program is broken.
Jim
Never, ever, ever, ever, ever, ever, ever, ever,ever, ever, ever, ever,ever,ever, use RETURN TO. That's ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever ad infinitum.
I think that good programming techniques don’t change.. nice, clear, concise code (with comments) is massively easier to develop, debug and has less bugs inserted with ongoing maintenance and updates...
My nightmare is code like (I was looking at code similar to this earlier in the week)...
IF X=2&Y=1&Z=3 THEN
A=A+1
J<X,Y>=R<Z>
GO 100
END ELSE
GO 200
END
This is just a snippet of the kind of code I was debugging – about 1000 lines of code in the same vein, without a single comment!
Such fun!
Simon
From:
jB...@googlegroups.com [mailto:jB...@googlegroups.com] On Behalf Of Richard
Kann
Sent: 03 March 2009 23:49
To: jB...@googlegroups.com
Subject: Re: Jbase programming query
I've seen worse though I agree on the return to's. The other
issue is goto statements that jump all over the world rather then using if
then's or other more smooth routines. Maybe it's my age, but back in the old
days it caused massive frame faulting making the disc run constant. These days
I guess it is not as important though still a pain to debug.
Simon Verona wrote:
--~--~---------~--~----~------------~-------~--~----~
Please read the posting guidelines at: http://groups.google.com/group/jBASE/web/Posting%20Guidelines
IMPORTANT: Type T24: at the start of the subject line for questions specific to Globus/T24
To post, send email to jB...@googlegroups.com
To unsubscribe, send email to jBASE-un...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en
-~----------~----~----~----~------~----~------~--~---
Jim
Simon Verona wrote:
On Mar 4, 6:10 pm, Simon Verona <si...@dmservices.co.uk> wrote:Agreed about the long term benefits of rewriting! Also whilst we're at it - fire any programmer that uses goto, return to, undescriptive variable names or seems incapable of writing comments. Though I did work with a programmer who claimed comments were unnecessary because the code was"self-documenting"!! Strangely enough he also was a big "goto" user.... SimonPerhaps controversially,
I believe that comments are often a result of somewhat shabby work.
We ought to think twice. Look at the code you've written and see if there are changes you could make to it that would make it self explanatory.
That little bit of extra effort is, in my opinion, better than taking the easy way out by throwing in a comment or two.
One argument in favour of this approach is that comments can end up misleading or extraneous after a code change.
It'd be easy for a programmer to get in and fix or change something, get the code working as it should, and overlook that the comment should also have been changed.
And - to add some extra heat to this discussion - GO can sometimes (although very rarely) have its place.
That's exactly what I was thinking - comments are for Why, not
How. The How might be awful but it's even worse (and a completely
separate issue) when we can't read the How and don't understand
the Why either.
I've been in both situations described in this thread:
- Had a hard time justifying to the client why code needed to be
re-written for a seemingly minor change. (In the end, had to eat
the time put in by one of my contractors just to get the code to
a point where we could do constructive work for the client.)
- Had to back away from a few projects because the existing code
written by someone else was so bad. My estimate for "how long
does it take to do this" was inflated X-fold to accommodate
"...given the current state of the code."
> And anyway, it's only BASIC, it isn't rocket science
> (except for the blokes at JPL that use jBASE that is).
Jim - I'm at JPL occasionally and to my knowledge that's a major
Oracle shop. If I had known they had jBase anywhere I would have
submitted an application years ago. Does anyone from JPL monitor
this list?
Tony Gravagno
Nebula Research and Development
TG@ remove.pleaseNebula-RnD.com
The blog: remove.pleaseNebula-RnD.com/blog
Visit PickWiki.com
Jim