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
error referencing function defined using lazy specifier #2077
Comments
Indeed, doesn't really seem to make much sense. But on the other had I also don't see a reason to forbid it in the spec for example, so we should probably just fix it. |
Well, it’s definitely possible to write legal code that actually varies the parameter: Boolean complicatedFalse<Element>(variable Element? x) => ((x = null) of Element?) exists; With let expressions you could also get the old value, then assign to it, then use both the old and the new value. Probably still doesn’t make sense, but I don’t think it should be illegal either. |
Oh, nice @lucaswerkmeister! I forgot about that. Now I can finally write a memoizer without ugly braces! Result memoize<Result>
(Result() f, variable Result? memo=null)()
given Result satisfies Object
=> memo = memo else f(); |
Wow, that’s fancy. |
I might be completely wrong but I doubt that will work, the |
@quintesse seems to work as intended. gist |
Color me surprised :) |
Haha, cool :) Sent from my iPhone
|
I hadn't really noticed the extra pair of parenthesis, nice :) |
I'm not sure it ever makes sense to have a variable parameter on a function defined using the lazy specifier, but doing so can result in a backend error:
The text was updated successfully, but these errors were encountered: