Amber icon indicating copy to clipboard operation
Amber copied to clipboard

[BUG] `seq` works differently on different bash versions

Open KrosFire opened this issue 1 year ago • 1 comments

Amber range echo 2..2 produces bash code: echo $(seq 2 1)

For bash version 3.2.57(1)-release it produces output: 2 1. Bash in newer version doesn't have this issue.

We should add some kind of check for range bounds to return no output, in order to standardise behaviour in all enviroments. Something like:

fun range(start: Num, end: Num): [Num] {
  let range = [Num]

  if end != start {
    range = trust $seq {start} {end}$ as [Num]
  }

  return range
}

KrosFire avatar Jan 25 '25 13:01 KrosFire

i think a hotfix should be a compiler warning about this issue until we come up with a long term solution

b1ek avatar Jan 27 '25 10:01 b1ek