[Feature] Declaring empty variables
- 主要言語
- Rust
- スター
- 5.2k
- フォーク
- 145
- 平均マージ
- 5日 3時間
- マージ済み PR(30日)
- 7
説明
**Is your feature request related to a problem? Please describe.**
In bash, it is possible to declare an empty variable, like so:
#!/usr/bin/env bash
declare foo
foo="bar"
echo "$foo"
Outputs:
bar
However, this functionality is not present in Amber:
main {
let foo
foo = "bar"
echo foo
}
Outputs:
ERROR Expected '=' after variable name 'foo'
at empty.ab:3:6
2| let foo
3| foo = "bar"
4| echo foo
**Describe the solution you’d like**
Simply, compile `let foo` to `declare foo`.
Additionally, `declare` is useful for enforcing variable type, as demonstrated in [this](https://unix.stackexchange.com/a/510342) stackexchange answer. This could be written in Amber as `let foo = Text`.
**Describe alternatives you’ve considered**
I *suppose* writing `let foo = ""` would suffice, but my proposed solution implements more bash functionality and allows for cleaner Amber code.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。