arturo-lang / arturo

Simple, expressive & portable programming language for efficient scripting
http://arturo-lang.io
MIT License
695 stars 31 forks source link

[VM/values/value] create proper constructor overloads for deep-copying #1349

Open github-actions[bot] opened 8 months ago

github-actions[bot] commented 8 months ago

[VM/values/value] create proper constructor overloads for deep-copying newQuantity(.., copy=true) would be the example. It should operate statically, at runtime!

https://github.com/arturo-lang/arturo/blob/818d6a565f675c4ee2f9801899bc50f3a2bd3784/src/vm/values/value.nim#L674


# TODO(VM/values/value) add better unit-tests for deep copies
#  right now, in tests/unittests/deepcopies, we're testing integers
#  strings, blocks and dictionaries. The tests could/should cover pretty
#  much every type (nested or not)
#  labels: values, unit-test

# TODO(VM/values/value) create proper constructor overloads for deep-copying
#  `newQuantity(.., copy=true)` would be the example. It should operate statically,
#  at runtime!
#  labels: values, enhancement, cleanup
proc copyValue*(v: Value): Value {.inline.} =
    ## copy given value (deep copy) and return 
    ## the result

175c29a38d7939e8b27d6d724e240ef83083d2ce

stale[bot] commented 4 weeks ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.