One of the things that’s kept me from completing BOOL is that I haven’t been able to make up my mind regarding arrays.
There are two basic directions: All data types can have the native ability to create single or array instances, or the Array type is a special data type that can make an array instance of any data type.
There is also the issue of what should be the array syntax. How are arrays declared, and how are array members referenced?
I think, after all this time, I have finally made up my mind.
My current thinking (always subject to change) is that BOOL shall have an Array type (specifically:
*array). The logic is that BOOL data types (Models aka “classes”) have the potential to be so diverse that building array capability into all of them seems wasteful, redundant and possibly difficult.
Building a specialized array type seems more appropriate.
I’m thinking the syntax looks like this:
*array  *int my_numbers
That creates an array, named
my_numbers, that consists of 10
I’m not entirely happy with the reference syntax, but haven’t been able to come up with anything different. To reference the third member of the array just created above, the syntax is:
Which is actually syntactical sugar for:
index: my_numbers 3
That sends the
index: Message to the
my_numbers object along with the argument ‘3’.
The array reference syntax is identical to the object member reference syntax. Given the Model:
**2dPoint . *int x . *int y
You could set the
y members thus:
*2dPoint my_point set: [x]my_point 10 set: [y]my_point 10
Which sets the point to (10,10).
And, as before, this syntax is syntactical sugar.