Affects Version/s: None
Fix Version/s: None
java version "1.7.0_04"
Java(TM) SE Runtime Environment (build 1.7.0_04-b21)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)
OSX Mountain Lion 10.8.2
Referring to a value in a module can have a scoping issue when using the "static accessor" operator of module/VALUE_NAME. The static accessor works if the module is loaded into a local value but not if def'ed. This example uses the mmap module for Node.js, and successfully reads the PROT_READ value:
This correctly prints "value: 1"
However, if the value for m is def'ed instead, then the compiler assumes that the reference to m is local to the function and therefore not defined:
In this case, the value of m.PROT_READ should have been stat.core.m.PROT_READ.
On the other hand, using . syntax fixes the scoping issue: