Skip to content
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

Short syntax for connecting events #6

Open
wvengen opened this issue Jun 27, 2021 · 2 comments
Open

Short syntax for connecting events #6

wvengen opened this issue Jun 27, 2021 · 2 comments

Comments

@wvengen
Copy link
Owner

wvengen commented Jun 27, 2021

RMididings currently uses Fork!, Chain! and Not! to connect events. The mididings syntax with //, >> and ~ is easier to read. With Rust's procedural macro's it may be possible to add mididings-native syntax. For example, the inline_python crate parses Python-code with a Rust procedural macro (development blog series). It would be great if people could copy and paste mididings patches into RMididings, or get close to that.

wvengen added a commit that referenced this issue Jul 2, 2021
@wvengen
Copy link
Owner Author

wvengen commented Jul 2, 2021

Work started in branch proc-macro.

@wvengen
Copy link
Owner Author

wvengen commented Jul 2, 2021

At this moment, the work in progress is a patch! macro that accepts a syntax closer to mididings.

A > B - chain
A / B, [A, B] - fork
*A - add, i.e. [Pass(), A]
!A - invert, i.e. Not!(A)

Since we are using the Rust parser (and would like to keep using it), not all syntax is possible: // doesn't exist as an operator, so we resort to /. To keep things consistent > is used instead of >>. The tilde ~ is no operator in Rust, so we use !. The plus + is no unary operator, so we use *. We will be able to use - as unary operator for negation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant