News for hackers. Stuff that matters.

ijoker

Re:The Mumps Programming Language on Monday March 13, 2017 @11:15PM (#13864676)
Another thing that's really weird about MUMPS is that variables are dynamically scoped. So this bit of code prints 5:

  foo() ; declare function foo
    n x ; declare variable x
    s x=1 ; set x to 1
    d bar() ; call bar
    w x ; print x
    q ; return
  bar()
    s x=5 ; set x to 5. Since x is not declared in this function's scope, it will search the symbol table of the calling function and overwrite its x
    q
I've run into so many bugs caused by something like this.