-
Notifications
You must be signed in to change notification settings - Fork 10
Naming Conventions
David Nichols edited this page Jun 12, 2016
·
3 revisions
Qore Naming Conventions
The naming conventions documented here are recommendations; any valid identifier can be used for the names listed here.
Object | Example |
---|---|
functions | function_name() |
classes | ClassName |
constants | ConstantName |
namespaces | NamespaceName |
methods | methodName() |
static methods | ClassName::staticMethodName() |
member | memberName |
Function names should be in lower-case with words separated by underscores (_) as follows
sub function_name() {
}
Constant, class, and namespace names should be in CamelCaps
, with no underscores; the first letter should be capitalized as follows:
namespace MyNamespace {
const MyPollInterval = 250ms;
class MyClass {
public {
MyClassConstant = 1;
}
}
}
Class method and class member names should also be in camelCaps
(without underscores) with the first letter in lower-case; this also includes static members.
class MyClass {
private {
int myInt = 0;
static int lastNumber = 0;
# the maximum value of some range
const MaxValue = 200;
}
public {
bool myFlag = False;
}
bool myMethod() {
return myFlag;
}
static string myOtherMethod() {
return "a string";
}
}