Open tsoj opened 3 months ago
!nim c
import std/streams
const hello = block:
let strm = newStringStream("12345678")
strm.readFloat64
echo hello
0 bytes (0 bytes)
```cpp
```
2024-04-02T12:05:45
2024-04-02T12:05:45
0 bytes (0 bytes)
```cpp
```
2024-04-02T12:05:45
2024-04-02T12:05:46
0 bytes (0 bytes)
```cpp
```
2024-04-02T12:05:46
2024-04-02T12:05:46
0 bytes (0 bytes)
```cpp
```
2024-04-02T12:05:51
2024-04-02T12:05:51
0 bytes (0 bytes)
```cpp
```
2024-04-02T12:05:53
2024-04-02T12:05:54
0 bytes (0 bytes)
```cpp
```
2024-04-02T12:05:56
2024-04-02T12:05:56
0 bytes (0 bytes)
```cpp
```
2024-04-02T12:05:59
2024-04-02T12:05:59
11.4.0
14.0.0
19.1
2024-04-02T12:05:10Z
1
nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
:robot: Bug found in 18 minutes
bisecting 7
commits at 0
commits per second
It doesn't seem that readFloat64
supports VM or JS
Likely related, the following example also doesn't work:
import std/[streams]
static:
var strm = newStringStream()
strm.write ""
Output:
Hint: used config file '/home/tsoj/.choosenim/toolchains/nim-#devel/config/nim.cfg' [Conf]
Hint: used config file '/home/tsoj/.choosenim/toolchains/nim-#devel/config/config.nims' [Conf]
......................................................................fatal.nim(53) sysFatal
Error: unhandled exception: field 'sym' is not accessible for type 'TNode' using 'kind = nkNilLit' [FieldDefect]
strm.write ""
VM was tended to support write but in fact doesn't.
write
invokes writeData
whenvm
, which invokes writeDataImpl
field.
But that field was skipped to initialized ^impl, thus nil
.
Description
The compiler throws an error when trying to run the following code with
nim r main.nim
:Nim Version
Nim Compiler Version 2.1.1 [Linux: amd64] Compiled at 2024-03-30 Copyright (c) 2006-2024 by Andreas Rumpf
git hash: cf00b2fd9e00909ac6368ece9515f0e020d7813d active boot switches: -d:release
Current Output
Expected Output
Possible Solution
No response
Additional Information
Replacing the
const
with alet
works, i.e. this compiles:What also works is reading a char: