相关疑难解决方法(0)

为什么我不应该存储在Smalltalk中的文字数组中?

一些样式指南和习语表明你不应该改变文字数组,就像在这种情况下:

MyClass>>incrementedNumbers

    | numbers |
    numbers := #( 1 2 3 4 5 6 7 8 ).
    1 to: numbers size: do: [:index |
        numbers at: index put: (numbers at: index) + 1].
    ^ numbers
Run Code Online (Sandbox Code Playgroud)

我为什么不这样做?

smalltalk squeak pharo

6
推荐指数
1
解决办法
484
查看次数

标签 统计

pharo ×1

smalltalk ×1

squeak ×1