問題タブ [gnu-smalltalk]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
1 に答える
557 参照

collections - Smalltalkでコレクションをそれ自体に追加すると失敗するのはなぜですか?

なぜこれが GNU Smalltalk で終了しないのだろうか:

s := Set new. s add: s

理論的にsは、単に空のセットを含むセットである必要があります。しかし、それを実行すると永遠にループし、ヒープが爆発します。

興味深いことに、 ((s := Set with: 4 with: 5 with: 6) add: s) size.終了して 4 に評価されます。