-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal: Go 2: simplify error handling and simplify conditions processing and "?" pipe operation symbol #39148
Comments
The The other syntax seems to change if r, err := F(); err != nil {
...
} to r := F() ? err => {
...
} If I'm counting right this replaces |
Thank you for answer if r, err := F(); err != nil {
...
} to r := F() ? err => {
...
} The scope of these two r is different if r, err := F(); err != nil {
...
}else {
if r, err := F(); err != nil {
...
}else{
if r, err := F(); err != nil {
...
}else {
...
}
}
} to r := F() ? err => {
...
}
r := F() ? err => {
...
}
r := F() ? err => {
...
} |
no need for “=>” if r, err := F(); err != nil {
...
} to r := F() ? err {
....
} |
Thanks for the correction on scoping. I don't think it affects the token count, though. Eliminating |
This looks like something like a ternary operator. |
This proposal introduces new syntax unlike anything else in Go. As discussed above, it doesn't appear to bring a significant savings in character count. It has similarities to other error handling proposals that have been declined. For these reasons, this is a likely decline. Leaving open for four weeks for final comments. -- for @golang/proposal-review |
No further comments. |
1.Simplify error handling:
for example (reference to rust)
old(go 1.12):
OR
expect:
OR
when err is nil, don't do err expression
2 Simplify Conditions Process
old(go 1.12):
expect:
when 1 and 2 use at the same time
OR
"?" operation symbol is was used as a pipe which concat expressions
like as linux "|" operation symbol
netstat -an | grep 8080
The text was updated successfully, but these errors were encountered: