Fantom Shell v1.0.55 ('?' for help)
fansh> a := [1,2,3]
[1, 2, 3]
fansh> b := [4,5,6]
[4, 5, 6]
fansh> c := a + b
ERROR(1): Unknown method 'sys::List.plus'
I just don't want to have to do:
c := a.dup
c.addAll(b)
When I could use the more natural c := a + b.
DanielFathSat 30 Oct 2010
Hmm that would be a nice thing to have. However it's all up to Brian and Andy on whether things like this are operator abuse or not. OTOH if you allow this why wouldn't you allow one of this to be valid?
c := a - b //this could C = A / B (Elements in A not found in B)
...
brianSun 31 Oct 2010
I believe this has been brought up on occasion. I don't like the idea of using operators (other than []) with collections. The semantics are not cleanly mathematical (is + addAll? setAll? etc). So I consider it operator abuse and think we should stick with explicit methods which all have short, clear names.
yachris Sat 30 Oct 2010
Hello,
Curious about the following:
I just don't want to have to do:
When I could use the more natural
c := a + b
.DanielFath Sat 30 Oct 2010
Hmm that would be a nice thing to have. However it's all up to Brian and Andy on whether things like this are operator abuse or not. OTOH if you allow this why wouldn't you allow one of this to be valid?
brian Sun 31 Oct 2010
I believe this has been brought up on occasion. I don't like the idea of using operators (other than
[]
) with collections. The semantics are not cleanly mathematical (is+
addAll? setAll? etc). So I consider it operator abuse and think we should stick with explicit methods which all have short, clear names.qualidafial Sun 31 Oct 2010
How about a
concat
method instead?