Destructive open with parentheses

I sometimes come across the situation where I want a local open to shadow ambient identifiers, in an expression like M.( override_function a b ) . This generates a warning 44 which is unwanted here. Latest example: Float.( x < 5.).

I could use let open! M in but that’s often just too long. Would it not be nice to have a destructive local open for parentheses? M.!( ... ) or M!.( .. ) or something like that, compatible with the new Array indexing syntax?

2 Likes

M.!.(...) was proposed and discussed a while ago, but there wasn’t enough support to justify its inclusion in the language.

The branch is still there on purpose, If someone wants to pick it up again and champion it, you are welcome to do so. :slight_smile:
I think it should be done, at least for consistency, but I doubt the outcome will be any different.

I see. I also think it would be good to have, both for consistency and for usability of operators in small DSL expressions. I’m not qualified to do an actual PR to the compiler though.

If others feel they need this maybe they can give some use case here for support? On the other hand, if no-one feels the need maybe it’s really not worthwhile.