POV-Ray : Newsgroups : povray.off-topic : new C# stuff : Re: new C# stuff Server Time
6 Sep 2024 15:18:17 EDT (-0400)
  Re: new C# stuff  
From: Darren New
Date: 24 Jan 2009 12:16:57
Message: <497b4d09$1@news.povray.org>
Warp wrote:
>   No. What I said was that I don't see usefulness IN THIS CASE. The
> difference is practically nonexistent. It's only in reordering of
> names.

It lets code generation tools (and LINQ) generate code in one pattern 
(distinguished caller syntax) for both methods defined on the class and 
methods defined outside the class.

It gives you the same benefit that having the name "operator<" available 
does. If you want to do a sort in C of integers, you call
   qsort(myArray, myCompare);
   int myCompare(int a, int b) {return a < b;}

In C++ you call
   qsort(myArray, operator< );
or some such syntax, but without the need to have a specifically named 
function just to wrap up the < operator.

Plus, of course, it lets the same member-syntax function mean different 
things in different places in your code. Here, xyz.Select(...) means one 
function, while there xyz.Select(...) means a different function. This is 
important when "here" and "there" are two compiled libraries from two 
different sources and you're automatically generating the code.

-- 
   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.