No that is not really accurate. The issue is that without a specific cast or parameterized generic, then V (or any generic parameter) will be assumed to be Obj (not Obj?). So the explicit List.make constructor will essentially default to List<Obj>. You can work around it like this:
list := (Obj?[]) List.make(Obj?#, 0)
As a general principle I think its always best to avoid using List and Map types directly as opposed of their parameterized syntax
SlimerDude Thu 14 Nov 2019
Generic lists do not appear to support
null
values - is that right?I would have thought
Obj?#
would have been the catch all generic Type, so generic lists could be used in all situations.In a similar way:
brian Thu 14 Nov 2019
No that is not really accurate. The issue is that without a specific cast or parameterized generic, then
V
(or any generic parameter) will be assumed to be Obj (not Obj?). So the explicit List.make constructor will essentially default toList<Obj>
. You can work around it like this:As a general principle I think its always best to avoid using List and Map types directly as opposed of their parameterized syntax