-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
sugar.collect
doesn't work with string
+ other bugs
#16078
Comments
import std/sugar
proc newStringI[T](size: int): string =
newStringOfCap(size)
let s = collect(newStringI(4)):
for j in 55 ..< 59: char(j)
echo s |
sugar.collect
doesn't work with string
sugar.collect
doesn't work with string
+ other bugs
ya, and it seems hard/impossible to fix in a way that's not ambiguous, given that a symbol can have both generic and non-generic overloads. Hence #16082 which also offers other advantages |
… (nim-lang#16089) * changelog * add testcase, fixes nim-lang#14332
This works fine: import sugar
proc newString[T: string](len: int): string = system.newString(len)
var st = collect(newString(3)):
for i in 0..2: "this does not work"
echo st |
this should work without having to introduce this overload, this is clunky. |
… (nim-lang#16089) * changelog * add testcase, fixes nim-lang#14332
… (nim-lang#16089) * changelog * add testcase, fixes nim-lang#14332
sugar.collect
doesn't work withstring
It's a special case but an important one.
Example 1
Current Output
Error: cannot instantiate: 'newStringOfCap[typeof:
Expected Output
works
Example 2
collect
doesn't work withwhen
Additional Information
The text was updated successfully, but these errors were encountered: