BASIC 2? Why not get BASIC 7?

Chat about anything CX16 related that doesn't fit elsewhere
BruceMcF
Posts: 1336
Joined: Fri Jul 03, 2020 4:27 am

BASIC 2? Why not get BASIC 7?

Post by BruceMcF »



2 hours ago, iljitsch said:




What kind of ambiguity do you have in mind?



Again: I'm not advocating for anything resembling the full Python that exists today. That is possibly even too much for an Amiga, and famously a non-goal of Python is to be fast. They handsomely non-reach that goal.



After programming in C, PHP and Javascript for a long time the lack of { } and ; in Python was a revelation. Creating structure through indentation is a bit weird, but probably the best/easiest way to do it.



Obviously "real" functions would be quite different from BASIC, and replacing GOSUB subroutines with functions is a bit annoying as the latter usually go at the end but Python functions need to go at the beginning. Other than that, the differences between BASIC and Python are actually relatively small. I could easily see Python be tokenized like Commodore BASIC, although of course there would have to be a system to create new tokens for new functions.



As an example of something that burns cycles in the lexer, and indeed strongly favors having a lexer pass first and then a parser second ... rather than a one pass line by line parser like Basic 2/7 or Forth ... we can go with creating structure through indentation.

White space where indentation level is significant is a PITA to parse, which is why it makes sense to clean up white space and convert whatever way the indentation is expressed into a common consistent parse-able format with the lexer. Then after its parsed, it must be executed ... with CPython that is by converting the parsed tree into bytecode and then executing the bytecode. That's why the library calls to functions in libraries that have a reputation for efficient data analysis in Python are often C-code or, indeed, sometimes Fortran code running with a little bit of Python function call glue on top.

IIRC, the "over three decades old" Basic alternative to those { } program blocks are simply keywords that end the blocks. In QBasic, that is "END ...", where "END" without anything following it ends the program.

FUNCTION odd%(N%)

   odd=((N AND 1)=1)

END FUNCTION

 

 

 

rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

BASIC 2? Why not get BASIC 7?

Post by rje »



14 hours ago, BruceMcF said:




And of course the biggest language by job listings citations is SQL, so before worrying about a Small-Python, the first target on that track would be a CX16-SQL database manager. ?



Oh the horror.


SELECT * FROM ACCOUNT WHERE RAM_BANK = 4 AND ID = 15


rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

BASIC 2? Why not get BASIC 7?

Post by rje »



35 minutes ago, BruceMcF said:




IIRC, the "over three decades old" Basic alternative to those { } program blocks are simply keywords that end the blocks. In QBasic, that is "END ...", where "END" without anything following it ends the program.



FUNCTION odd%(N%)

   odd=((N AND 1)=1)

END FUNCTION



ALGOL shows us the way.  Or Oberon, if you're not allergic to Pascal.

Golang learned positive lessons from both C and Oberon.

But I'm fading fast on the idea of anything other than a Structured BASIC added to the X16.

Of course, S-BASIC looks rather ALGOL-like.

BruceMcF
Posts: 1336
Joined: Fri Jul 03, 2020 4:27 am

BASIC 2? Why not get BASIC 7?

Post by BruceMcF »



44 minutes ago, rje said:




Oh the horror.




SELECT * FROM ACCOUNT WHERE RAM_BANK = 4 AND ID = 15



 



To be fair, if people get a job on the basis of, "Yeah, I can do that", but then when hired they set about working out how to get promoted to a job where they DON'T have to "do that", then there will be a steady stream of "help wanted" ads that specify such a language.

User avatar
Cyber
Posts: 482
Joined: Mon Apr 27, 2020 7:36 am

BASIC 2? Why not get BASIC 7?

Post by Cyber »



On 6/3/2021 at 6:06 PM, iljitsch said:




Well, how many things do you need to add to BASIC (and take away) before it's not really BASIC anymore?



We're talking about different flavors of Commodore BASIC here...



Despite topic title is obviously about Commodore BASIC, we're not talking about Commodore only BASIC here. The main reason is despite X16 is using Commodore BASIC V2 as starting point, the team is evolving it beyond CBM contraints. And I think it will evolve to something close to QBasic.

I'll remind you that David was impressed by full screen editor of MMBasic, which lets you ommit line numbers and write a structured program very much like QBasic. And he said he wants X16 to have something similar.

And it's still BASIC. )

Gromit337
Posts: 3
Joined: Wed Jul 28, 2021 6:36 pm

BASIC 2? Why not get BASIC 7?

Post by Gromit337 »


I've read through this topic, and I've come to the same conclusions as I do with many 'programming language' discussions. The people saying the most and shouting the loudest aren't really the target audience. They aren't thinking about others, but about themselves and how they progressed as programmers. They think about what they know and use now, and they want to shape everything to fit in with that. They forget that some people have absolutely no idea of what programming is and need to learn everything from scratch. The absolute basics of programming... learning some simple commands, breaking a problem down in to steps, linking them and getting results. Understanding concepts such as variables, loops, counters and simple logic. 

 

Most people don't want to be professional programmers, they may not even want to be "good" programmers. They just want to dabble their toes in the water, experiment, have a bit of fun and see where it takes them. Or maybe just get a pleasant dose of nostalgia.

Would you teach somebody to read by starting them off with the works of Prof. Stephen Hawking and perhaps some Tolkien? Do you teach people to count by dropping them straight in to calculus, trigonometry and statistics? Probably not much fun for intermediates, never mind absolute beginners.

When you start thinking about being productive and suggesting modern languages, you are clearly missing the point... this is a retro 8 bit platform. Most people already have a PC/Mac for serious stuff. If they wanted to learn 'serious' programming and be 'productive', they are hardly likely to choose this platform are they?

Dartmouth BASIC was originally a simple language for students who wanted, or needed, to solve problems, automate calculations or some other process, without having to spend years learning computer science and complicated programming languages. It was ideal for that, and it still is. Nearly all the '80s micros had extended and improved versions of Basic available. Atari, Sinclair, Amstrad and CBM 8 bits had loads. COMAL was essentially an extended, structured version of Basic. They were all easy to learn.

Had someone showed me C, Java, Fortran, Javascript or even Pascal as my first experience of programming, I would never even have bothered trying.  The Sinclair ZX81 had a wonderful manual to introduce simple programming concepts to 14 year old me, as did my old Atari 400. That led me on to more complicated things, and now I actually like Pascal, and think Psion's OPL was a great little language to mess with. To me, the rest are overcomplicated, hard work and not much fun.

There's that word again "FUN". Funny eh? ?

Scott Robison
Posts: 952
Joined: Fri Mar 19, 2021 9:06 pm

BASIC 2? Why not get BASIC 7?

Post by Scott Robison »



2 hours ago, Gromit337 said:




The people saying the most and shouting the loudest aren't really the target audience.



Now I'm afraid to go back and see how much I contributed to this discussion ... ?

Snickers11001001
Posts: 140
Joined: Wed Jan 20, 2021 6:43 pm

BASIC 2? Why not get BASIC 7?

Post by Snickers11001001 »


In the spirit of the discussion getting bumped up for a rehash, here is a...   Trivia Question! 

Did you know:  The "more advanced" BASIC versions Commodore released for the Plus/4 and C128 were considerably slower than BASIC on the Commodore 64.       I'm talking comparable tasks where all three versions of BASIC are compatible with the program listing.   Think of a Prime numbers finder using trial division or the sieve approach.   Lots of maths; big arrays; lots of jumps and loops; logic and memory operations.    

And I mean considerably slower!     Like 20% or so depending on the mix of operations!   

Can anyone guess the reasons why?   

 

Scott Robison
Posts: 952
Joined: Fri Mar 19, 2021 9:06 pm

BASIC 2? Why not get BASIC 7?

Post by Scott Robison »



38 minutes ago, Snickers11001001 said:




In the spirit of the discussion getting bumped up for a rehash, here is a...   Trivia Question! 



Did you know:  The "more advanced" BASIC versions Commodore released for the Plus/4 and C128 were considerably slower than BASIC on the Commodore 64.       I'm talking comparable tasks where all three versions of BASIC are compatible with the program listing.   Think of a Prime numbers finder using trial division or the sieve approach.   Lots of maths; big arrays; lots of jumps and loops; logic and memory operations.    



And I mean considerably slower!     Like 20% or so depending on the mix of operations!   



Can anyone guess the reasons why?   



I would think the first / main reason is the amount of bank switching required. C64 BASIC programs stood alone in their address space. The increased size and complexity of the 128 & +4 ROMs no doubt necessitated fetching bytes through a routine that would bank out the ROMs, fetch the bytes from RAM, bank in the ROMs, then continue with BASIC interpretation of the data.

I've not looked at the ROMs for +4 ever. I had a 128 and I know there were routines to fetch bytes from a specific bank (variables from bank 1, BASIC text from bank 0). But even if you had a program with zero variables, so you never have to switch to bank 1, you would still have to do a lot of bank switching from ROM to bank 0 RAM to access the linked list of lines of code.

Scott Robison
Posts: 952
Joined: Fri Mar 19, 2021 9:06 pm

BASIC 2? Why not get BASIC 7?

Post by Scott Robison »



On 6/2/2021 at 3:50 PM, rje said:




PET BASIC 4.0 was responsible for getting me started, which is more or less BASIC 2 (we didn't use the disk commands so much).



I don't know how I missed this for this long. I guess BASIC 4.0 was my start, as we had PETs at school. They were purchased for a computer class that wound up not happening for four years! They just sat gathering dust in the back of the math classroom and I was interested so I was allowed to use / play with them after getting my work done. I did use the disk commands because we had a dual disk drive (and printer) to go with the three systems. I wish I knew whatever happened to them!

Post Reply