Jump to content
Tornadoboy

What could they have done better with the 99/4a?

Recommended Posts

13 hours ago, wierd_w said:

Again, since the actual value written there might be something other than the programmer anticipates (EG, program written for say, IBM Basic-- ported (more or less) to TI Basic), it is just better practice to use the internal constant, rather than pretend to know what that constant's actual value *IS*.

Sure, but in the case of most 8-bit BASICs, there /is/ no internal constant. ;) TRUE and FALSE aren't keywords in most of the micro BASICs. They certainly aren't in TI BASIC!

 

In fairness, I half agree with you on the test syntax itself. We had a rule at my last job that implied tests (like "IF (X)") were only legal for booleans, since they were already only true or false. Anything else, and we wanted to see an explicit comparison to (a) confirm that you knew what you were checking for, (b) confirm the type of the variable, and (c) ensure you weren't relying on a side effect. I liked that rule for team coding, but I'm not saying I never break it in my personal coding. ;)

 

  • Like 1

Share this post


Link to post
Share on other sites

Wow, I missed some drama. :) Particularly amused by the fact it was borne out of an incorrect assumption of the issue of RES using 32767 as an unknown line marker.

 

Another reason for "IF X THEN" structure is that it saves precious bytes, which on any old BASIC are in short supply. This is why we have shorthand things like the ternary operator in C; saving some room. For the record, I NEVER use the ternary operator if I can help it.

 

And if this convention bothers and offends you, don't ever look at TRS-80 color BASIC or extended color BASIC. They have CRAZY stuff, like FOR NEXT loops declared in logical structures (IF X THEN FOR I=). I think the only reason this doesn't fall apart in a logical catastrophe is they can use "NEXT" without a variable as a permanent terminator to any ongoing FOR loops. Reading the code when translating Space Trek to the TI caused me serious migraines and WTF moments.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
2 hours ago, adamantyr said:

And if this convention bothers and offends you, don't ever look at TRS-80 color BASIC or extended color BASIC. They have CRAZY stuff, like FOR NEXT loops declared in logical structures (IF X THEN FOR I=). I think the only reason this doesn't fall apart in a logical catastrophe is they can use "NEXT" without a variable as a permanent terminator to any ongoing FOR loops. Reading the code when translating Space Trek to the TI caused me serious migraines and WTF moments.

Should you ever wish to revisit the nightmare...  pop the XB cart into your console, turn off prescan, then combine  IF/THEN and FOR/NEXT.  ;)   I don't recall if the "IF X THEN FOR I=" structure works, I may have to try that some day.  Heh.

 

Example:

10 X,I=0

99 [email protected]

100 FOR I=1 to 100

110 IF I<>10 THEN NEXT I ELSE X=X+1::NEXT I

120 PRINT X

 

 

Share this post


Link to post
Share on other sites
1 hour ago, InsaneMultitasker said:

Should you ever wish to revisit the nightmare...  pop the XB cart into your console, turn off prescan, then combine  IF/THEN and FOR/NEXT.  ;)   I don't recall if the "IF X THEN FOR I=" structure works, I may have to try that some day.  Heh.

 

Example:

10 X,I=0

99 [email protected]

100 FOR I=1 to 100

110 IF I<>10 THEN NEXT I ELSE X=X+1::NEXT I

120 PRINT X

 

 

I tried it once, XB just says "SYNTAX ERROR" on the offending line.

 

Your example above isn't quite as crazy, trust me. :) As I said, they could put both FOR and NEXT on conditionals freely. Your example above, you can see, has to do a NEXT for both logical paths in one line. Their code you didn't have to, so long as you had a NEXT statement at some point to act as a terminator for all FOR loops.

 

Also, particularly maddening was the fact they didn't use spaces as a parser. So you could write everything with no spaces at all, like this:

 

FORI=1TO100:IFI<>10THENEXTIELSEX=X+1:NEXTI

  • Like 1

Share this post


Link to post
Share on other sites

That's really ugly.... egads!  Not fun code...

 

Useless trivia:  Heatwave BBS software uses some of the prescan for/next and if/then tricks to simplify code. Back then it was also done to pack as much into a line as possible.  Fast forward a few years I tried porting the program to Myarc's BASIC; the interpreter went bonkers with phantom errors and weird results.   It took me a long time to realize that my flaunting the rules caused the problems.

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)
1 hour ago, adamantyr said:

I tried it once, XB just says "SYNTAX ERROR" on the offending line.

 

Your example above isn't quite as crazy, trust me. :) As I said, they could put both FOR and NEXT on conditionals freely. Your example above, you can see, has to do a NEXT for both logical paths in one line. Their code you didn't have to, so long as you had a NEXT statement at some point to act as a terminator for all FOR loops.

 

Also, particularly maddening was the fact they didn't use spaces as a parser. So you could write everything with no spaces at all, like this:

 

FORI=1TO100:IFI<>10THENEXTIELSEX=X+1:NEXTI

Ok being a 20 years worker on GPL and XB (RXB) I can answer these easy.

The LINE BUFFER for input of a line of XB is only 152 bytes long, the TOKEN BUFFER is 163 bytes long.

(The stupidity of this is just kind of stupid, resulting in crashing and using REDO to make longer lines.)

RXB has CALL USER("DSK#.DV80FILE") so you can use DV80 files with longer lines up 14 lines of 1280 characters or until the TOKEN BUFFER is full i.e 163 bytes.

 

As for this line:

FORI=1TO100:IFI<>10THENEXTIELSEX=X+1:NEXTI

 

FOR is a token just like = and IF and <> and THEN and NEXT and ELSE and = and + and NEXT, XB parses the line and ignores spaces.

 

As for the line he posted that is why he turned off PRESCAN as per the XB Manual that is illegal in XB to put NEXT in a IF THEN statement.

 

Look you can use your IPHONE as a hammer, just like you can turn off PRESCAN and do things, should you? NO YOU SHOULD NOT!

Edited by RXB
missing text

Share this post


Link to post
Share on other sites
2 hours ago, RXB said:

Look you can use your IPHONE as a hammer, just like you can turn off PRESCAN and do things, should you? NO YOU SHOULD NOT!

Yea, but it's so much fun!!!!

  • Like 1
  • Haha 1

Share this post


Link to post
Share on other sites
Posted (edited)

 


My, my. I was just giving
a few ideas after returning
to the forums and it seemed
to irritate somehow?

 

A more helpful RESquence would have
been neat and I had no idea about
any hardware/software limitations that
would have made improving it more difficult.

At the risk of being wrong again or whatever,
another thought I had was that having just RES
as the command instead of that + the full
word available would be an OK tiny change.

 

I guess some topics can get deeper than
any simplicity their title requests. Oopsie!

Edited by GratedTopping
spelling
  • Like 3

Share this post


Link to post
Share on other sites
1 hour ago, GratedTopping said:

My, my. I was just giving
a few ideas after returning
to the forums and it seemed
to irritate somehow?

No No No...

 

...I can see that you're confused.

 

...This is our FUN!

...and where would we be without it?:grin:

  • Like 4

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...