Closed
Description
I write a func that call times.epochTime() and Nim compiles it without error or warning.
Example
import times
func testEpo(x: float): float = epochTime() + x
echo testEpo(1.0)
Current Output
1580491911.732826
Expected Output
Error: 'testEpo' can have side effects
According to Araq in IRC, "noSideEffect = proc result only depends on its parameters = proc doesn't use global state".
Using times.cpuTime
in func show compile error.
import times
func testCPU(x: float): float = cpuTime() + x
echo testCPU(1.0)
Output:
test.nim(3, 6) Error: 'testCPU' can have side effects
>nim -v
Nim Compiler Version 1.1.1 [Windows: amd64]
Compiled at 2020-01-31
Copyright (c) 2006-2019 by Andreas Rumpf
git hash: adc52b003960817553aa3481e21a9b335a504e7f
active boot switches: -d:release