-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTODO
48 lines (48 loc) · 2.98 KB
/
TODO
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
- Reintroduce const to .dup: this probably requires that we handle generic
value types as well (we may need to .idup stuff to copy them, etc.).
- Add "catchall" methods for signature-constrained methods which just contain a
static assert to tell the user what's wrong (instead of letting the compiler
flood with a ton of errors).
- IMPORTANT: current key implicit conversion is wrong. For example, if you have
double keys, then an int key converts to double, but will have drastically
different hash values. So there are really two cases we need to take care of:
- Qualifier conversion: immutable->const, etc.. This is where .idup and .dup
conversion is needed. This is the case Andrei wants.
- Integral type promotions: e.g., int->double, etc.. These SHOULD NOT BE IN
THE CODE. Let the input parameter always be Key (==double), and let the
compiler auto-promote int literals, and the like.
- Value types in opIndexAssign need to allow implicit conversions too!
- Value conversions can be more liberal, because we don't need to compute
hash values. So anything that can be assigned to Value should be accepted.
- This should also include .dup and .idup convertibles.
- BUG: AA!(immutable char[4],int) can't be instantiated.
- Introduce toHash methods for all native types (via UFCS). This will solve the
stupid purity/nothrow idiocies with the current TypeInfo.getHash.
* Note: beware of custom getHash() methods in the pre-built TypeInfo's;
the toHash counterparts should return identical values.
- Implement compile-time instantiation of AA's:
- Use CTFE to build the AA at compile-time, then transform it via mixins
into static structs.
- Investigate how to make signature constraints work so that compiler magic
with wstring/dstring literals will still work properly.
- Key should be implicitly immutable?
+ Support mutable key types for now.
+ IMPORTANT: .get, .opIndex, and .opBinaryRight!"in" need to accept key types
that implicit convert to Key, not just Key itself.
+ Also, .opIndexAssign needs to be clever enough to NOT copy the input key
unless it needs to create a new entry.
+ For this, we need to ensure that the input key type is: (1) comparable
to Key, and (2) implicitly convertible to Key.
+ Andrei's request, however, goes even further: we should invoke .idup on
the input key if it's not immutable but has an .idup method that
returns immutable. This way, we can lookup X[string] with char[], for
example, or even add char[] keys to the hash and have it automatically
convert to immutable.
+ Implement .remove
P Possible to make it safe inside opApply? (Probably not.)
+ Implement .toHash
+ Implement AA literals:
+ We may not have compiler support for syntactic sugar ATM, but that
shouldn't stop us from implementing an interfacing function that can
construct AA's that the compiler can hook into in the future.
+ MAJOR BUG: need to implement opIndexUnary() and opIndexOpAssign(string)().