Prompt
Use consistent naming patterns that reflect the semantic role of identifiers:
- Constants should use UPPER_SNAKE_CASE:
const MAX_RETRY_COUNT = 3; const API_BASE_URL = "https://api.example.com"; - Type names should use TitleCase:
struct UserProfile { } class DatabaseConnection { } - Functions/methods should use camelCase:
fn calculateTotal() { } fn validateUserInput() { } - Member variables should use a consistent prefix (e.g., m_) to clearly identify class/struct members:
struct Widget { m_width: i32, m_height: i32 }
This pattern makes code more readable by allowing quick visual identification of an identifier’s role. It also helps catch semantic errors where identifiers might be used incorrectly (e.g., using a type name where a function was intended).