Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I see typed global variables as replacement for writing

  const x = Ref{Int}(1)
and then mutating it as `x[] += 1`. With the type annotated globals, we'll be able to simply write

  x::Int = 1
and rebind it as `x += 1`. Besides the syntactic advantage, this way is threadsafe by default whereas mutating a constant global `Ref` is not threadsafe.


> this way is threadsafe by default

No? Concurrent updates of integers can be accomplished with atomics: https://docs.julialang.org/en/v1/manual/multi-threading/#Ato...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: