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

Macro for selecting from multiple ports #1851

Closed
jruderman opened this issue Feb 16, 2012 · 5 comments
Closed

Macro for selecting from multiple ports #1851

jruderman opened this issue Feb 16, 2012 · 5 comments
Labels
A-concurrency Area: Concurrency related issues. C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@jruderman
Copy link
Contributor

Could macros build on #1847 to create nice syntax for selecting from differently-typed ports?

#select {
    int_port: n { consume_int(n); }
    str_port: s { consume_str(s); }
}
@brson
Copy link
Contributor

brson commented Feb 16, 2012

Yes, I think that could work.

@eholk
Copy link
Contributor

eholk commented Aug 6, 2012

I think with @paulstansifer's new macro system, and a lot of the infrastructure in pipes, we can probably make this work now. I'm currently experimenting. It will be a pretty hairy macro.

@ghost ghost assigned eholk Aug 6, 2012
@eholk
Copy link
Contributor

eholk commented Aug 7, 2012

I've been working on the pipe select macro here: https://github.com/mozilla/rust/blob/incoming/src/test/run-pass/pipe-select-macro.rs

Due to bugs in the macro system, it doesn't work yet, but I don't see any insurmountable problems.

@eholk
Copy link
Contributor

eholk commented Aug 13, 2012

This commit has a version of the macro that works: 4ec1dd9

I'm not sure the problem was so much a bug in the macro system as some surprising restrictions on pattern syntax and less than informative error messages...

@eholk
Copy link
Contributor

eholk commented Aug 17, 2012

This macro seems pretty complete, so I'm going to close this bug. You can import the macro using include!, but clearly to do this right we need #3114.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-concurrency Area: Concurrency related issues. C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

3 participants