arturo-lang / arturo

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

[VM/globals] Is there any way to actually avoid them altogether? #639

Open github-actions[bot] opened 2 years ago

github-actions[bot] commented 2 years ago

[VM/globals] Is there any way to actually avoid them altogether?

Having all these global variables is practical, but it actually causes problems when we end up wanting to work with multiple threads. An idea would be to add them as fields in a VM object, and pass this object around. But it would still need to be properly benchmark as it would - undoubtedly - add some serious overhead.

https://github.com/arturo-lang/arturo/blob/ce734e7a32c73173910cdf8f533f56be21febe3b/src/vm/globals.nim#L21

#=======================================

# TODO(VM/globals) Is there any way to actually avoid them altogether?
#  Having all these global variables is practical, but it actually causes problems when we end up wanting to work with multiple threads. An idea would be to add them as fields in a VM object, and pass this object around. But it would still need to be properly benchmark as it would - undoubtedly - add some serious overhead.
#  labels: vm, enhancement, benchmark, open discussion

var
    # symbols
    Syms* {.global.}      : ValueDict
ndex 584dd731a..39eb13156 100644
++ b/src/vm/lib.nim

658ca7972fbf6d3830966a03cc9d6c7d9e3ea816

stale[bot] commented 1 year 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.

stale[bot] commented 1 year ago

Closing issue as stale.

drkameleon commented 1 year ago

Re-opening as still valid

stale[bot] commented 10 months ago

Closing issue as stale.

stale[bot] commented 2 months 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.