Anyone here think it woudl be a good idea if RB supported array and  
dictioanry syntax, like this:

Dict["value"] = key

It's done this way in quite a few languages.
C++
JavaScript
Flash

probably some more languages I haven't looked into enough.

I think this:

Dict["value"] = key

looks better than this:

Dict("value") = key

or this:

Dict.Value("value") = key

Also, array accessing should be the same way.

Arr[1] = 10
Arr[2] = 12

Instead of:

Arr(1) = 10
Arr(2) = 12

This way, we can tell apart array access from function calls.

Anyone want to convince me that this is a bad idea? :) It might  
actually be a useless addition to the language that only makes things  
more confusing. Perhaps we are find with only parenthesis all around.  
To be honest I can't think of any situation where both parens and  
angle brackets would be valid on the same object. So perhaps we don't  
need the angle brackets.

I guess it just makes visual inspection of the code easier. Because  
setting a property is a very different thing to calling a function!  
Arr[1] = 0, that to me looks like I'm just setting some data. Value =  
Obj.MyFunction(4), is totally different. There I expect "real work"  
to be done, which could be anything. MyFunction might delete files,  
or open socket connections or all sorts of big stuff. Array or  
dictionary syntax setting I'd normally expect to do minor quick  
simple work in setting data.

Still, having a operator_index function for dictionaries, would be cool.


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to