Naming conventions: Difference between revisions
Content added Content deleted
m (→{{header|BQN}}: Names can't start with digits) |
(Add Ecstasy example) |
||
Line 522: | Line 522: | ||
type Maybe = Some(x) or None() |
type Maybe = Some(x) or None() |
||
var x = Maybe.Some(42)</syntaxhighlight> |
var x = Maybe.Some(42)</syntaxhighlight> |
||
=={{header|Ecstasy}}== |
|||
<syntaxhighlight lang="java"> |
|||
// a module name is the name of the app or library, followed by the domain name of the organization; |
|||
// alternatively, a "throw-away" module can have a simple name, like "TestApp" |
|||
module shop.acme.com |
|||
{ |
|||
// other than modules, all type and class names (including enum values) use upper CamelCase; |
|||
const Point(Int x, Int y); |
|||
enum Color {Red, Green, Blue} |
|||
interface Callback |
|||
{ |
|||
// variables, properties, methods, and functions using lower camelCase |
|||
Boolean active; |
|||
void onEvent(String event); |
|||
void onError(Exception e); |
|||
} |
|||
// constants use upper CamelCase, or in some cases, UPPER_SNAKE_CASE |
|||
String DefaultLogin = "guest"; |
|||
Int MAX_QUANTITY = 100; |
|||
// type variables are named for their meanings, and use upper CamelCase |
|||
interface Bag<Element> |
|||
extends Iterable<Element> |
|||
{ |
|||
void add(Element e); |
|||
} |
|||
} |
|||
</syntaxhighlight> |
|||
=={{header|Factor}}== |
=={{header|Factor}}== |