You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using f as Foo = AcquireAndReturnSubtypeOfFoo():
f.DoFooStuff()
This is currently not allowed by the compiler (the "as Foo" part) but similar constructions are allowed in C# and Visual Basic and it would be nice to have this behavior.
The text was updated successfully, but these errors were encountered:
Unfortunately, there's no good way to support this.
using is a macro, and macros can have expressions as arguments, and a Block as the body. But variable as type = SomeValue is a DeclarationStatement, which is a Statement rather than an Expression, and trying to change that would require changing the parser and the AST and potentially breaking a lot of things.
Maybe one way to achieve this more easily is with the experimental 'var' macro. using var f = Acq... this way 'f = Acq' is an expression while the inner var macro can add the declaration statement to the AST.
It would be very useful to be able to write this:
using f as Foo = AcquireAndReturnSubtypeOfFoo():
f.DoFooStuff()
This is currently not allowed by the compiler (the "as Foo" part) but similar constructions are allowed in C# and Visual Basic and it would be nice to have this behavior.
The text was updated successfully, but these errors were encountered: