cmtice wrote:

> > If it's possible, it would be nice to have one actual release where people 
> > who used this form of range access will get an error. That will be easy to 
> > detect in any scripts folks are currently using, and easy to fix. However, 
> > if the first official release of this goes from treating it as a range to 
> > treating the difference as an index, that would causes errors that will be 
> > much harder to detect. The other way to do this is add an experimental 
> > setting (so we can delete it later) that enables "- is always minus" (and 
> > returns an error for the token otherwise) and ship it off. That would mean 
> > the error detection would still happen. Since people are going to have to 
> > find out that this is supported to use it anyway, provided we mention the 
> > setting in the same docs, this shouldn't cause any problems. After a 
> > release, we can delete the setting and unconditionally allow the behavior.
> 
> @jimingham I agree that people should be warned first, but there is a problem 
> here is that once I add binary minus, the parser won't be able to distinguish 
> between a minus as a separator compared to a minus as a part of an expression 
> in this part:
> 
> ```
> postfix_expression "[" expression "]"
> postfix_expression "[" expression "-" expression "]"
> ```
> 
> So I'll have to change the `expression` here to something below the binary 
> minus in the grammar, like a `unary_expression` or another 
> `postfix_expression`.
> 
> I can make this change in this patch along with an error upon finding '-' 
> that suggests to use `:` instead. When I add binary minus I will also add the 
> "- is always minus" setting, which we can remove 2 releases from now, I 
> guess? The only downside is that the expressions available for indexing will 
> be limited for all this time.

Can't you just update the code that currently recognizes "[expr - expr]" to 
return an error for now (something along the lines that "this syntax is 
deprecated; please use ':' instead of '-'")? Then in the PR that implements 
binary subtraction, remove this error message?


https://github.com/llvm/llvm-project/pull/173410
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to