Tuesday 22 April 2014

Re-purposing the @ operator

I'm currently adding a "projection" operator to work with lists. I will allow you to extract a single item from the list (like retrieving a value from an array by its index) or a subset of the items.

I'm considering using the @ symbol for this because it is read as "at". It would sort-of make sense ('a','b','c','d','e')@3 could be read as ('a','b','c','d','e') at index 3. ('a','b','c','d','e')@(0,1,4) would be ('a','b','c','d','e') at indices 0,1 and 4.

This would mean its current use, to mark single value lists, would be disabled. I am already introducing a better way to write lists in the next version so no functionality will be lost but if anyone has used the @ operator already then their stories will break if they upgrade to the next version.

The alternative is to keep the @ operator as it is and use a different symbol. I'm considering the colon ':'

If you have an opinion please share it, either in the comments or the subreddit

No comments:

Post a Comment