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

Reintroduce "private" fields, but only lexically #105

Closed JarrettBillingsley closed 10 years ago

JarrettBillingsley commented 10 years ago

Now that we have the possibility of name clashes due to multiple class inheritance, it'd be nice to have the Pythonic system of "lexical private" fields. All that happens is that when you use an identifier in field name position inside a class, and that identifier starts with two underscores, the identifier is prefixed with the name of the class. That's it; it's not meant to prevent access to the fields, only to avoid name clashes when classes are mixed together.