alternatives or complements to layers

Peter Levart peter.levart at
Wed Jan 7 14:24:52 UTC 2015

On 01/07/2015 03:03 PM, Simon Ochsenreither wrote:
>> The other option is to fail compilation if any-T context is calling a non
>> any-fied method and require user to do a cast on their T to select the
>> proper overload (including possibly casting to Object).  I don't know if we
>> want the method "late bound" like that.  Also, suppose the different
>> overloads return different types - the writer of code has to know what the
>> type will be upfront.
> I think the interesting question is "is there a reason why an any-fied
> parameter couldn't act as a compatible replacement for methods with
> Object + primitive overloads?". Because that's what any does under the
> hood already: Create additional methods for non-reference types.

It creates additional method signatures, yes, but not additional bodies 
that would differ - I said that such a feature could be viewed as a 
complement to layers.


More information about the valhalla-dev mailing list