Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to v2 #20017

Closed
5 of 6 tasks
ringabout opened this issue Jul 13, 2022 · 2 comments
Closed
5 of 6 tasks

Migration to v2 #20017

ringabout opened this issue Jul 13, 2022 · 2 comments
Labels

Comments

@ringabout
Copy link
Member

ringabout commented Jul 13, 2022

Cannot cast ref to RootRef in Arc/Orc

affected important packages:

Solution

type
  Color = ref object

var x = Color()
let y = cast[pointer](x)
# use Gc_ref(y) when it is needed

shallowCopy/shallow

Solution

shallowCopy/shallow becomes a compile-time error with ARC/ORC. move seqs/strings instead.

proc main()
  var x = "123"
  var y = move(x)

You can also use sink to let the compiler decide whether to move the data or copy the data.

proc main(x: sink string) =
  var y = x

Another solution is to use {.cursor.}.

deepcopy

Solution

Enable deepcopy for ARC/ORC. Use --deepcopy:on. Note that the option appears since 1.4.0 and it is ignored with refc.

cannot bind another destructor to ref object

#19231

affected important packages:

minimal testcase

type
  A = ref object

var x1: A
new(x1, proc (x: A) {.nimcall.} = discard)
var x2: A
new(x2, func (x: A) {.nimcall.} = discard)

{.global.} pragma doesn't work when the variable is initialized with non-value types

#17552

Solution

None

threadpool doesn't work with ORC

Solution

Switch to https://github.com/status-im/nim-taskpools or use createThreads.

Mixing declarations and statements at the top level causes undefined behaviour

#19795

affected important packages:

Solution

None.

Workaround: move the top level statements to the main procs.

defaults to ORC

#19972

stricteffects

experimental:stricteffects is enabled for v2. There is a switch --legacy:laxeffects to keep backwards compatibility with old behaviors.

ref #19303
ref nim-lang/RFCs#435

@ringabout ringabout changed the title [meta] important pacakes which doesn't work with arc/orc and reasons Migration to ARC/ORC Jul 25, 2022
@ringabout ringabout changed the title Migration to ARC/ORC Migration to ORC Jul 25, 2022
@ringabout ringabout pinned this issue Jul 25, 2022
@ringabout ringabout changed the title Migration to ORC v2: Migration to ORC Jul 27, 2022
@exelotl
Copy link
Contributor

exelotl commented Oct 5, 2022

Hey, is this the right place to report that programs using nimPNG don't compile on devel?

shallowCopy usage:
https://github.com/jangko/nimPNG/blob/master/nimPNG/buffer.nim

@ringabout
Copy link
Member Author

ringabout commented Oct 5, 2022

Hey, is this the right place to report that programs using nimPNG don't compile on devel?

I think you probably need to open an issue on the issue track of nimPNG and link this issue. sink parameters seems to be good enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants