fugazi-io / webclient

web based terminal application for executing local and remote commands
http://fugazi.io
28 stars 12 forks source link

Collections accessors and mutators #39

Open nitzantomer opened 7 years ago

nitzantomer commented 7 years ago

Given a list or map:

arr = [1, 2, 3]
map = {
    str: "string",
    num: 4
}

There's no way to access the items in the collections.

These should work:

Access:

echo $arr[1]
echo $map.num

Mutate:

$arr[1] = 10
$map.num = "new string"
creativeChips commented 7 years ago

Question raised is why stop at this? what about $list.length for example? Do we want to enable running predefined "methods" on built in types? For example set A to $list1.concat($list2)? Or should we keep the separation of data and behavior and only expose "commands style" api, like get $arr at 1 and set $arr at 1 to be 10, or length of $list?