One Class per "Module" .monkey file (import fun)
Monkey Forums/Monkey Programming/One Class per "Module" .monkey file (import fun)
| ||
Hey, maybe I'm just used to writing in Java style(One class per file), but is there a way to write in this style without having to write "ClassName.ClassName"? What I mean is having main.monkey file, which starts the program, and then having all the rest of the code be split such that each MyClass.monkey file contains a single class MyClass. You can import each class into the main.monkey file, however you cannot access that class without using "MyClass.MyClass" since you're accessing the module namespace. Thanks |
| ||
Don't have your filenames matching the case of the class name. Lower case them, i.e. classname.monkey holding the ClassName class. |
| ||
you can alias as wellAlias myclass = modulename.myclass ...but you can access a class without the module name. it becomes a problem when there's duplicates, and you can use alias to work around that. |
| ||
Thanks. Ended up going with Muddy_Shoe's suggestion. |