3 ms·
Some may fit previous propositions. For %defer: error defer deallocateFoo(foo); but defer deallocateFoo(foo); ex defer deallocateFoo(foo); failsafe de
by hawski 9y ago
Some may fit previous propositions.
For %defer:
error defer deallocateFoo(foo);
but defer deallocateFoo(foo);
ex defer deallocateFoo(foo);
failsafe deallocateFoo(foo);
bail defer deallocateFoo(foo);
For %return:
fn doAThing(str: []u8) -> %void {
const number = try parseU64(str, 10);
// ...
}
"try" could mean "return an error in case of an error" aka "%return". Then "dare"
could mean "panic in case of an error" aka "%%foo();".
Or use "ex" or "but" everywhere:
ex foo();
const num = foo() ex 42;
const num = ex foo();
ex defer bar(baz);
but foo();
const num = foo() but 42;
const num = but foo();
but defer bar(baz);
- ant6n 9y agoEx sounds a lot like example, rather than exception. I really like the use of keywords, leveraging our extensive understanding and intuition of language to make a language more clear and intuitive. Symbolic operators work well if they are borrowed from math (e.g. third grade), making up new ones often results in a painful learning phase.
- iainmerrick 9y agoHow about "catch"? Zig doesn't have the usual try/catch blocks but the meaning is similar. catch defer dealloc(foo);