|
Forum Index : Microcontroller and PC projects : Give me MMBasic instead
| Page 1 of 2 |
|||||
| Author | Message | ||||
| PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 1581 |
"Let's use := instead of = and a semicolon to terminate each line so that we don't have to admit that it's BASIC" |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10533 |
Having a line termination character like ; allows a statement to be split across multiple lines Basic = confuses assignment and equivalence. If you read := as "becomes equal to" then = is just the equivalence logical operator. Personally, I like both but then my first language was Pascal |
||||
| PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 1581 |
Yeah but that stuff can be as much a PITA as Python's indentation. |
||||
| PeteCotton Guru Joined: 13/08/2020 Location: CanadaPosts: 575 |
I suspect it was easer to process that variable assignment with :=. Basic didn't need it, because it had the LET command. Then as people become more familiar with programming, they realised that the LET was not required. My biggest problem with ':=' is that in my day job I use ':=' (C#) and then when I go to program my CMM2 - I keep typing ':=' instead of '=' (and || for OR etc.). But here's the weird thing about that - I like the fact that it makes me change, because it all helps bring me back to my BASIC programming nostalgia - and reminds me that I am not, in fact, doing work. |
||||
| PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 1581 |
But that is why BASIC is smarter because it understands the context. I use a Basic compiler that isn't much more than a translator to asm. Write the code in C or Basic, no matter, the generated asm is identical. So why bother with gobbledygook? |
||||
| Andy-g0poy Regular Member Joined: 07/03/2023 Location: United KingdomPosts: 81 |
Exactly, all you doing is the work that the compiler writer should have done. everyone knows when you have a comparison or assignment. In all the years that I have been programming (mainly old assembler stuff) there was never any issue between the two in whatever language was used. It was defined by the operation. Also Move1Pos : DINT 3000000 ; Type of syntax seems very clumsy. There is no need for the : between the variable name and the type, the space delimits the two, I don't know anything about this language but I'm a bit suspicious of the : (maybe the ; as well) It looks as if it is looking for {space}:{space} or {space}; i.e. would this confuse it? Move1Pos : DINT 3000000 ; foobar : DINT 3000000 ; boojum : DINT 3000000 ; If so it's just as bad as the Python indent madness and the programmer is being made to do the work that the compiler writer should have done. Andy |
||||
| PeteCotton Guru Joined: 13/08/2020 Location: CanadaPosts: 575 |
I would guess it's all a throwback because C more closely mimics the operation/antics of assembly code, and if you want to assign a variable value in the middle of a comparison, you absolutely can. Should you? Probably not. And I imagine most modern compilers would stop you. But going back to the days of 100 bytes programs - these sort of tricks were probably relevant. But I do agree - it's not relevant in modern languages. It used to be that languages had specialised functions (like Fortran's 64-bit Integer), but I think all modern languages support those now (though I do seem to recall Fortran having Complex numbers as well). I suspect any non-Object Oriented language can probably be directly translated into any other language (and any Object Oriented language can be translated into any other Object Oriented language). But wouldn't it be a dull world if we only had one programming language to rule them all. It seems that people have claimed as much in the past (Java - I'm looking directly at you) - yet here I am still faffing around with C and C++. |
||||
| JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 4100 |
In such as Move1Pos : DINT := 3000000 ; it looks like the spaces are optional and put in by a human who preferred them. I can't see anything wrong or odd about that. John |
||||
| PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 1581 |
At least in my industrial world, MMBasic needs to be the standard...Period We can stomp all over the garbage that's out there. It's a perfect example of The Emperor's New Clothes and I'm the kid who is calling BS on all those who comply like little wimps |
||||
| PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 1581 |
Move1Pos = 3000000 Job done. Why the BS? |
||||
| JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 4100 |
I expect they want to define its type so it can be checked and/or more efficient code generated. Neither of those is BS. Defining type helps avoid programming bugs MMBasic with OPTION EXPLICIT does that, too, or are you saying that's BS? John Edited 2025-09-24 06:55 by JohnS |
||||
| PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 1581 |
No I like OPTION EXPLICIT due to my lousy typing But this is cleaner/more refined: dim float strt,fini,mcmd,i,a,b,c |
||||
| toml_12953 Guru Joined: 13/02/2015 Location: United StatesPosts: 472 |
With ANSI Standard BASIC, you usually don't have that problem. ANSI only allows one statement per line. Also, every line has to start with a keyword, which is why LET is mandatory. |
||||
| toml_12953 Guru Joined: 13/02/2015 Location: United StatesPosts: 472 |
Some languages use = for assignment and == for equivalence. To me, this is easier since I do a lot more assigning than testing. It saves me much typing. |
||||
| LeoNicolas Guru Joined: 07/10/2020 Location: CanadaPosts: 516 |
I also like the = and == to differentiate assignment and equivalence. What I don't like is when a language uses the code format in its syntax, as Python does. Oh boy, why changing my code indentation will affect my code validity? |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5398 |
+1 Every language has it's quirks (so has MMBasic). Python indenting feels dangerous. I have seen occasions (i.e. this forum) where formatting gets lost. Python code would not run when pasted in this forum. Line ending characters (";") don't get lost. PicomiteVGA PETSCII ROBOTS |
||||
| bfwolf Regular Member Joined: 03/01/2025 Location: GermanyPosts: 83 |
"Once upon a time in the very past" there was a programming language called "COMAL" - it was some kind of "Better BASIC".. German Wiki: https://de.wikipedia.org/wiki/COMAL English Wiki: https://en.wikipedia.org/wiki/COMAL COMAL used the ':=' as assignment operator to distinguish from '=' for useage in comparison expressions - as pascal does.. The examples shown in the English Wiki are wrong for that! Heretical question: Why not allow MMBasic to accept both '=' and ':=' for assignments and have a option, which decides, which variant is shown by the 'LIST' command? @Peter: Does MMBasic use different tokens for '=' used as assignment operator and '=' used for comparisons? That would make it easy.. Regards, bfwolf |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8232 |
No, please.... MMBasic is BASIC. No BASIC accepts := as anything other than a syntax error. If people want to program in a language that uses := then they can, but BASIC isn't that language. It isn't C, C#, C++, Python2, Python3, COMAL, COBOL, Lithp or anything elth either... :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
| Andy-g0poy Regular Member Joined: 07/03/2023 Location: United KingdomPosts: 81 |
Every language has it's quirks (so has MMBasic). Python indenting feels dangerous. I have seen occasions (i.e. this forum) where formatting gets lost. Python code would not run when pasted in this forum. Line ending characters (";") don't get lost. I find one major problem is when you are working with several different systems and moving code between them. Some editors use different conversions for tabs and usually DO NOT use the actual tab character. Flipping code across systems that use 4 spaces for a tab and others that use 8 etc causes mayhem Aside from the typing error we all make, I just find the block-identified by indent hard to see on the screen especially if I need to make a major change in the middle of some multiple condition set of statements. TYhigs get out of sequence very fast. Then there is the other issue in that I like to format my code MY WAY which is of course much better than anything else< not someones elses idea of what is correct :-) Andy |
||||
| phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2787 |
MMEdit can help you with that. On the left it links each Sub, Do, For, If with it's correct end point. |
||||
| Page 1 of 2 |
|||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |