You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Nim Compiler Version 1.9.1 [Linux: amd64]
Compiled at 2022-12-21
Copyright (c) 2006-2022 by Andreas Rumpf
git hash: 8a77798
active boot switches: -d:release
Current Output
/tmp/asdfds.nim(6, 11) template/generic instantiation of `bar` from here
/tmp/asdfds.nim(5, 27) Error: attempting to call routine: 'f'
found 'f' [param declared in /tmp/asdfds.nim(5, 15)]
Expected Output
25
Possible Solution
procbar[T:proc|object](f:T):int=f(5)
doesn't work either
you can do something like:
typeCallable=concept c
c(5) isintprocbar(f:Callable):int=when (f isproc):
f(5)
else:
`()`(f,5)
but it rather defeats the purpose, and you have to have declared the call operator first
Additional Information
No response
The text was updated successfully, but these errors were encountered:
So I was thinking. Since any object with a call operator can be trivially converted to a closure, if you have an object O in a call with type (args...):ret, instead of doing the lookup against a symbol O matching that type, look for a symbol "()" with type (O,args...):ret
The main point is, instead of different paths for special Operators and procTy, can we use the same path as much as possible
Description
Nim Version
Nim Compiler Version 1.9.1 [Linux: amd64]
Compiled at 2022-12-21
Copyright (c) 2006-2022 by Andreas Rumpf
git hash: 8a77798
active boot switches: -d:release
Current Output
Expected Output
Possible Solution
doesn't work either
you can do something like:
but it rather defeats the purpose, and you have to have declared the call operator first
Additional Information
No response
The text was updated successfully, but these errors were encountered: