last day (15 days later) » 

17:54
18
A: Why did Visual Basic use parentheses for both function call and array access?

Raffzahn I don't know about BASIC but it looks like that the same syntax is also used in BASIC Because Visual BASIC is a BASIC? Since the very first days of BASIC, arrays are indexed in parentheses and function parameters as well. When Microsoft added user defined functions to BASIC (*1), they stayed wi...

Besides, since the built in functions that were inherited from BASIC, like ABS(), VAL(), STR$(), ASC() used parenthesis, it was only logical to use it for procedures also.
If we want to do further back, we can note that Dartmouth Basic (1965?) was imitating the syntax of FORTRAN.
Regarding your *1, no need to wait until Visual BASIC for “advanced” function support, BASIC PDS already had them; and PEEK() can also be used as an example of this syntax.
@StephenKitt true, but sn't BASIC PDS the last iteration of QuickBASIC, which is already mentioned as having them introduced to the MS timeline? And yes, PEEK is a funktion like any other, I avoided naming any example as it would just least to me too like additions.
So it is, I always get the chronology mixed up. I mentioned PEEK because I didn’t understand the point of mentioning user-defined functions — you already mention non-user-defined functions as a general class briefly, but then go into user-defined functions when the existence of functions in general seems like a sufficient pre-existence argument (in relation to the VB-specificity of the question). But answering a question based on a faulty premise is hard enough as it is, I’ll shut up now ;-).
17:54
In the original BASIC from Dartmouth, the difference between arrays and user-defined functions was obvious: functions had 3-letter names starring with FN and arrays had a name that was a single letter, or a letter followed by a digit.
Speculation: originally () were used to match math notation. Later, when compiler-writing became a teachable craft, [] and {} were used in language design because they were easier to parse. (The same thing may apply to reserved words - Fortran never had any reserved words, for example "if (goto) if = goto" has always been a valid Fortran statement using two variables of type logical, named "goto" and "if."
[] and {} had the big inconvenience of being reused for accentuated characters in international versions of ASCII. Editing Pascal code on my Apple II+ clone with German ASCII required quite some patience arrayÄindexÜ:= 1; ä Comment ü
@alephzero - further speculation in the form of a question: what was the character repertoire of the GE-235 (and Datanet 30) on which BASIC was first implemented?
@alephzero - ah, DTSS also had Algol 60, and it was documented as using the usual array brackets. So nevermind.
@StephenKitt Oh, no, go on. I enjoy reading comments telling me how something can be read, and even better reason why an addition might be helpful. Otherwise i'd be stuck with my own opinion. In my mind it was perfectly clear that build in functions are written that way, and will be only about user defined ones - as the are in hefty use in VB.
cup
cup
BASIC is a cut down version of Fortran so it uses a similar same syntax. In the 70s, I taught the students BASIC first. When they got the concepts, I switched to Fortran. So why did Fortran use () instead of []? If you look at the early keyboards, and manual typewriters, you will notice, they very few of them have [] or {}. You can't use something that you don't have.
17:54
@PatrickSchlüter That's why pascal had replacement digraphs right from the start ( (. for [, etc.). Likewise did (early) C use trigraphs (??(` for [).
I know, but strangely I still preferred to use ÄÜ for [], (. and .) were too close to ( ) and my screen real estate was very tight. I didn't have an 80 column card and avoiding horizontal scrolling was important when programming with UCSD Pascal on the Apple. For the comments, I used in fact the (* *) digraph even when I had {}. Fortunately I was able to get an Atari ST not long after, so all of that became moot.
@PatrickSchlüter that may be inconvenient but still usable. There are some modern keyboard layouts like Italian or Swedish that has no way to input many symbols in languages like C or bash unless the programmer uses some way like creating a manual keyboard layout or Alt code
@Raffzahn I know Pascal and its syntax is much more comfortable to read. But I'm interested in the reason why BASIC syntax uses () for both of those purposes so you didn't answer that in any way
@Raffzahn: C has digraphs, which made sense, and trigraphs, which were an abomination. While it would have been useful to have a directive indicating which character should be interpreted as a backslash, the idea of processing trigraphs within string or character literals is silly. In most cases where there wouldn't be a character for e.g. | it would be unclear what value a compiler should use for '??!'.
@phuclv According to the title you ask why Visual BASIC does it, don't you? Well, it does because BASIC does. Or do you ask why BASIC does it ? Then you might want to close the question and ask that.
BBC BASIC!! Oh my god. The nostalgia is ripping my heart apart.
17:54
@frank you know about twitter.com/bbcmicrobot right?!
@AakashM No?? Let me look....
I recall writing a video game when I was 13 yr old in BBC Basic

last day (15 days later) »