-
Notifications
You must be signed in to change notification settings - Fork 7
Target assignment, refactor, fixes #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Benchmark for dedc219Click to view benchmark
|
Great to see the target stuff simplified. The shorter target assignment process is very nice, too. Should update the documentation here as well, otherwise no one will know that this exists? How should invalid values with such assignments be handled: As expected: --this is an error, because `qwe` is not a valid property
return cycle("[c8]*4:[qwe 0.1 0.5]")
--just like this one
return cycle("[c8]*4:[x0.1]")
-- with the new assignment, this also causes an error as expected
return cycle("[c8]*4:v=[qwe]") Unexpected? -- this does interpret the second value as volume too.
return cycle("[c8]*4:v=[0.1 p0.2]") I would expect this to either trigger an error, or that it overrides the default property key. So "v=" just sets the default property key. |
The reasoning here was that the right side does a cast to a float with whatever it gets (similarly to I did that and added an explanation to the docs. |
Benchmark for dc33d5fClick to view benchmark
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect. Works great!
refactoring Target
The
PropertyKey
stuff bugged me because it could express a lot of impossible values like anIndex
with something on the right, or aName
withInteger
value and the fact that#
name was treated asIndex
, so I simplified this asCause this is actually what we have. Additionally,
#
name is parsed asIndex
instead of making it out of the parser asNamed
. If needed we can extend what can be on the right side ofNamed
later, but using anf64
is enough for now imo.assigning target patterns
Implemented assignment for targeting using
=
, to allow for easier typing targets likeAs per rules of expression chaining (ie no precedence rules, just nesting left to right), if one wants an expression for
v
here, the pattern need to be wrapped in[]
.Indices work without this ofc but you can still make it more verbose with
#
, ieWith this, longer names can also be used (although these still need to be handled somehow outside of the cycle module):
cropping
for target pattern overlapping (both the new assignment and the regular one) events should be cropped inclusively instead of dropping them when they start in the previous cycle, this required a somewhat ugly solution of carrying an
overlap
flag through the output functions, hopefully this doesn't matter much for performance. Below tried to illustrate the problem:example
holds
Target patterns were not applying holds, this is fixed now, meaning
[a b c d]:[1 _ _ 2]
now correctly generates[a:1 b:1 c:1 d:2]
.