Nim icon indicating copy to clipboard operation
Nim copied to clipboard

mutable view from immutable location

Open gabbhack opened this issue 3 years ago • 0 comments

Example

{.experimental: "views".}

proc main(): auto =
  let a = "123"
  var foo: var string = a
  
  foo[0] = '3'

  echo a


main()

https://play.nim-lang.org/#ix=41QU

Current Output

323

Expected Output

Compile-time error

$ nim -v
Nim Compiler Version 1.6.6 [Windows: amd64]
Compiled at 2022-05-05
Copyright (c) 2006-2021 by Andreas Rumpf

active boot switches: -d:release

gabbhack avatar Jul 07 '22 14:07 gabbhack