Just an idea in the name of simplifying the language and interfaces. I'm always feeling like copy() methods (e.g. in os.path) are redundant, because the same semantics has the special case of the [] operator, namely [:].
Shouldn't we discourage the creation and use of methods with copy semantics in favour of the [:] operator?
There is though currently an issue to use the [:] operator this way:
m = {0->5, 1->6}
n=m[:]
n[1]=9
io.writeln("m", m, "n", n)
[[Error::Key]] --- Invalid key:
In code snippet:
6 : DATA : 0 , 0 , 6 ; 5; :
>> 7 : GETI : 5 , 6 , 7 ; 5; m[:]
8 : MOVE_PP : 7 , 1 , 8 ; 5; n=m[:] n
Raised by: __main__(), at instruction 7 in line 2 in file "/home/test/test.dao";
[:] is slicing, which only slightly overlaps with copying and is hardly intuitive in most cases comparing to clone(). No need to turn the language into APL, it won't make it simpler.
Just an idea in the name of simplifying the language and interfaces. I'm always feeling like
copy()
methods (e.g. inos.path
) are redundant, because the same semantics has the special case of the[]
operator, namely[:]
.Shouldn't we discourage the creation and use of methods with copy semantics in favour of the
[:]
operator?There is though currently an issue to use the
[:]
operator this way: