]> ocean-lang.org Git - ocean-D/blob - 00-TODO
updates
[ocean-D] / 00-TODO
1 # This is a living document - delete things when done.  Avoid discussion.
2
3 ## Needs implementation
4
5 ### Next Version (Govetts Creek)
6 - split base_prototype into num/bool/str/label/none
7 - int nat cyc {i,n,c}{8,16,32,64} - maybe not cyc - it needs size.
8 - ops: # & | ~ &~  - no shift: use (N * #shift) or (N / #shift)
9 - op=
10 - enum, with multi-valued names.  enum foo { yes, no, many(10) }
11   bar:foo=.yes; if bar == .no... if ?bar.many: print bar.many, "items"
12   Maybe .true and .false for Boolean.
13 - change use/case labels to create a local enum if no type is evident.
14 - set, with bool or int members.  set foo { pinned, memalloc, priority(4) }
15   bar:foo = .memalloc | .priority(2). if bar.pinned: bar.priority += 1
16 . array slices - references to arrays  "foo: []bar"
17 - array access to read bytes from strings. array[] gets length
18 - remove 'use', replace with 'select' for non-bool and 'continue' for bool and "return" for function
19 - "return" should convert a referenct to a reference if needed.
20 - remove all tests on type->functions
21 - use a type->function for performing function call
22 - revise all commentary
23 - blog post
24 - release
25
26 ### Subsequent version - Nepean River ??
27 - Maybe allow a reference to be passed to function where the by-value is expected
28 - 'return' statement similar to 'use', but only valid a function context
29 - 'return' can take no value when function has inline/transparent return value
30 - simple methods.  Define "func type.name...." and the name will only be visible
31   within namespace for type.
32 - optional args for functions - if value given
33 - named args?  Needs to look like manifest structs
34 - array args - last parameter can collect all remaining as array if attribute 'open'
35    do I need attribute?  Can anything be type compatible with both X and []X ??
36 - initial values for return parameters
37 - convert between string and array-of-cyc8
38 - float64 float32
39 - transparent fields, parameters which are structs or pointers
40 - transparent fields which are arrays
41 - transparent results from functions to have same effect as inline-results
42 - manifest values for records: [.foo = a, .bar = b]
43 - manifest values for arrays: [expr = expr, ...]
44 - constant structure definitions
45 - const structures can inherit from another, and update select fields.
46 - 'use' labels *must* appear in case statements.
47 - 'then' can extend a case section into some other.
48
49 ### And then ...
50 - constructors(called by @new) and destructors (called by @free)
51 - "?type" which includes an error flag in the type
52 - interfaces - with syntax for function type declarations, including
53    type parameterisation
54 - const arrays that are extended incrementally
55 - enums that are extended incrementally
56 - enum as array index.  foo:[:enum]int.  foo[.baz] = 23
57 - modules - exported names in versions, and import lists
58       on types, fields, constants, etc
59 - foreach variable-list := make_generator() do
60       A generator has 'first', 'next' and 'finally' methods
61       'first' and 'next' return the same type which is conditional ('?' works)
62       'finally' returns some other type - possibly Tnone - which goes to
63       a set of case at end of loop
64     NOTE need to understand how break/continue are handled.
65 - lamba - inline functions.  If possible allow a syntax that looks like 'while'...
66 - "run" statement which copies things to a new frame and runs in
67     parallel.  It has no 'return' value
68
69 ### static analysis
70 - add generic attributes with rules for what values are allowed with
71   which attributes.  Need to track:
72     - when object should be freed
73     - when ref is NULL
74     - when value is valid
75     - when int is in some range
76     - when object is "locked"
77   structures can have virtual 'state' fields which align with attributes
78   and certain state values imply certain attributes.
79
80 ### export
81 - structs which have endian and are not sorted (records)
82 - interface to C api (FFI)
83
84 ### escape
85 - for an attribute
86 - convert between integers and refs.  
87
88 ### compile time reflection
89 - code that can interpret attributes etc??
90
91 ## Needs Design
92 - review {} syntax issues - look at weird test cases
93 - do I need a 'rune' type? What are the elements of a string?
94   Are they small strings?  Can I convert to codepoint by treating as number?
95   How much of this is in the utf8 library?  Can a string literal be a number?
96 - exactly where does auto enref/deref happen?
97     .foo modifier does auto-deref
98     (args) modifier does auto-deref (if that makes sense)
99     assignments does auto-enref
100     function parameter passing does auto enref and auto deref
101
102     general operators?  Not comparison.  Not test.  Probably not anything.
103
104 - can "A if B else C" have "A" and "C" be different - one a ref and one not?
105   This might make sense if a ref was wanted - an lvalue is then accepted.
106   But then the ref can have '@' applied so it becomes an lvalue.  So "no".
107
108 - ? modifier for type makes "no such value" an option, detected by '?' operator
109 - $ operator to convert to ?number from ... ref? enum?
110   ?$"hello" can test if the conversion would work. '$foo ?? default'
111   provides a default value
112 - a suffix on a number/string can provide soft typing which is interpreted
113   in type context.  Must like .enumvalue is interpreted only the context of
114   expected type, '43i' would only be meaningful in the same context.
115 - const arrays that are initialized incrementally throughout the code,
116   and post-processed at compile-time, e.g. to sort or derive LR tables.
117   Maybe even across modules.
118   Need a syntax
119   Maybe 'const' can be followed by name of a const which forms the namespace.
120   So a struct bar containing x and y could be initialized
121    const foo::bar
122        x ::= 1; y::=2
123   Then an array could be extended with [+]
124     const ra[+]
125         x::=2 ...
126
127   The syntax needs to be clearly different from
128      const a::num=1; b::=2
129   if that is still allowed
130   Maybe the '=' is enough to differentiate
131
132 - IN and OUT should not be completely ignored when not expected.
133   As well as causing NEWLINE to be ignored, there should be some
134   balance requirement.  Some productions should be required to be
135   balanced.  Lists should not have gratuitous indents.
136   Revisit everything I considered before, but now consider it only
137   for ignore IN/OUT.
138
139 - "debug" code that can be compiled out.  For code, "if debug" is enough
140   if the const can be set easily.  For structure members a 'debugonly'
141   attribute needs to be handled.  Of course 'debug' is multifaceted.
142   We might want tracing, consistency, profiling, etc.
143
144 - union types - how do I want to support these? inheritance with variance?
145 - how are mixins represented?
146 - lambda
147 - 'error' value for various types. NIL for pointer NaN for float, extra flag bit
148    for integers.  -MAX_INT ??
149 - enum as array index.  foo:[:enum]int.  foo[.baz] = 23
150 - init_only fields
151 - const fields in structs: like const, but in 'type' namespace, not 'module'
152 - 'borrowed' and 'owned' attributes for pointers.  .free method
153 - interfaces - list of methods that must be defined
154 - standard interfaces to access operations: group, field, binary, logical
155     How is compatibility of type for second argument assessed?
156     For integers we allow upgrading or even down-grading??
157    This is for overloading operators.  Can we combine them?
158     * / % + - neg abs
159     and or not
160     ++ ?? ?
161     []
162     () (funcall)
163     if/else
164     < <= > >= == !=
165     # & | ~ &~
166
167     I think and/or/not/if-else/??/?  cannot be overloaded
168       Can '?' be used to mae booleans of anything?  How does that
169       interfere with jusing it to test a reference?
170       i.e. how do a query an object when I have a ref?
171     "compare" can, but it is one operator with aliases. or maybe 2, eql and cmp
172     ++ [] definitely can be overloaded though [] need to know if assignment or access
173     assignment?? Can that be overloaded i.e. trigger on access.
174     () can be redirected via 'transparent' function member
175
176 - attributes for fields and local variables
177     transparent - names inside can be accessed directly
178
179     handled    - accesses convert to function calls??
180     constant   - compile time constant - not stored
181     stable     - ??
182     add-only   - ?? like append-only.
183     read-only  - set early never changed?
184     mutable
185     owned      - Can be borrowed and freed
186     borrowed   - There is somewhere this is borrowed from
187     dependant  - ???
188     pure       - definitely not an error
189     endian(big,small,pdp)
190   attributes for whole struct
191     unsorted   - fields appear as written
192     packed     - like unsorted, but no gaps permitted.
193
194 - lambda functions for passing as arg to function.
195    Are these always there to provide an interface for a value?
196    Do I want a syntax for functions that just provides a value
197      func (a:number; b:string):number = a+b[]
198
199 - units for numbers
200 - iso suffixes for number?
201 - static variables.  Easy to implement, but need a syntax.  Something
202   really loud.
203 - concurrency
204       implicit and explict
205       reference attributes for locks and refcounts etc
206       RCU
207   - do/go/run/fork/async complex statement
208      All local variables accessed in the body are read-only
209      and copied to a new frame, and code is run in a new thread.
210      Thread is mostly invisible.  It interacts through shared objects,
211      particularly the caller might create a channel and the thread
212      might send messages on it.  Any interesting handshakes
213      are mediated by appropriate data structures.
214
215 - arbitrary value asserts tied to variable attributes.
216   e.g. ranges for value and relationships between fields
217   These are tested by compiler at any changed.  Somehow.
218
219 - expose parse info for editing by code run at compile time.
220   This allows new attributes to be implemented in app code.
221   E.g. handling bigendian fields by adding conversion functions.
222
223 - Finalize what a "main" program looks like.
224    should argv come from a library (sys.argv), or should environ go to main?
225
226 - classes
227    - constructors and destructors - or "after" ??
228      destructors, which can be declared inline
229    - vtables, fat pointers, list of approaches
230 - interfaces, inheritance
231 - closures, threads, co-routines, generators lamdas
232 - generics/templates.  These should be just a compile-time
233   decision.  Same code can be called with suitable methods passed, or
234   recompiled in the new context and then optimised.
235 - introspection / reflection ?
236       e.g. support serialization
237       find function given a string holding the name
238       measure coverage, adjust based on performance metrics
239       auto-create mock objects
240       Is this just parsing the details in the obj file?
241 - FFI
242 - parameterised types, and dependant types
243 - message passing primitives
244 - overloading for numbers
245 - exceptions ??
246 - ensure list_head type concept can work
247 - "union" type ??
248 NO - pattern matching for destructuring??
249 - casts to and from "binary".
250 NO- typeswitch?
251 - ??? algebraic types
252
253 - code can appear in multiple forms:
254    - source code
255    - abstract syntax tree
256    - byte-code
257    - loadable machine code
258    - executable-only machine code
259   All but last can be loaded by 'ocean' and transformed into a later form,
260   or executed directly.  byte-code and loadable machine code will likely 
261   have ast content was well to describe types and provide template code.
262
263 ## Needed in library
264  - augmented and overloaded pointers
265     An augmented pointer can also store a flag- for a bitlock etc
266     An overloaded pointer can alternately store an int - e.g. error code
267  - garbage collection?
268  - UTF8 string disection
269  - search, regexp
270  - cvt() interface an format() function
271  - parsing: rexep? LALR? sscan?
272  - buffered file IO
273  - auto-growing buffer including strings
274  - sockets
275  - http
276  - html
277  - gtk? xcb?
278