-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
Declaring "needs" for a component with a Proc fails to compile #1269
Comments
I'm not sure if this would be allowed. |
The
|
by chance, did he mean |
This is what I meant and I think it should work. The I think this is one of the only things in Crystal where the literal works as a type restiction. It's kinda weird. Definitely not required to support it, but it would be nice IMO |
oh wow. I had no idea. That's a strange one for sure, but yeah, if |
Looking in to this, it seems that at the macro level, Where this gets tricky is that So just for some pseudo code here, it seems like we'd have to do something like this:
Then basically we have to manually build out a This is something that can probably be done post 1.0. If anyone happens to land here and really hoping for this to work, let me know. |
Passing procs as parameters can be really helpful for named slots in Lucky components, as shown here:
https://www.youtube.com/watch?v=KoiKOD63tRQ
This episode originated from a snippet provided by @paulcsmith here:
https://gist.github.com/paulcsmith/01c1ced3e681de99d0ec343fdf57e2b7#gistcomment-3419386
Specifically, he wanted to be able to write something like:
However, when using any more than one
needs
when any of them was a Proc, I kept getting a compile-time error ofError: undefined macro method 'ProcNotation#types
. Switching to usingProc
for the type worked, but Paul requested that an issue be opened to look into supporting the->
syntax.The text was updated successfully, but these errors were encountered: