-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
the msg! macro #214
Comments
Probably #236 issue is a part of the ticket |
This week was my first working with this project. The One big issue is that Another bad thing is that, since it's a syntax of its own, it added cumbersomeness and cognitive burden to starting out with the library. It's a pain in the ass to balance out Any approach which messes with interpolating normal code inside macros sounds like a bad idea to me. In summary, this approach can't provide good ergonomics for usability. I'd rather try to spend UX time on the library's primitives or brainstorming constructs which play naturally well with Rust's syntax rather than making this "embedded DSL" thing work. |
I recently got interested in Bastion, and I may have a solution that can replace the entire The thing is to use method chaining instead of match arms. For instance, the fibonnaci example could become: MsgBuilder::from(ctx.recv.await?)
.with_question(|request: String| { /* ... */ })
.with_broadcast(|broadcast: String| { /* ... */ })
.with_message(|message: String| { /* ... */ })
.with_catchall(|unknown| { /* ... */ })
.run(); The What are your thoughts on it? If this solution is accepted, then I would be very happy to implement it :) |
One of the first pain points I had when I started working on bastion was the
msg!
macro.There's a lot going on there, and it might be refactored leveraging Type Level Programming or something.
Let's share our thoughts on that here, and maybe we can figure out a nice trait or API to setup children and message handlers :)
For reference, here's what our current handlers look like:
The text was updated successfully, but these errors were encountered: