4 ms·
Except go's defer is scoped to the function, instead of the innermost enclosing scope.
by leni536 4y ago
Except go's defer is scoped to the function, instead of the innermost enclosing scope.
- tibordp 4y agoThat's a good point and also one of the things I kinda like about Alumina. You can do thing like this and the file will only be closed at the end of the function rather than the end of the if block. let stream: &dyn Writable<Self> = if output_filename.is_some() { let file = File::create(output_filename.unwrap())? defer file.close(); file } else { &StdioStream::stdout() };
- noncoml 4y agoSo less granular and can be assymetric. Don’t think that’s a good thing
- leni536 4y agoMe neither, I think it is insane.