POV-Ray : Newsgroups : povray.off-topic : new C# stuff : Re: new C# stuff Server Time
6 Sep 2024 15:21:55 EDT (-0400)
  Re: new C# stuff  
From: Darren New
Date: 24 Jan 2009 14:31:43
Message: <497b6c9f$1@news.povray.org>
Warp wrote:
> Darren New <dne### [at] sanrrcom> wrote:
>> Yep. And now what do you do if the "less" you want to use is actually a 
>> member function of type T?  What if the "less" you want to use is
>> class MyDate {
>>    bool comesBefore(const MyDate& otherDate);
>> }
> 
>   You create a comparator and give that to std::sort. A comparator can be,
> for example, a (regular) function which takes two elements and returns bool.

And that's precisely what the C# syntax avoids you having to do, in the 
other direction.

It's in there most likely because of LINQ, which is a bit of the language 
that turns something that looks a bit like SQL into something that looks 
like method calls. If there were two syntaxes for each possible call that 
LINQ generated, you'd have a mess. So now
   int xyz(this T alpha, U beta)
is a valid overloaded function candidate for
    alpha.xyz(beta)
when alpha is a T and beta is a U.

-- 
   Darren New, San Diego CA, USA (PST)
   "Ouch ouch ouch!"
   "What's wrong? Noodles too hot?"
   "No, I have Chopstick Tunnel Syndrome."


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.