Primitive Queue<any T> considerations
richard.warburton at gmail.com
Wed Nov 18 19:18:25 UTC 2015
I'm not sure about the default null-indicator because every time a queue is
> needed in our library, that can serve a source with unique choice of a
> default-null value. It is unlikely the users of the library want or can
> specify that all the time.
I appreciate that this is diverging directly form your language related
question, but it is pertinent to writing anyfied collections using
Valhalla. My experience using primitive specialised collections is that it
has always been possible to have a sentinel value, though obviously my
experience won't necessary reflect that of every single person in the Java
community. It isn't always appropriate for it to be 0, which is what I
think T.default is currently going to return for primitives and when I've
done primitive specialised collections before they allow you to specify the
missing value sentinel.
Have you got of an actual genuine use case where a sentinel value doesn't
work well, rather than a theoretical "hey, maybe you want to have a set
that contains every possible int?"
More information about the valhalla-dev