@scztt:
Adding classes without recompiling, and defining vars anywhere, are both VERY do-able projects that don’t even require super deep arcane expertise (though they would require a lot of research).
Hello,
I’m curious about the variable declaration idea.
Do people actually want to be able to write things like this?
{var x
;{x = 0
;var x
;x = 1
;[\inner,x].postln}.value
;[\outer,x].postln}.value
Would this print [inner,1] and then [outer,0]?
I can’t see how this is particularly easy to implement?
You can’t write this is Scheme, or ML/Haskell, or Smalltalk.
You can, naturally, write it in Javascript, but…
(function()
{var x
;(function ()
{x = 0
;var x
;x = 1
;console.log(["inner",x])})()
;console.log(["outer",x])})()
> ["inner", 1]
> ["outer", undefined]
Is the interpreter just shuffling the “var x” to the start of the function?
(function()
{var x
;(function ()
{x = 0
;console.log(["outer?",x])
;var x
;x = 1
;console.log(["inner",x])})()
;console.log(["outer",x])})()
> ["outer?", 0]
> ["inner", 1]
> ["outer", undefined]
(Chromium, Version 89.0.4389.114)
I’m not sure Javascript is always the best model?
Are there nicer implementations?
Best,
Rohan