-
Notifications
You must be signed in to change notification settings - Fork 5
Open Questions
Ramsey Nasser edited this page Aug 31, 2016
·
1 revision
- How do you create a generic collection?
- Explicitly
-
(vector Int32 1 2 3)
→PersistentVector<Int32>
(does not box) -
(vector Int32 1 2 3 "foo")
→ exception -
(vector 1 2 3)
→PersistentVector<object>
-
[1 2 3]
→PersistentVector<object>
-
[1 2 3 "foo"]
→PersistentVector<object>
-
- Implicitly (probably a bad idea)
-
[1 2 3]
→PersistentVector<Int32>
-
[1 2 3 "foo"]
→PersistentVector<object>
-
[a b c]
→PersistentVector<D>
(D
is the common supertype ofa
,b
,c
)
-
- Explicitly
- What happens when you add an incompatible type to a generic collection?
- e.g.
(let [v (vector Int32 1)] (conj v "foo"))
- Throw an exception?
- Construct a new vector of type
PersistentVector<object>
?
- e.g.
- Could value types flowing through a program end up getting boxed multiple times because of this?
- Do we include return type in the generic signature?
- Julia avoids this as they feel it overly complicates their compiler to little gain.
- How do we deal with argument casting? At the call site? In the function?
- This can and should be prototyped in C# e.g. like this.
- To what extent are we targeting/interoping with the CLR vs C#?
- Current type syntax is purely CLR and does not support C#'s conveniences (e.g.
|System.Collections.Generic.List'1[System.Int32]|
vsList<int>
- The current analyzer supports look up of Properties, which are a C# feature.
- Current type syntax is purely CLR and does not support C#'s conveniences (e.g.