Page 1 of 1
Supporting [] for arrays, instead only ()
Posted: Sun Feb 23, 2014 2:45 pm
by va!n
It would be nice to support [] for arrays too, instead only ().
Using () for functions and maybe optional [] for arrays would make the source more readable and make clear if its a function or array.
Re: Supporting [] for arrays, instead only ()
Posted: Sun Feb 23, 2014 3:41 pm
by Zebuddi123
+1 But the problem of breaking backward compatibility
Zebuddi.

Re: Supporting [] for arrays, instead only ()
Posted: Sun Feb 23, 2014 3:45 pm
by STARGĂ…TE
but then it is not clear, if it is a static array (only []) or a dynamic array (with optional [])?
Re: Supporting [] for arrays, instead only ()
Posted: Sun Feb 23, 2014 7:34 pm
by va!n
+1 But the problem of breaking backward compatibility
That's why it could be an optional feature... People can choose to use () or [] for arrays.
Sure, using only [] for arrays would be smarter.
Re: Supporting [] for arrays, instead only ()
Posted: Sun Feb 23, 2014 8:22 pm
by Fred
Having two ways to write the same code just adds confusion.
Re: Supporting [] for arrays, instead only ()
Posted: Sun Feb 23, 2014 8:49 pm
by netmaestro
I think it would have a place but only if functionality were added, where the new brackets would denote an associative array. Not sure we really need associative arrays in Purebasic as the map object covers most of it. The only gain would be a smaller memory footprint and more efficient code where the number of elements is small, something like less than 50.
Re: Supporting [] for arrays, instead only ()
Posted: Mon Feb 24, 2014 8:15 am
by davido
Perhaps the IDE could allow a colour difference to distinguish Arrays from Functions?