Would it be possible to include List.plus as an alias for List.addAll so that [1] + [2] + [3] = [1, 2, 3]? It works like this in Ruby and Python.
brianWed 4 Nov 2009
I personally don't particularly like using operator overloading for list manipulation because it is always unclear exactly what is happening
JohnDGWed 4 Nov 2009
Yes, please no abuse of operator overloading. List concat is represented as ++ in Haskell and @ in OCaml. Probably not common enough in Fan to warrant an operator.
qualidafialThu 5 Nov 2009
There's also a semantic difference between add and plus: add generally means changing the receiving object in place whereas plus implies you will get a new object back.
tacticsThu 5 Nov 2009
Ah. I didn't realize it mutated the caller. Nevermind it!
tactics Wed 4 Nov 2009
Would it be possible to include List.plus as an alias for List.addAll so that
[1] + [2] + [3] = [1, 2, 3]
? It works like this in Ruby and Python.brian Wed 4 Nov 2009
I personally don't particularly like using operator overloading for list manipulation because it is always unclear exactly what is happening
JohnDG Wed 4 Nov 2009
Yes, please no abuse of operator overloading. List concat is represented as
++
in Haskell and@
in OCaml. Probably not common enough in Fan to warrant an operator.qualidafial Thu 5 Nov 2009
There's also a semantic difference between
add
andplus
:add
generally means changing the receiving object in place whereasplus
implies you will get a new object back.tactics Thu 5 Nov 2009
Ah. I didn't realize it mutated the caller. Nevermind it!