Re: Type inference in extension methods...

"Nicholls, Mark" <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.advanced
Message-ID <B78F55980C30FA439F4A5D1C1E37BAF902332DB9@MTVNE-EXCLUST03.mtvne.ad.viacom.com>
My hunch is the lines

"Otherwise if V is a constructed type C<V1...Vk> and U is a constructed
type C<U1...Uk> then an exact inference is made from each Ui to the
corresponding Vi"...is pretty much what I think it should be doing...

and

"If among the remaining candidate types Uj there is a unique type V from
which there is a standard implicit conversion to all the other candidate
types, then Xi is fixed to V"

I think it's doing the 1st one...but for some reason thinks there may be
2 or more candidates...and failes...when I can't see how there can be
more that 1 candidate.

> -----Original Message-----
> From: Discussion of advanced .NET topics. [mailto:ADVANCED-
> [email protected]] On Behalf Of Nicholls, Mark
> Sent: 16 January 2009 16:09
> To: [email protected]
> Subject: Re: [ADVANCED-DOTNET] Type inference in extension methods...
> 
> It's too difficult to tell....
> 
> I think it should...
> 
> I think it should basically end up doing (roughly) the equivalent of
> 
> A<X> : A<Y> => X==Y...recursively
> 
> This should lead to an answer in my example.
> 
> If I could step through the inference I would stand a chance...
> Or if it said...."I can't infer it because XYZ" then I'd still have a
> chance.
> 
> It's a bit like trying to fix code that you can neither debug or put
> trace statements in. You just put stuff it and it either works or not.
> 
> > -----Original Message-----
> > From: Discussion of advanced .NET topics. [mailto:ADVANCED-
> > [email protected]] On Behalf Of Fabian Schmied
> > Sent: 16 January 2009 15:26
> > To: [email protected]
> > Subject: Re: [ADVANCED-DOTNET] Type inference in extension
methods...
> >
> > Hi Marc!
> >
> > > I've simplified it as much as I can! and created and
> example....Boom9
> > does work...Boom10 wont infer...even though there is a solution
> > (explicitly stated)...and there's not another obvious one
> >
> > The C# compiler's goal is (probably) not to be able to infer the
> > correct solution in every possible case.
> > Instead, there is a defined set of rules the compiler follows. You
can
> > read up on them here:
> >
<http://download.microsoft.com/download/3/8/8/388e7205-bc10-4226-b2a8-
> > 75351c669b09/csharp%20language%20specification.doc>
> > (pages 142ff.).
> >
> > When you've read them, do you still think the compiler should be
able
> > to find the solution in your sample?
> >
> > Fabian
> >
> > ===================================
> > View archives and manage your subscription(s) at
> > http://peach.ease.lsoft.com/archives
> 
> 
> 
> CONFIDENTIALITY NOTICE
> 
> This e-mail (and any attached files) is confidential and protected by
> copyright (and other intellectual property rights). If you are not the
> intended recipient please e-mail the sender and then delete the email
and
> any attached files immediately. Any further use or dissemination is
> prohibited.
> 
> While MTV Networks Europe has taken steps to ensure that this email
and
> any attachments are virus free, it is your responsibility to ensure
that
> this message and any attachments are virus free and do not affect your
> systems / data.
> 
> Communicating by email is not 100% secure and carries risks such as
delay,
> data corruption, non-delivery, wrongful interception and unauthorised
> amendment. If you communicate with us by e-mail, you acknowledge and
> assume these risks, and you agree to take appropriate measures to
minimise
> these risks when e-mailing us.
> 
> MTV Networks International, MTV Networks UK & Ireland, Greenhouse,
> Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions
> International and Comedy Central are all trading names of MTV Networks
> Europe.  MTV Networks Europe is a partnership between MTV Networks
Europe
> Inc. and Viacom Networks Europe Inc.  Address for service in Great
Britain
> is UK House, 180 Oxford Street, London W1D 1DS, UK.
> 
> ===================================
> View archives and manage your subscription(s) at
> http://peach.ease.lsoft.com/archives



CONFIDENTIALITY NOTICE

This e-mail (and any attached files) is confidential and protected by 
copyright (and other intellectual property rights). If you are not the 
intended recipient please e-mail the sender and then delete the email and 
any attached files immediately. Any further use or dissemination is 
prohibited.

While MTV Networks Europe has taken steps to ensure that this email and 
any attachments are virus free, it is your responsibility to ensure that 
this message and any attachments are virus free and do not affect your 
systems / data.

Communicating by email is not 100% secure and carries risks such as delay, 
data corruption, non-delivery, wrongful interception and unauthorised 
amendment. If you communicate with us by e-mail, you acknowledge and 
assume these risks, and you agree to take appropriate measures to minimise 
these risks when e-mailing us. 

MTV Networks International, MTV Networks UK & Ireland, Greenhouse, 
Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions 
International and Comedy Central are all trading names of MTV Networks 
Europe.  MTV Networks Europe is a partnership between MTV Networks Europe 
Inc. and Viacom Networks Europe Inc.  Address for service in Great Britain 
is UK House, 180 Oxford Street, London W1D 1DS, UK.

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.