2 Types have a per-module namespace.
3 This is pre-populated with
4 int i8 i16 uint u8 u64 etc
10 Types can be added with:
17 name is optional, and can list (parameters) and /attributes
19 Types can be constructed with
21 name(args) parameterized type
24 (args:: args) procedure type
25 (args:: type) function type
28 The content of struct and record are a list of:
31 fieldname/attribute: type
34 indicate endianness - bigendian littleendian hostendian
37 protected by a given lock??
39 For enum, content is list of
41 where "= value" is optional
44 to assign a pointer, use foo = stuff
45 to update what the pointer points to, use foo^ = stuff
46 to get a reference to store in a pointer....
47 references are either borrowed or owned.
48 a name defined "type^" is a borrowed reference, a name defined
50 borrowed references may be taken of anything, but only remain defined
51 as long as the owner remains defined.
52 owned references can only be taken of ownable objects, and
55 There are various ways to own an object:
57 - ownership of a containing object.
58 - ownership provided by class method
60 non-type names (vars, constants) can be introduced with
62 const prefix: name = value; ...
63 func: name(args::type): statements
64 proc: name(args::result): statements
75 decide on data structure
76 different types can't really be handled by a big switch now,
77 I probably need and object with function pointers.
78 free_value(), vtype_compat(), val_init(),
79 dup_value(), value_cmp(), print_value(), parse_value()
81 parse_value only needed for args - str and num
83 print_value - only needed for print and code-dump
84 dup_value - needed until pointers can make sense
85 vtype_compat - needed for various things
86 value_cmp - needed until we have object behaviours
94 I think I need to disassociate the type from the storage.
95 So a 'value' is a parsed constant, but something new is needed for
96 the content of a variable.
102 I currently have an enum of types that is used to test compatability
104 This needs to change .... I guess I need a struct type* What goes in it?
106 - scalar/record/struct/array/pointer/func/enum
109 Do I need forward declarations? Maybe I can just be lazy and
110 require everything to be declared eventually.
111 That isn't sufficient for:
112 - mutually recursive functions
113 - mutually recursive structures
115 What about unions ???
116 blend with enum: a tag with fields?
120 .Bool.true = a:char; b:char
123 Are enums just a fancy way of doing 'const'?
125 const: a=1; b=2; c; d
126 which defines module-wide consts.
129 which defines consts foo.a foo.b foo.c
130 But I don't really like foo entering the val namespace.
131 If bar:foo, then bar.a could be true/false depending on value of bar.
132 bar.a! could set it?? bar.a=true?
135 How do we allocate new objects?
141 Maybe ^= assigns a borrowed reference, and @= assigns an owned reference.
143 allocating isn't really a top priority, so I should just focus on