The with
statement is a good feature. However, a lot of people including me believe that it lacks potential to be great.
It introduces scope and cannot be used in a declarative scope.
It’s shortcomings are surprisingly similar to C++’s if constexpr
that Andrei in Design by Introspection considered to be a “fatal mistake”.
Up for discussion, I’d even suggest a no-brace form for with
declarations:
with Symbol:
orwith(Symbol):
(like attributes)with Symbol;
(likeimport
)
That implemented, with
would be a great feature.
Contrary to others, I do not believe that with
expressions would be necessary. The main reason with
expressions are asked for is because with
introduces scope.