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
Cro::Transform using consumes and produces rather than type parameters
#1
Comments
|
It's interesting that this issue doesn't state a single reason why it would be better using a parametric role. :-) Consider something like CompositeTransform. It's trivial to get the consumes and produces right for this case just by implementing the methods. Introduce a type parameter, and that (admittedly small) logic would need to be done outside of the About the only advantage I can see in doing it with type parameters that it'd save writing out the produces/consumes methods, but it's not all that much of a saving. Arguably it'd let things like And that last point kinda nails it; the composer performs a whole bunch of sanity checks on the pipeline, quite aside from the produces/consumes. It also tries to give nice explanations of what was done wrong. We could maybe try to encode some of that using parametric roles, but I'm not sure we can get all the way, and I'm very sure the errors would make a whole lot less sense to user. |
An attempt to get something compile-time checkable, is, of course, desirable, which is not doable AFAIK with such methods. I didn't argue much for it because of the two latter points reducing a lot of the usefulness (while Something like I probably feel like it could/should/would be nice to have types because such a pipeline/ I'm starting to realize something that's "missing" (probably by design) which would enable much more interesting transformations would be |
|
Going to close this one, as without static checking for role it's not going to be of that much use. |
Hi,
I just wanted to know why Cro uses
instead of e.g.
When asking around, I got two separate reasons:
composeN(at least in Perl 6), in a case likeCro::ManyThingsInARow[A, E].new(AB, BC, CD, DE). That's solved by composing one after another, though a bit annoying.Supplys aren't typed (and thus having a type parameter is less useful)I'd like to know more about why it was done that way
The text was updated successfully, but these errors were encountered: