RFC: naming for FrontTransversal and Transversal ranges

Robert Jacques sandford at jhu.edu
Fri May 1 23:12:46 PDT 2009


On Fri, 01 May 2009 19:23:45 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> Rainer Deyke wrote:
>> Robert Jacques wrote:
>>> Precisely, so it's always passed by reference and doesn't need to
>>> support copying.
>>  All containers need to support copying.
>
> Speaking of which, I'm thinking of a field like scientific computing  
> (even of the simplest, most basic kind that we all dabble into) or  
> applied math. People who use for example matrices would NOT expect them  
> to have reference semantics. They'd find it very confusing if a = b  
> would not make matrix "a" a copy of matrix "b" and so on. (That + no  
> operator overloading = R.I.P. my excitement for doing numeric work in  
> Java.)
>
> It would work to ask people who actually use Matrix!double to wrap it in  
> a Value!(Matrix!double). But say someone asks, whatever, but if  
> Value!(Matrix!double) is a matrix, then what is Matrix? Well, I'd reply,  
> Matrix is actually a reference to a matrix. Then, they'll ask, why don't  
> you call what you call today "Matrix", RefMatrix or Ref!Matrix or  
> whatever, and call a Matrix a matrix? Um, I don't know. That's what the  
> buzz was on the newsgroup when we were thinking of it. Some said that's  
> what people coming from Java expect.
>
> I guess at that point the would-be D user would be entitled to make me a  
> lavaliere out of my Matrix library and move on.
>
>
> Andrei

I do scientific computing. Generally, I find it breaks down into two  
parts: things under 4x4, for which value types are probably better, and  
everything else, for which value types are to be avoided like the plague.  
I'll often work with 100's mb of data with algorithms that take minutes to  
hours to complete. So an unexpected copy is both hard to find (am I  
slow/crashing because of my algorithm, or because of a typo?) and rather  
harmful, because its big. But I've generally worked on making something  
else fast so more data can be crunched, etc. Actual prototype work (for  
array/matrix based stuff at least) is often done in Matlab, which I think  
uses COW under-the-hood to provide value semantics. So I think anyone  
turning to D to do scientific computing will know reference semantics,  
since they'd already be familiar with them from C/C++, etc (Fortran?).  
Although successfully attracting algorithm prototypes from  
Matlab/python/mathmatica/R/etc is probably bigger issue than just the  
container types, growing the pie was why the Wii won the last console wars.



More information about the Digitalmars-d mailing list