If I remember correctly in Prime Information if you used a return in a
subroutine it returned to the calling program but if you used a stop it
stopped. I have also seen it happen in UV when running a program from Proc.
I don't remember how it happened but after converting the program from stop
to return I didn't have a problem with it anymore. After that happened I
just started using returns all of the time when I built a new program.
Jerry
--------------------------------------------------
From: "Anthony W. Youngman" <[email protected]>
Sent: Sunday, July 19, 2009 10:29 AM
To: <[email protected]>
Subject: Re: [U2] UV and triggers
In message <[email protected]>, Charlie Noah
<[email protected]> writes
John,
I can't believe you're recommending this. The only reason Universe treats
a RETURN as a STOP in a top-level program is that Universe tries to be
everything to everyone, forgiving mistakes and blunders, and trying to
determine what the user really wanted, no matter how badly the code is
written. In 1998, we converted from Universe to Jbase, and you can't
imagine all the problems we had fixing bad Universe code that worked (sort
of) so that it would work in a system that requires you to do things
correctly. When coding and breaking rules, you have to consider that the
code may be migrated someday. This is a case of "just because you can,
doesn't mean you should".
I doubt that's the case ... STOP may mean stop, but RETURN means "go back
one level". So RETURN makes perfect logical sense even in an outer
"program"...
I'm not talking about using the strengths of your particular
implementation even though they are unique to your implementation, just
doing dumb things that will bite you (or your predecessor) down the road.
I put "program" in quotes in my last paragraph, because I'm not even sure
all variants of BASIC accept the PROGRAM keyword! Certainly in my early
days programming PI I never used it, and I *think* the reason I didn't was
because it didn't exist in INFOBASIC. iirc it was added at the same time
as the FUNCTION keyword.
So I wouldn't say "John is recommending you use return", I'd say "RETURN
*always* works because subroutines should always end in a return, and at
one time everything BASIC was a subroutine". Oh - and I think PROGRAM and
SUBROUTINE are actually synonyms as far as the compiler is concerned :-)
Just my 2 cents worth.
And my tuppence.
Cheers,
Wol
--
Anthony W. Youngman <[email protected]>
'Yings, yow graley yin! Suz ae rikt dheu,' said the blue man, taking the
thimble. 'What *is* he?' said Magrat. 'They're gnomes,' said Nanny. The
man
lowered the thimble. 'Pictsies!' Carpe Jugulum, Terry Pratchett 1998
Visit the MaVerick web-site - <http://www.maverick-dbms.org> Open Source
Pick
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users