Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DAY 011: REM
#21
(11-16-2022, 11:04 PM)Pete Wrote: This oversight upsets the Continuity Principle.

Code: (Select All)
DATA "1,2,3" ' This doesn't works. IDE flags it.
DATA 1,2,3 ' This doesn't run, but the IDE doesn't flag it.

So when Rob put this together, he simply missed a condition. Since the IDE is set up to catch syntax errors before compilation, yes, this should at some point in time be corrected. In therms of priorities, things like this and the IF THEN ELSE anomaly are certainly backseat compared to a memory leak in SCREEN Zero. Oh the horror!!!!

Pete

The reason this isn't flagged by the IDE as an error, is simply because it's not.  Tongue

Code: (Select All)
For i = 1 To 4
    Read a$
    Print a$
Next

Data 1,2,3 ' This doesn't run,but the IDE doesn't flag it.

You've got mixed data inside your data stream there -- 2 numeric values and 2 string values.  The error you get, happens to be a run-time error because, at run-time, you're trying to read a string into a numeric variable.  

Makes perfect sense to me. Tongue
Reply
#22
(11-16-2022, 11:13 PM)SMcNeill Wrote:
(11-16-2022, 11:04 PM)Pete Wrote: This oversight upsets the Continuity Principle.

Code: (Select All)
DATA "1,2,3" ' This doesn't works. IDE flags it.
DATA 1,2,3 ' This doesn't run, but the IDE doesn't flag it.

So when Rob put this together, he simply missed a condition. Since the IDE is set up to catch syntax errors before compilation, yes, this should at some point in time be corrected. In therms of priorities, things like this and the IF THEN ELSE anomaly are certainly backseat compared to a memory leak in SCREEN Zero. Oh the horror!!!!

Pete

The reason this isn't flagged by the IDE as an error, is simply because it's not.  Tongue

Code: (Select All)
For i = 1 To 4
    Read a$
    Print a$
Next

Data 1,2,3 ' This doesn't run,but the IDE doesn't flag it.

You've got mixed data inside your data stream there -- 2 numeric values and 2 string values.  The error you get, happens to be a run-time error because, at run-time, you're trying to read a string into a numeric variable.  

Makes perfect sense to me. Tongue

Ah, I forgot that DATA can be read as either a STRING type or Var Type. Good point!


Code: (Select All)
FOR i = 1 TO 3
    READ a
    PRINT a
NEXT

' Note the colon added is required for it to run.
DATA 1,2,3: REM This works as a var type or string type.

RESTORE

FOR i = 1 TO 3
    READ a$
    PRINT a$
NEXT

Also interesting that the RESERVED word REM can be used as a DATA element. So can the single quote.

I'll go back and edit post 11 accordingly.

Pete
Reply
#23
(11-16-2022, 10:13 PM)CharlieJV Wrote: Ooooh, that's a good catch.  Good sleuthing.

The little I've looked at (in general), syntax highlighting is not a trivial affair.



Sometimes when bored I'll play with the IDE for fun.  I use to have a small list of odd IDE behaviors like the REM thing. Just a trivial things, but interesting to me. One I remember is the underscore plays havoc with the IDE correcting.  You can put the _ anywhere.  It stops the IDE from uppercasing/spacing of keywords.  For example, the code below looks horrible, but the IDE accepts it as is and it runs ok.  The IDE won't even turn the ? into PRINT.





- Dav




Code: (Select All)
1:::::for t=1to 15 _
:color rnd*15:?t      _
:next                   _
::::sleep 1
4?timer:?0:::: _
:::do:?rnd:loop:::end:

Find my programs here in Dav's QB64 Corner
Reply
#24
I've got to say -- completely off topic here -- that these topics astound me with the interest and number of replies they generate.  REM... of all keywords...  REM has over 3 pages of comments on it, and all it does is place a comment in the code!  Honestly, I figured I'd post a few paragraphs on the topic, hear a resounding chirp of crickets, and be done with it until tomorrow's new word turned up and was maybe a little more interactive.

Just goes to show -- you never know what'll draw the interest and conversation of the QB64-PE crowd!  Wink
Reply
#25
(11-17-2022, 12:45 AM)Dav Wrote: Sometimes when bored I'll play with the IDE for fun.  ...snip...

- Dav

I love programming, but programming is programming, software is software.

Creating an IDE, though, is one of those things I think: that's a pretty special kind of art and science.  Something I admire from afar.  Appreciate fiercely, but no desire to ever attempt it.  I appreciate those with the marbles (in every sense that can be taken) to build those things.
Reply
#26
(11-17-2022, 12:59 AM)SMcNeill Wrote: I've got to say -- completely off topic here -- that these topics astound me with the interest and number of replies they generate.  REM... of all keywords...  REM has over 3 pages of comments on it, and all it does is place a comment in the code!  Honestly, I figured I'd post a few paragraphs on the topic, hear a resounding chirp of crickets, and be done with it until tomorrow's new word turned up and was maybe a little more interactive.

Just goes to show -- you never know what'll draw the interest and conversation of the QB64-PE crowd!  Wink

I've been around long enough to know to expect exactly this. We used to get some of the longest threads at the QBasic forum over things you

thought wouldn't even merit a complete...

Pete
Reply
#27
I apologize for getting off topic.  Thanks for posting these keyword threads. They are very helpful. I’ve read every one. Keep’em coming!

- Dav

Find my programs here in Dav's QB64 Corner
Reply
#28
(11-17-2022, 12:45 AM)Dav Wrote: ...  I use to have a small list of odd IDE behaviors like the REM thing. Just a trivial things, but interesting to me. One I remember is the underscore plays havoc with the IDE correcting.  You can put the _ anywhere. ...

Code: (Select All)
1:::::for t=1to 15 _
:color rnd*15:?t      _
:next                   _
::::sleep 1
4?timer:?0:::: _
:::do:?rnd:loop:::end:
I just tried this. Pinning the "to" instead to "15" causes a flag. I thought removing the line number "1" would have broken the peace. There are people still using question marks for "PRINT".

Sadly, the row of colons would still have to be supported because ancient code did stuff like that if there was enough RAM, to visually delimit the subroutines. Man I hated a "GOSUB" statement having a line number that pointed to a comment! Those programmers hating renumbering their programs too. Not as much "GOTO" because "GOSUB" represented a need that was filled in nicely by QuickBASIC, so nicely that in M$'s brand in 2005 "GOSUB" was ditched and "RETURN" was changed to do something else.
Reply
#29
I always use ? for PRINT, but then again I use Jello for... never mind.

Pete
Reply
#30
(11-17-2022, 12:59 AM)SMcNeill Wrote: I've got to say -- completely off topic here -- that these topics astound me with the interest and number of replies they generate.  REM... of all keywords...  REM has over 3 pages of comments on it, and all it does is place a comment in the code!  Honestly, I figured I'd post a few paragraphs on the topic, hear a resounding chirp of crickets, and be done with it until tomorrow's new word turned up and was maybe a little more interactive.

Just goes to show -- you never know what'll draw the interest and conversation of the QB64-PE crowd!  Wink

Keep these word of the days coming. I read every one. I constantly miss little nuggets associated with key words.

You would think REM wouldn't get any second thought but I'm like the king of comments in my code. I'm always looking for better/different ways of adding comments.

Something I like that other languages offer is block commenting, like C

/*  */

Early Pascal had them too

(*    *)

but were replaced later on in Delphi by

{    }

Now, if there is one thing I wish the QB64 editor would not do when dealing with comments is this:

Important line of code here '                   My comment
Another important line '                          My comment

I would much rather the IDE left the single quote where I place it, like this:

Important line of code here                   ' My comment
Another most important line                  ' My comment

Instead of forcing the single quote to the end of the line.
Reply




Users browsing this thread: 4 Guest(s)