ion issueshttps://gitlab.redox-os.org/redox-os/ion/-/issues2020-12-12T21:56:29Zhttps://gitlab.redox-os.org/redox-os/ion/-/issues/991Simplify slicing2020-12-12T21:56:29Zmatu3baSimplify slicingfeat: Remove edge cases
BREAKING CHANGE: progams relying on slicing MUST be revalidated
perf: impact
performance none
usability increase
maintainability increase
code: input
```sh
let array = [{1..10}]
let array2 = [{1...10}]
echo...feat: Remove edge cases
BREAKING CHANGE: progams relying on slicing MUST be revalidated
perf: impact
performance none
usability increase
maintainability increase
code: input
```sh
let array = [{1..10}]
let array2 = [{1...10}]
echo @array
echo @array2
```
expect: output
```
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
```
actual: output
```
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
```
reason: better usability and remove edge case
context: We should reuse the inclusive annotation for slicing to simplify working with the shell.
```
let array2 = [{1..=10}]
```Ion Shell v1.0.0betahttps://gitlab.redox-os.org/redox-os/ion/-/issues/961Allow pipeing of control flow constructs2020-12-12T22:16:32ZIan WahbeAllow pipeing of control flow constructsfeat: Allow piping of control flow constructs
BREAKING CHANGE: This should not break anyone's code, as it is purely additive.
perf: impact
This should not change performance.
Usability of shell increases, as it removes the need for ...feat: Allow piping of control flow constructs
BREAKING CHANGE: This should not break anyone's code, as it is purely additive.
perf: impact
This should not change performance.
Usability of shell increases, as it removes the need for unnecessary temporary variables.
This makes user code marginally more maintainable, as it should remove boilerplate code.
code: input
```
let x = 0
while test $x -le 5; echo $xl; let x += 1; end | grep 2
if true; echo "foo"; else; echo "bar"; end > output.txt
cat output
```
expect: output
```
2
foo
```
reason: Allow more complicated operations. This would include creating and filtering a loop, then outputting it to a file. This would make the language more consistent and functional (as in the paradigm).
behavior of bash/dash/zsh/fish/oil
bash and zsh have this functionality.unplannedhttps://gitlab.redox-os.org/redox-os/ion/-/issues/880Multiple LHS values with indexing using math assignment operates on entire array2020-12-12T23:10:27ZRoland KovácsMultiple LHS values with indexing using math assignment operates on entire array* ion revision: 04f7be9
* expected behavior: indexed assignment only applies to the index position.
```
$ let a:[int] = [0 0 0]
$ let b:int = 0
$ let a[1] b += 1 1
$ echo @a
1 1 1 # [0 1 0] expected
$ echo $b
1
```* ion revision: 04f7be9
* expected behavior: indexed assignment only applies to the index position.
```
$ let a:[int] = [0 0 0]
$ let b:int = 0
$ let a[1] b += 1 1
$ echo @a
1 1 1 # [0 1 0] expected
$ echo $b
1
```Ion Shell v1.0.0https://gitlab.redox-os.org/redox-os/ion/-/issues/834Cannot write functions with variable argument count2023-01-31T05:35:01ZZach ButtonCannot write functions with variable argument countIt appears to only be possible to define functions with a fixed number of arguments.
Perhaps the simplest solution would be some basic polymorphism. Example:
```shell
fn doStuff a b
echo a: $a, b: $b
end
fn doStuff a
doStuff $a "not...It appears to only be possible to define functions with a fixed number of arguments.
Perhaps the simplest solution would be some basic polymorphism. Example:
```shell
fn doStuff a b
echo a: $a, b: $b
end
fn doStuff a
doStuff $a "not_specified"
end
doStuff "test"
# "a: test, b: not_specified"
```
Or, perhaps cleaner, argument expansion:
```shell
fn printSection label ...list
echo -e "\n\n$label:"
for item in @list
echo "- $item"
end
end
printSection todo "type foo" "make bar"
# todo:
# - type foo
# - make bar
```unplanned