ponyc icon indicating copy to clipboard operation
ponyc copied to clipboard

Allow the usage of `iso` variables in `with` condition

Open SeanTAllen opened this issue 3 years ago • 3 comments

The "old" implementation of with as sugar over try/else didn't allow for the usage of iso variables in a condition as the implementation creates a hygenic variable name for each condition variable and then assigns that to the name given in the with.

The same pattern is followed in the new implementation.

This setup means that all iso condition variables are seen as iso! in the with block, making them unusable.

We should remove this aliasing so that iso variables can be used. This is however kind of tricky and I haven't figured out all the details yet so I decided to open a PR with the almost fully fixed with in #4024 and then open this issue to address iso issue later.

SeanTAllen avatar Feb 20 '22 02:02 SeanTAllen

Anyone interested in working on this can contact @SeanTAllen to get additional information re problems that need to be addressed to make this happen. It's a bit more involved then what @jemc and I first imagined.

SeanTAllen avatar Feb 20 '22 02:02 SeanTAllen

This was discussed a bit on the sync call, where Sean explained more about the options for fixing this.

jemc avatar Feb 22 '22 19:02 jemc

During sync, @jasoncarr0 brought up the point that maybe there's no point to allowing an iso here as you can't do any "iso things" with it. There's nothing "valuable you can do with an iso that you can't do with a ref" in the context of a with.

It's possible that we might want to not support iso but instead would want to improve the error message.

SeanTAllen avatar Feb 22 '22 19:02 SeanTAllen