Replies: 4 comments 5 replies
-
Global functionsI’ve been reorganizing the code: removing global variables, adding new structures and configurations, and preparing to extend the engine functionality to support the editor. However, I found it confusing to separate functions because the global functions are written in the same style as methods/member functions inside classes or structs. Current IssueIn my own code style, I prefer to distinguish between them at a glance. For example:
This convention makes it much easier for me to follow the code and immediately recognize whether a function is global or a member method. QuestionWhat do you think? |
Beta Was this translation helpful? Give feedback.
-
📂 File Naming ConventionsWhile working on creating new files recently, I ran into several cases where I couldn’t immediately tell if a file contained a subclass definition or an extension. Since both types of files are currently named in the same style, the distinction wasn’t obvious until I actually opened the file and looked at the contents. Subclasses
Extensions
Why?This convention improves readability by distinguishing between new subclasses and extensions at a glance. QuestionWhat do you all think? |
Beta Was this translation helpful? Give feedback.
-
Use Smaller, More Focused FilesFrom my background in embedded systems and Unix kernel development, I've seen how breaking code into small, purpose-driven files keeps things organized, easier to read, and more maintainable. Large files mix concerns and become harder to work with over time. Recommendation
Benefits
NoteThis is not a strict rule during the learning stage. Early on, larger files are natural when abstractions aren't clear yet. The proposal is simply a guideline to keep in mind, so that as we gain clarity, we refactor toward smaller, modular files. QuestionWhat do you all think? |
Beta Was this translation helpful? Give feedback.
-
|
I generally agree with these coding style suggestions. I’ll need to think a bit more about the “+” for extensions. Is that something Swift developers typically use? Coming from the C/C++ world, I haven’t really seen that before, so I’ll give you a clear answer tomorrow. For the changes, I suggest we approach them in an organized way: for example, start with Global Functions → push PR, then move on to Extensions → push PR, and so on. My thought is that we should do this after the next release. I’d like to get the documentation updated, merge in your next PRs and mine, and then do a v0.3.0 release before tackling these style adjustments. Also, I currently use SwiftFormat (explained here: What do you think? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This proposal is intended as an open discussion for improving and aligning our coding style, file naming conventions and other coding stuff. This aims to gather feedback from everyone, especially those with coding experience, so we can outline the pros and cons and refine our standards over time.
Each idea below is presented as a standalone discussion point.
Please reply directly under each point / comment with your pros, cons, and suggestions so we can keep the discussion structured.
The goal always is to improve readability of the code
Beta Was this translation helpful? Give feedback.
All reactions