Joyeer Language Specification
Chapters

§13 Naming Conventions (style guide)

These are not syntactic rules but the compiler issues stylistic warnings when they are violated. AI code generators must follow them.

ConstructConventionExample
Types (struct, enum)PascalCaseMessage, IntList
Functions, methodscamelCaseparseInt, appendByte
Variables, fields, parameterscamelCasefirstName, count
Constants (let bindings)camelCaselet maxRetries = 5
Enum casesPascalCase.Ok, .NotFound
Generic type parameterssingle capital or PascalCaseT, K, Element
Modules / fileslowercasestd.io, http_client.joyeer

13.1 Name lookup and lexical scope

Names are resolved to declarations, not compared as strings after parsing. Every declaration has one identity even when an inner declaration uses the same spelling.

The following lexical scopes exist in v0.1:

Lookup begins in the innermost applicable scope and walks outward. A declaration may shadow a declaration in an outer lexical scope. Declaring the same name twice in one scope is an error.

All top-level declarations are visible throughout their source file, including from declarations that occur textually earlier. This permits recursive and mutually recursive functions and forward references to struct/enum types. Local let / var bindings are visible only after their initializer; an initializer therefore cannot refer to the binding it is declaring. Function parameters are visible throughout the function body. Pattern bindings are visible only in the body of their own match arm.

Type syntax searches the type namespace. Expression syntax searches the value namespace first and may also name a type when it is used as a constructor or qualified member base. A type and value may not introduce the same spelling in one scope because forms such as Foo(...) and Foo.Bar would otherwise be ambiguous. Struct fields and enum cases live in the member scope of their declaring type and are selected through that type or through type-directed contextual lookup.