Posts: 597
Threads: 110
Joined: Apr 2022
Reputation:
34
I'm thinking of adding the ability to use curly brackets and square brackets in expressions, along with parentheses, to make complex expressions easier to read.
But not if square brackets (i.e. [ and ] ) and curly brackets (i.e. { and } ) are used in any way as special characters in QB64pe.
Are square brackets and/or curly brackets used for any purpose in QB64pe? (I haven't noticed any.)
Posts: 128
Threads: 12
Joined: Apr 2022
Reputation:
14
Not that I know of
45y and 2M lines of MBASIC>BASICA>QBASIC>QBX>QB64 experience
Posts: 3,979
Threads: 177
Joined: Apr 2022
Reputation:
220
No I don't think other brackets are used.
Have you tried spacing out multiple brackets to make it clearer which nest you are in while you type a line in QB64 IDE? It can get confusing while composing.
b = b + ...
Posts: 301
Threads: 16
Joined: Apr 2022
Reputation:
51
some of the better IDEs and text editors will highlight opening and closing brackets to make editing expressions a little easier. There's no shame in using spaces or newlines to break up expressions although the PE ide may squish them together with autoindent enabled which is why I opt for my own formatting.
I would not recommend introducing alternative brackets especially if they are interchangeable. They sometimes do that in Math but not in Basic which is a practice I personally dislike because the other brackets can sometimes indicate a different purpose in other contexts
Posts: 3,979
Threads: 177
Joined: Apr 2022
Reputation:
220
If I may remind, while you remain on the same line of QB64pe the spaces remain spaced until you move onto the next line, THEN the spaces are pushed together.
And yes, the highlights are helpful in pointing the end bracket for the first on same level or vice versa.
b = b + ...
Posts: 1,272
Threads: 119
Joined: Apr 2022
Reputation:
100
Is this something that's being considered to be implemented in QB64PE?
Personally, I would find the use of multiple bracket types confusing in the BASIC dialect. Other languages, such as Python, use square brackets to identify constructs such as tuples which set them apart from evaluations. If I remember correctly I believe curly braces were used in Pascal (Delphi) for comment blocks. I don't believe I've ever run across a language that uses a mix of bracket types for evaluations. Again, my personal opinion, but I believe this would cause confusion.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial