Re: Compilation error after upgrade to 1.0.2 from 0.19
Thanks for the answer; I'll give that a try...
Re: Compilation error after upgrade to 1.0.2 from 0.19
This works on the latest Nim release (should work on 1.0.2 too): [https://play.nim-lang.org/#ix=26Zl](https://play.nim-lang.org/#ix=26Zl)
Re: Compilation error after upgrade to 1.0.2 from 0.19
Sorry for my late reply, and thanks for the answer. However I didn't find a solution for the following problem: import nre var tokens = newSeq[string]() tokens = "abc > def".match(re"\s*(\S+)\s*(?:>\s*(\S.*\S))?\s*").get.captures.toSeq() # ERROR echo tokens[0] tokens[0] = "ghi" Run The nre docs state: Note: If you love sequtils.toSeq we have bad news for you. This library doesn't work with it due to documented compiler limitations." Suppose, this is still the problem... Is there a simpler workaround than to enumerate the captures, get the values, and assign to tokens? - as e.g. in caps = "abc > def".match(re"\s*(\S+)\s*(?:>\s*(\S.*\S))?\s*").get.captures for cap in caps: tokens.add(cap.get) Run
Re: Compilation error after upgrade to 1.0.2 from 0.19
According to your error message, it seems tokens[ITEM_NAME] is Option[system.string] type and you are trying to add it to seq[string] type result variable. You might need to read this document and learn how to get a value from an Option type. [https://nim-lang.org/docs/options.html](https://nim-lang.org/docs/options.html)
Compilation error after upgrade to 1.0.2 from 0.19
The following code used to compile in nim 0.19: result = newSeq[string]() ... var tokens = li.match(re"\s*(\S+)\s*(?:>\s*(\S.*\S))?\s*").get.captures.toSeq() # Add to the list of list values result.add(tokens[ITEM_NAME]) Run Now, I get the following error: G:\src\nim\vim256\opts.nim(281, 19) Error: type mismatch: got but expected one of: proc add[T](x: var seq[T]; y: openArray[T]) first type mismatch at position: 2 required type for y: openArray[T] but expression 'tokens[0]' is of type: Option[system.string] proc add[T](x: var seq[T]; y: T) first type mismatch at position: 2 required type for y: T but expression 'tokens[0]' is of type: Option[system.string] 9 other mismatching symbols have been suppressed; compile with --showAllMismatches:on to see them Run As I have "been away" from nim for a relatively long period, I would appreciate some hint as how to remedy this...