loov / goda

Go Dependency Analysis toolkit
MIT License
1.37k stars 45 forks source link

expr: improve clarity and consistency of help #58

Closed ChrisHines closed 2 years ago

ChrisHines commented 2 years ago

Also fix some spelling errors.

ChrisHines commented 2 years ago

While researching how goda's various expressions work I began to wonder if the test=1(X) expression has been made obsolete by the X:+test selector. I couldn't find a difference in behavior. If they are the same then I suggest also replacing the test=1(X) entry in the goda help expr docs with the selector syntax since that seems newer, more flexible, and more intuitive.

egonelbre commented 2 years ago

Those are great fixes.

I do think that X:+test does make most common test=1 use-cases obsolete. So, I'm all for using the X:+test in the examples.

The main difference is that the "environment modifier" allows to simplify some cases. For example test=1(A + B - C) instead of A:+test + B:+test - C:+test.

ChrisHines commented 2 years ago

The main difference is that the "environment modifier" allows to simplify some cases. For example test=1(A + B - C) instead of A:+test + B:+test - C:+test.

Interesting.

Curiously test=1(A + B) is similar to (A + B):+test, except the second form includes A.test and B.test, but not A [A.test] or B [B.test]. The first form includes those as well.

egonelbre commented 2 years ago

Good catch. I missed the A [A.test] and A_test [A.test] in detecting whether it's a test package. I added a fix that makes the behavior consistent.

Which does bring up an interesting question. Should they be considered as a test package, i.e. A.test and A [A.test]?

I guess it does make sense that tests=1(A) - A === A:test. I guess if there's a need to differentiate, it's possible to add a new selector.