blob: 6b4af6e5676875002da9ffcff6a18e9949b77ccb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
Which syntax to use for field access?
=====================================
See also fields_data.txt for definition syntax.
# Plain syntax, but also ambiguous to the reader
field
# Long syntax with object always specified.
# Python does this (except it's called "self")
this.field
# Use some short identifier for `this`
_.field
t.field
o.field
# Use some special symbol for `this`
<>.field
*.field
/.field
-.field
:.field
().field
~.field
'field
# Various sigills (not very intuitive)
$field
@field
%field
:field
# Various strange syntaxes:
(field)
<field>
..field
# Prefix keyword
set field = value
localvar = get field
# With dot but without object (could be confused with typescopes)
.field = value
localvar = .field
# Naming convention (could be enforced by compiler)
# But it is redundant when the object is specified: obj.m_field
m_field = value
localvar = m_field
# Or prefix the local variables
# (this would lead to names like `_i`)
field = _value
_localvar = field
# Uppercase field names (would conflict with enum values, though)
# Also, it's perhaps a bit too visually similar to declarations
Field = value
localvar = Field
# Require an uppercase letter(!) within fields
theField = value
localvar = theField
# Require an underscore(!) within fields.
# And forbid _ in function parameters and local variables.
# (It looks quite nice actually)
# But it would prevent simple names like `x`, `y`, `left`, `enabled`,
# `length`, `count`, `name`, etc.
the_field = value
localvar = the_field
# Require absense of uppercase letter / underscore
# (but then variable names like `i` would not work)
field = theValue
localVar = field
|