View Single Post
Old 19 August 2015, 23:28   #255
Mrs Beanbag
Glastonbridge Software
Mrs Beanbag's Avatar
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,202
Originally Posted by Dunny View Post
Actually, I can do this:
10 FOR EACH a$ in ["Hello world!"]: PRINT a$: NEXT a$
Nice work, D, great minds think alike i guess...

But now the standard BASIC syntax for FOR loops is redundant, you can get rid of it!

"Dim" is a horrid keyword, though... but with type inference you could simply assign arrays defined with some nice syntax to a variable.

Originally Posted by Daedalus View Post
I know what you're saying here, but in my mind, the equals means the same thing in all of those cases - it means "Equals". It's the "If" that changes things in the second case there.
Well i know what you're saying here, too... it's intuitive... the thing is, "intuitive" is often the opposite of "simple". Natural human language is very complex, and frequently ambiguous. We are quite good at interpreting context and making sense of such sentences, but learning to program is about learning to think down to the level of the computer. If we try to get computers to "know what we mean", we are storing up trouble for the future...

Let's go deeper... obviously we can conceive of more complex conditionals, for example:
If A>5 And (A<10 Or A=20) Then ...
so how do you parse that... it is natural and convenient to treat the expression as an arithmetic expression consisting of binary operators, whose result can be 0 or -1. Then one can end up with such strange but valid statements (and in AMOS this is valid) as this:
there the '=' sign means two different things in the one statement!

And the For loop is actually assigning the value to the variable, so it's the same as the first statement just as part of a larger statement. Besides, that's the same in C, even the same keyword, only with added semicolons to confuse things (are they not end of statement markers?)
The C syntax for For loops is terrible, i'm not going to reply to these Tu Quoques, as i've said, i'm not advocating C, especially not for the beginner.

String handling in more modern BASICs is much more flexible and standard than maybe you think. For your example, in Blitz the Print statement uses commas to separate arguments, just like every other statement with multiple arguments:
Blitz is not exactly standard in this regard, as Megol says, it raises questions on what "BASIC" actually means. Which is wonderfully self-referential.

Print "Hello "+name$+" and welcome!"
a$ = "Hello "+name$+" and welcome!"
Well this is perfectly standard string concatenation, but try putting a numerical variable in the middle instead of a string. Print lets you do that with semicolons. You can't do that with '+' though without explicitly converting your ints or floats to a string first.

I do believe BASIC is more instantly accessible - as a kid I always found C very intimidating - and that could be the difference between getting someone interested in programming and giving up at the first hurdle because they didn't understand what stdio.h is, and why it looks different to the other lines.
Always with the C again! Anyone would think there were only two programming languages... nothing could be further from the truth, in fact a new language becomes industry standard somewhere about every 5 minutes or so, it's almost getting silly!

I think maybe it would have been better if some variant of Pascal had become the standard home computer ROM language.

Originally Posted by TCD View Post
I love how 'Why is the homebrew scene...' became 'Which language is the best'...
from my point of view it has only become "which language is the worst"

Last edited by Mrs Beanbag; 19 August 2015 at 23:33.
Mrs Beanbag is offline  
Page generated in 0.06116 seconds with 9 queries