Since **WideCStrings** are **UTF16** encoded and standard strings are **UTF8** encoded, I wonder why **newWideCString(s)** allocates **4 * len(s) + 2** bytes.
The most expensive case would be when each rune is **s** is standard **ASCII**. In this case each rune would take up _one byte_ in **s** but would require _two bytes_ in a **WideCString**. And the least expensive case would be when each rune in **s** takes up _four bytes_ to be represented in **UTF8**. In this case each rune would again require _four bytes_ in a **WideCString**. And **len(s)** returns the size of **s** in bytes, not runes. So, allocating more than **2 * len(s) + 2** bytes in **newWideCString(s)** seems to be a waste of memory. * * * Accessing directly **stdin- >_flag** in **console2.nim** in order to check/set **EOF** may not be such a good idea when multithreading is involved. For checking **EOF** , **feof** can be used; **io.endOfFile** does not work when **stdin** is a terminal, because it is based on **fgetc** and waits for input + ENTER. And, for setting **EOF** , a simple **close(stdin)** does the trick. * * * Anyway, both **console.nim** and **console2.nim** have been updated. Both have been simplified as far as possible. And, as far as I can tell, they are both **Nim v2** ready. Also, in accordance to setting **EOF** by closing **stdin** in **console2.nim** , **clearError** procedure has been removed. PR seems to be getting close...
