From 13ada1015158d65d7a3f57a89cc21769cf879934 Mon Sep 17 00:00:00 2001 From: bptato Date: Sun, 14 Apr 2024 13:51:10 +0200 Subject: utils: polyfill addr/unsafeAddr distinction in Nim 2+ I wish they didn't change this. unsafeAddr may be a confusing name, but it's more powerful than addr. Merging them violates the principle of least power. e.g. say I get n thru a param, and shadow it proc x(n: int) = var n = n + 1 a screen or two later I call mutates_variable_in_c(addr i) then later I no longer need to add 1, so I remove the var line. In Nim 1.6 the compiler refuses to compile, I can instantly find the bug. In 2.0 it does... whatever?? Maybe for an int it "works", for an object it likely doesn't. Certainly not something I'd enjoy debugging. --- nim.cfg | 1 + 1 file changed, 1 insertion(+) (limited to 'nim.cfg') diff --git a/nim.cfg b/nim.cfg index 8d688ac0..1dc64525 100644 --- a/nim.cfg +++ b/nim.cfg @@ -6,6 +6,7 @@ --experimental:"overloadableEnums" --warning:Effect:off --mm:refc +--include:"utils/myaddr" --import:"utils/eprint" --styleCheck:usages --styleCheck:hint -- cgit 1.4.1-2-gfad0