Implement module expression optional fragments#228
Implement module expression optional fragments#228Peter554 wants to merge 1 commit intopython-grimp:mainfrom
Conversation
CodSpeed Instrumentation Performance ReportMerging #228 will not alter performanceComparing Summary
|
06498b6 to
3bdcec8
Compare
| return Err(GrimpError::InvalidModuleExpression(expression.to_owned())); | ||
| let mut patterns = Vec::new(); | ||
| for expanded in &expanded_expressions { | ||
| // Validate each expanded expression |
There was a problem hiding this comment.
The idea here is that after expanding the module expression, all of the expanded expressions should be valid by the old rules. E.g. a.b[.**] expands to a.b and a.b.**, both of which are valid expressions.
|
Interesting to see how AI performs, but I'm not sure about the change itself. If someone is doing this in, say, a forbidden contract, can't they just remove |
@seddonym Yes they could - but |
|
I see what you mean. I think of I'm inclined to say that if someone is needing to use Let's leave this PR open for now - there are a few new contracts in the offing which may make it unnecessary, and plenty of other things that I'd like to concentrate on - in particular speeding up the linter. Thanks for the idea though. |
Okay sounds good to me - I'll put the PR back to draft for now then and we can revisit this if we see a need for it. |
|
Closing this PR since we aren't sure that we want this and the PR is now rather stale. |
I've noticed some uses of module expressions in import linter contacts like this:
We currently need two entries here, since
domain.**does not includedomainitself.This observation motivates the change in this PR, which introduces a syntax for optional fragments within module expressions.
After this PR the above could be reduced to:
We didn't really discuss this before @seddonym so feel free to reject this or suggest alternatives!
I wanted to try out a agentic AI, which is the main personal reason for this PR. This PR was generated almost entirely by Claude 3.7 using Zed agentic AI.
Interestingly a module expression
domain[.**]now behaves the same asdomainwithas_package=True.