LJC Lambdas Hackday
Zhong Yu
zhong.j.yu at gmail.com
Tue Jun 5 11:45:55 PDT 2012
I think the point is that since type inference = implicit typing, when
inference succeeds, there's a danger that the developer and the
compiler have different ideas of the actual types. The smarter the
inference is, the more likely that'll happen.
However, if there's a unique solution to an inference, it's safe the
bet that that is exactly what the developer wants. There is no danger
here for inference to be smart and examining all global constraints.
More constraints will help to reduce number of solutions.
On the brittleness of overloading: the burden is on the author who
adds the new overloaded method - he has to make sure that the meanings
of all invocations of the method remains the same, whether they are
recompiled or not. This is not too hard - usually overloaded methods
are doing essentially the same thing.
Zhong Yu
On Mon, Jun 4, 2012 at 9:31 PM, David Conrad <drconrad at gmail.com> wrote:
> Type inference only happens at compile time, and once types are inferred,
> the usual static type checking takes place. At run time, all the usual type
> safety is there.
>
> At least, that is my understanding.
>
> If you really want to make Java safer, pressure them to reify generics and
> get rid of that awful co- (or is it contra-?) variance on arrays. :)
>
> David
> On Jun 4, 2012 5:47 PM, "Ben Evans" <benjamin.john.evans at gmail.com> wrote:
>
>> On Mon, Jun 4, 2012 at 3:51 PM, Brian Goetz <brian.goetz at oracle.com>
>> wrote:
>> >
>> > The problem with hacking type inference is that it is an endless loop of:
>> >
>> > - Someone finds a case where type inference fails, but the right answer
>> is "obvious"
>> > - Endless machinations and distortions ensue to try and make that case
>> "go away"
>> > - Go to step 1
>>
>> Whilst in parallel, the following timebomb is waiting to go off:
>>
>> Some combination of type inference features provides an undesired,
>> non-obvious result.
>>
>> If not caught in time, the language degenerates into something in
>> which one can only produce unmaintainable crap.
>>
>> Type inference is a real "repent at leisure" part of the spec.
>>
>> Thanks,
>>
>> Ben
>>
>
More information about the lambda-dev
mailing list