gracelang/minigrace

asString methods on ranges and sequences differ

Closed this issue · 1 comments

Ranges and Sequences are two implementations of the same type. Minigrace takes care that, for example,

(1..4) == [1,2,3,4]
(4..1) == []

they compare equal, have the same hash, and so on.

However, as noted in this issue, their asString methods give different results. This is wrong.

This issue is fixed in commit 602672c. The asDebugString methods still do produce different strings, but that's correct, because asDebugString is intended to reveal the implementation.

print (1..4)                     // => [1, 2, 3, 4]
print ((1..4).asDebugString)     // => range.from 1 to 4
print [1,2,3,4]                  // => [1, 2, 3, 4]
print ([1,2,3,4].asDebugString)  // => sequence [1, 2, 3, 4]