- cleanup todo list

- fixed language for arrays slightly

R=r
DELTA=81  (39 added, 25 deleted, 17 changed)
OCL=23000
CL=23000
This commit is contained in:
Robert Griesemer 2009-01-16 15:36:46 -08:00
parent aec4d3194a
commit 1593ab6bb4

View File

@ -18,18 +18,21 @@ Any part may change substantially as design progresses.
---- ----
<!-- <!--
Timeline (9/5/08): Decisions in need of integration into the doc:
- threads: 1 month [ ] pair assignment is required to get map, and receive ok.
- reflection code: 2 months [ ] len() returns an int, new(array_type, n) n must be an int
- proto buf support: 3 months
- GC: 6 months
- debugger
- Jan 1, 2009: enough support to write interesting programs
Missing: Missing:
[ ] Helper syntax for composite types: allow names/indices for maps/arrays, [ ] onreturn/undo statement
remove need for type in elements of composites [ ] Helper syntax for composite types: allow names/keys/indices for
structs/maps/arrays, remove need for type in elements of composites
Wish list:
[ ] built-in assert() - alternatively: allow entire expressions as statements
so we can write: some_condition || panic(); (along these lines)
[ ] enum facility (enum symbols are not mixable with ints)
Todo's: Todo's:
@ -39,34 +42,20 @@ Todo's:
[ ] need to talk about precise int/floats clearly [ ] need to talk about precise int/floats clearly
[ ] iant suggests to use abstract/precise int for len(), cap() - good idea [ ] iant suggests to use abstract/precise int for len(), cap() - good idea
(issue: what happens in len() + const - what is the type?) (issue: what happens in len() + const - what is the type?)
[ ] cleanup convert() vs T() vs x.(T) - convert() should go away?
[ ] what are the permissible ranges for the indices in slices? The spec [ ] what are the permissible ranges for the indices in slices? The spec
doesn't correspond to the implementation. The spec is wrong when it doesn't correspond to the implementation. The spec is wrong when it
comes to the first index i: it should allow (at least) the range 0 <= i <= len(a). comes to the first index i: it should allow (at least) the range 0 <= i <= len(a).
also: document different semantics for strings and arrays (strings cannot be grown). also: document different semantics for strings and arrays (strings cannot be grown).
[ ] fix "else" part of if statement
[ ] cleanup: 6g allows: interface { f F } where F is a function type.
fine, but then we should also allow: func f F {}, where F is a function type.
Open issues: Open issues:
[ ] semantics of type decl and where methods are attached [ ] semantics of type decl: creating a new type or only a new type name?
what about: type MyInt int (does it produce a new (incompatible) int)?
[ ] convert should not be used for composite literals anymore,
in fact, convert() should go away
[ ] if statement: else syntax must be fixed
[ ] old-style export decls (still needed, but ideally should go away)
[ ] like to have assert() in the language, w/ option to disable code gen for it
[ ] composite types should uniformly create an instance instead of a pointer
[ ] need for type switch? (or use type guard with ok in tuple assignment?)
[ ] do we need anything on package vs file names?
[ ] type switch or some form of type test needed
[ ] what is the meaning of typeof()
[ ] at the moment: type T S; strips any methods of S. It probably shouldn't. [ ] at the moment: type T S; strips any methods of S. It probably shouldn't.
[ ] 6g allows: interface { f F } where F is a function type. fine, but then we should [ ] need for type switch? (or use type guard with ok in tuple assignment?)
also allow: func f F {}, where F is a function type.
[ ] provide composite literal notation to address array indices: []int{ 0: x1, 1: x2, ... }
and struct field names (both seem easy to do).
[ ] reopening & and func issue: Seems inconsistent as both &func(){} and func(){} are
permitted. Suggestion: func literals are pointers. We need to use & for all other
functions. This would be in consistency with the declaration of function pointer
variables and the use of '&' to convert methods into function pointers.
[ ] Conversions: can we say: "type T int; T(3.0)" ? [ ] Conversions: can we say: "type T int; T(3.0)" ?
We could allow converting structurally equivalent types into each other this way. We could allow converting structurally equivalent types into each other this way.
May play together with "type T1 T2" where we give another type name to T2. May play together with "type T1 T2" where we give another type name to T2.
@ -78,18 +67,35 @@ Open issues:
what about maps (require ==, copy and hash) what about maps (require ==, copy and hash)
maybe: no maps with non-basic type keys, and no interface comparison unless maybe: no maps with non-basic type keys, and no interface comparison unless
with nil with nil
[ ] consider syntactic notation for composite literals to make them parseable w/o type information [ ] Russ: If we use x.(T) for all conversions, we could use T() for "construction"
(require ()'s in control clauses) and type literals - would resolve the parsing ambiguity of T{} in if's
[ ] Russ: consider re-introducing "func" for function type. Make function literals
behave like slices, etc. Require no &'s to get a function value (solves issue
of func{} vs &func{} vs &func_name).
Decisions in need of integration into the doc:
[ ] pair assignment is required to get map, and receive ok.
[ ] len() returns an int, new(array_type, n) n must be an int
[ ] passing a "..." arg to another "..." parameter doesn't wrap the argument again
(so "..." args can be passed down easily)
Closed: Closed:
[x] reopening & and func issue: Seems inconsistent as both &func(){} and func(){} are
permitted. Suggestion: func literals are pointers. We need to use & for all other
functions. This would be in consistency with the declaration of function pointer
variables and the use of '&' to convert methods into function pointers.
- covered by other entry
[x] composite types should uniformly create an instance instead of a pointer - fixed
[x] like to have assert() in the language, w/ option to disable code gen for it
- added to wish list
[x] convert should not be used for composite literals anymore,
in fact, convert() should go away - made a todo
[x] type switch or some form of type test needed - duplicate entry
[x] provide composite literal notation to address array indices: []int{ 0: x1, 1: x2, ... }
and struct field names (both seem easy to do). - under "Missing" list
[x] passing a "..." arg to another "..." parameter doesn't wrap the argument again
(so "..." args can be passed down easily) - this is documented
[x] consider syntactic notation for composite literals to make them parseable w/o type information
(require ()'s in control clauses) - use heuristics for now
[x] do we need anything on package vs file names? - current package scheme workable for now
[x] what is the meaning of typeof() - we don't have it
[x] old-style export decls (still needed, but ideally should go away)
[x] packages of multiple files - we have a working approach [x] packages of multiple files - we have a working approach
[x] partial export of structs, methods [x] partial export of structs, methods
[x] new as it is now is weird - need to go back to previous semantics and introduce [x] new as it is now is weird - need to go back to previous semantics and introduce
@ -125,6 +131,14 @@ Closed:
[x] should binary <- be at lowest precedence level? when is a send/receive non-blocking? (NO - 9/19/08) [x] should binary <- be at lowest precedence level? when is a send/receive non-blocking? (NO - 9/19/08)
[x] func literal like a composite type - should probably require the '&' to get address (NO) [x] func literal like a composite type - should probably require the '&' to get address (NO)
[x] & needed to get a function pointer from a function? (NO - there is the "func" keyword - 9/19/08) [x] & needed to get a function pointer from a function? (NO - there is the "func" keyword - 9/19/08)
Timeline (9/5/08):
- threads: 1 month
- reflection code: 2 months
- proto buf support: 3 months
- GC: 6 months
- debugger
- Jan 1, 2009: enough support to write interesting programs
--> -->
@ -1173,10 +1187,10 @@ The length of arrays is known at compile-time, and the result of a call to
[2*N] struct { x, y int32 } [2*N] struct { x, y int32 }
[1000]*float64 [1000]*float64
Assignment compatibility: Arrays can be assigned to slice variables of Assignment compatibility: Arrays can be assigned to variables of equal type
equal element type; arrays cannot be assigned to other array variables and to slice variables with equal element type. When assigning to a slice
or passed to functions (by value). variable, the array is not copied but a slice comprising the entire array
TODO rethink this restriction. Causes irregularities. is created.
Struct types Struct types