JarrettBillingsley / Croc

Croc is an extensible extension language in the vein of Lua, which also wishes it were a standalone language. Also it's fun.
http://www.croc-lang.org
79 stars 12 forks source link

Make namespace field access more like classes? #115

Closed JarrettBillingsley closed 9 years ago

JarrettBillingsley commented 10 years ago

Namespace field behavior no longer matches up with classes. Whereas classes need to have a member added before getting or setting it, namespaces only error on getting invalid fields but are fine with setting them.

Even stranger, namespace field access doesn't match global access behavior, even though both are accessing the same type of object. Global access behavior works the same as classes (have to define the global first, error to redefine a global, getting OR setting an undefined global is an error).

JarrettBillingsley commented 9 years ago

I dunno, like.. classes separate member creation from member update because those operations differ for frozen classes, but for namespaces there's not really a compelling reason to force you to "add" namespace members when manipulating them directly. The global declaration thing is there to catch bugs. So I'll pass.