X-Git-Url: https://ocean-lang.org/code/?p=ocean-D;a=blobdiff_plain;f=00-TODO;h=07109022d2e0f211d313d8b316beede85e7c32db;hp=13ea9e62f3a11c1d1ef56232b3fc0c2ac506efb5;hb=4ce1db1a23db332cdb72a39def722c0392d5b884;hpb=509e0c8cd5c64e608032aa95a51dd5096185c338 diff --git a/00-TODO b/00-TODO index 13ea9e6..0710902 100644 --- a/00-TODO +++ b/00-TODO @@ -1,91 +1,226 @@ -This is a living document - delete things when done. Avoid discussion. - -Current version (Cataract Creek) -- functions to return type with 'use' -- functions to return structure with name assignment - bare 'use'? -- '?' prefix operator returns Boolean -- reference to struct (@foo), with @new, @free, @nil -- more number types, no units yet - -Later -- string manipulation -- file i/o -- enum -- basic methods -- structs - - const fields ... what does that mean? Assign once as initialization? - Can be used for array size? What else? - - anonymous field - array or struct (or pointer to these) - multiple anon struct are allowed if they don't conflict - - [] can apply to anon array field - - anon struct field gets fields interpolated - - - anon fields have no name before the :, so - struct foobar: - :content - size:number - -- manifest values for arrays and structs [a,b,c] - or [.foo=a, .bar=b] or [ [1]=a, [2]=b] - That last doesn't parse easily, unless we require tags... not a good idea. - [ .[1] = a, .[2] = b ] ?? Maybe. - or () to group, [] for index. To (.foo=a) ( [1] = b ) -- yet more operators - << >> # - bit-ops & | ~ &~ - op= -- integers, unsigned, bitfield, float, double? -- pointers - - owned or borrowed - - pure, loaded, overloaded, augmented - - owned: once, counted, collected - - shared or thread-local -- array slice -- array buffer - can be added to and grows. -- char, string search, regexp search - -- allow "do stuff" as a stand-alone statement (scope) +# This is a living document - delete things when done. Avoid discussion. + +## Needs implementation + +### Current version (Cataract Creek) + +- use AddressOf instead of AssignRef +- revise all commentary +- blog post +- release + +### Next Version (Govetts Creek) +- int nat cyc {i,n,c}{8,16,32,64} - maybe not cyc - it needs size. +- ops: # & | ~ &~ - no shift: use (N * #shift) or (N / #shift) +- op= +- enum, with multi-valued names. enum foo { yes, no, many(10) } + bar:foo=.yes; if bar == .no... if ?bar.many: print bar.many, "items" + Maybe .true and .false for Boolean +- change use/case labels to create a local enum if no type is evident. +- set, with bool or int members. set foo { pinned, memalloc, priority(4) } + bar:foo = .memalloc | .priority(2). if bar.pinned: bar.priority += 1 +. array slices - references to arrays "foo: []bar" +- array access to read bytes from strings. How to get length? "?string[4]" ?? + array[] gets length?? +- remove all tests on type->functions +- use a type->function for performing function call +- revise all commentary +- blog post +- release + +### Subsequent version +- Maybe allow a reference to be passed to function where the by-value is expected +- 'return' statement similar to 'use', but only valid a function context +- 'return' can take no value when function has inline/transparent return value +- simple methods. Define "func type.name...." and the name will only be visible + within namespace for type. +- optional args for functions - if value given +- named args? Needs to look like manifest structs +- array args - last parameter can collect all remaining as array if attribute 'open' + do I need attribute? Can anything be type compatible with both X and []X ?? +- initial values for return parameters +- convert between string and array-of-cyc8 +- float64 float32 +- transparent fields, parameters which are structs or pointers +- transparent fields which are arrays +- transparent results from functions to have same effect as inline-results +- manifest values for records: [.foo = a, .bar = b] +- manifest values for arrays: [expr = expr, ...] +- constant structure definitions +- const structures can inherit from another, and update select fields. - 'use' labels *must* appear in case statements. +- 'then' can extend a case section into some other. + +## Needs Design +- review {} syntax issues - look at weird test cases +- do I need a 'rune' type? What are the elements of a string? + Are they small strings? Can I convert to codepoint by treating as number? + How much of this is in the utf8 library? Can a string literal be a number? +- exactly where does auto enref/deref happen? + .foo modifier does auto-deref + (args) modifier does auto-deref (if that makes sense) + assignments does auto-enref + function parameter passing does auto enref and auto deref + + general operators? Not comparison. Not test. Probably not anything. + +- can "A if B else C" have "A" and "C" be different - one a ref and one not? + This might make sense if a ref was wanted - an lvalue is then accepted. + +- ? modifier for type makes "no such value" an option, detected by '?' operator +- $ operator to convert to ?number from ... ref? enum? + ?$"hello" can test if the conversion would work. '$foo ?? default' + provides a default value +- a suffix on a number/string can provide soft typing which is interpreted + in type context. Must like .enumvalue is interpreted only the context of + expected type, '43i' would only be meaningful in the same context. +- const arrays that are initialized incrementally throughout the code, + and post-processed at compile-time, e.g. to sort or derive LR tables. + Maybe even across modules. + Need a syntax + Maybe 'const' can be followed by name of a const which forms the namespace. + So a struct bar containing x and y could be initialized + const foo::bar + x ::= 1; y::=2 + Then an array could be extended with [+] + const ra[+] + x::=2 ... + + The syntax needs to be clearly different from + const a::num=1; b::=2 + if that is still allowed + Maybe the '=' is enough to differentiate + +- IN and OUT should not be completely ignored when not expected. + As well as causing NEWLINE to be ignored, there should be some + balance requirement. Some productions should be required to be + balanced. Lists should not have gratuitous indents. + Revisit everything I considered before, but now consider it only + for ignore IN/OUT. + +- "debug" code that can be compiled out. For code, "if debug" is enough + if the const can be set easily. For structure members a 'debugonly' + attribute needs to be handled. Of course 'debug' is multifaceted. + We might want tracing, consistency, profiling, etc. + +- union types - how do I want to support these? inheritance with variance? +- lambda +- 'error' value for various types. NIL for pointer NaN for float, extra flag bit + for integers. -MAX_INT ?? +- enum as array index. foo:[:enum]int. foo[.baz] = 23 +- init_only fields +- const fields in structs: like const, but in 'type' namespace, not 'module' +- 'borrowed' and 'owned' attributes for pointers. .free method +- interfaces - list of methods that must be defined +- standard interfaces to access operations: group, field, binary, logical +- modules - exported names in versions, and import lists + on types, fields, constants, etc +- foreach variable-list := make_generator() do + A generator has 'first', 'next' and 'finally' methods + 'first' and 'next' return the same type which is conditional ('?' works) + 'finally' returns some other type - possibly Tnone - which goes to + a set of case at end of loop + +- attributes for fields and local variables + transparent - names inside can be accessed directly + + handled - accesses convert to function calls?? + constant - compile time constant - not stored + stable - ?? + add-only - ?? like append-only. + read-only - set early never changed? + mutable + owned - Can be borrowed and freed + borrowed - There is somewhere this is borrowed from + dependant - ??? + pure - definitely not an error + endian(big,small,pdp) + attributes for whole struct + unsorted - fields appear as written + packed - like unsorted, but no gaps permitted. + +- lambda functions for passing as arg to function. + Are these always there to provide an interface for a value? + Do I want a syntax for functions that just provides a value + func (a:number; b:string):number = a+b[] + +- units for numbers +- iso suffixes for number? +- static variables. Easy to implement, but need a syntax. Something + really loud. +- concurrency + implicit and explict + reference attributes for locks and refcounts etc + RCU + - do/go/run/fork/async complex statement + All local variables accessed in the body are read-only + and copied to a new frame, and code is run in a new thread. + Thread is mostly invisible. It interacts through shared objects, + particularly the caller might create a channel and the thread + might send messages on it. Any interesting handshakes + are mediated by appropriate data structures. + +- arbitrary value asserts tied to variable attributes. + e.g. ranges for value and relationships between fields + These are tested by compiler at any changed. Somehow. + +- expose parse info for editing by code run at compile time. + This allows new attributes to be implemented in app code. + E.g. handling bigendian fields by adding conversion functions. -Next version (Govetts Creek): -- functions and procedures - Finalize what a "main" program looks like. + should argv come from a library (sys.argv), or should environ go to main? -Much later -- per-field attributes - constant, stable, add-only, read-only, mutable, owned, borrowed, dependant, pure -- records -- enum - classes - constructors and destructors - or "after" ?? + destructors, which can be declared inline - vtables, fat pointers, list of approaches -- operators as interface methods - interfaces, inheritance -- modules, imports and exports -- closures, threads, co-routines, generators +- closures, threads, co-routines, generators lamdas +- generics/templates. These should be just a compile-time + decision. Same code can be called with suitable methods passed, or + recompiled in the new context and then optimised. - introspection / reflection ? e.g. support serialization find function given a string holding the name measure coverage, adjust based on performance metrics auto-create mock objects Is this just parsing the details in the obj file? -- % formatting -- string / slice / strbuf -- parsing library - sscanf equiv, regexp, LALR - FFI -- GTK -- sockets / http / HTML - parameterised types, and dependant types - message passing primitives - overloading for numbers - exceptions ?? - ensure list_head type concept can work - "union" type ?? -- pattern matching for destructuring?? -- casts?? -- typeswitch? -- iso suffixes for number? -- foreach? -- case fall-through or go-to -- break/continue or "next","last" -- algebraic types +NO - pattern matching for destructuring?? +- casts to and from "binary". +NO- typeswitch? +- ??? algebraic types + +- code can appear in multiple forms: + - source code + - abstract syntax tree + - byte-code + - loadable machine code + - executable-only machine code + All but last can be loaded by 'ocean' and transformed into a later form, + or executed directly. byte-code and loadable machine code will likely + have ast content was well to describe types and provide template code. + +## Needed in library + - augmented and overloaded pointers + An augmented pointer can also store a flag- for a bitlock etc + An overloaded pointer can alternately store an int - e.g. error code + - garbage collection? + - UTF8 string disection + - search, regexp + - cvt() interface an format() function + - parsing: rexep? LALR? sscan? + - buffered file IO + - auto-growing buffer including strings + - sockets + - http + - html + - gtk? xcb? +