April 30, 2004
On 2004-04-29 22:25:26 +0200, Ilya Minkov <minkov@cs.tum.edu> said:

> If i recall correctly, Matthew has just written a tamplate making dynamic solid ("rectangular") arrays. It is very easy: it maintains one linear array of type, and computes and returns slices of it. It is really not coming close to any C solution by elegance.
> 
> -eye

Is this available somewhere? I was playing with the idea myself, but if someone has already done it...

Drew McCormack

April 30, 2004
"J Anderson" <REMOVEanderson@badmama.com.au> wrote in message news:c6svq5$1a8p$1@digitaldaemon.com...
> Ivan Senji wrote:
>
> >Better operator overloading support is something i agree with! But i can't agree on not having rectangular arrays built-in. Again my example:
> >  image[y][x][2]=b;     // or maybe image[y;x;2]
> >
> >
> I know there are problems with the comma operator but I think the most obvious way for a rectangular array is
>
> image[y, x, 2] =b;

I could live with this. But this is probbably impossible to parse.

> That is what someone learning the language would expect to write for a rectangular array.
>
> --
> -Anderson: http://badmama.com.au/~anderson/


April 30, 2004
"Matthew" <matthew.hat@stlsoft.dot.org> wrote in message news:c6t0fo$1bdt$1@digitaldaemon.com...
>
> "Ivan Senji" <ivan.senji@public.srce.hr> wrote in message news:c6st8r$15eh$1@digitaldaemon.com...
> > "Matthew" <matthew.hat@stlsoft.dot.org> wrote in message news:c6rusd$2ph0$1@digitaldaemon.com...
> > >
> > > "Ivan Senji" <ivan.senji@public.srce.hr> wrote in message news:c6rrks$2kk2$1@digitaldaemon.com...
> > > > "Ilya Minkov" <minkov@cs.tum.edu> wrote in message news:c6robh$2f7q$1@digitaldaemon.com...
> > > > > If i recall correctly, Matthew has just written a tamplate making dynamic solid ("rectangular") arrays. It is very easy: it
maintains
> > one
> > > > > linear array of type, and computes and returns slices of it. It is really not coming close to any C solution by elegance.
> > > >
> > > > I read about it too. And i am sure it is great. But the thing that
> > > > is troubling me is the question: what are/should be basic types?
> > > > We have associative arrays in D but they are far less "basic" type
> > > > then rectangular arrays, so why not true support for them?
> > > > By true support i mean for example creating them dynamically...
> > >
> > > I'm not sure about their being built in, but I believe that there
should
> > > certainly be adequate support in terms of operator overloading such
that
> > the
> > > mechanisms I use in the STLSoft arrays would not be necessary.
> >
> > Better operator overloading support is something i agree with!
> > But i can't agree on not having rectangular arrays built-in.
> > Again my example:
> >   image[y][x][2]=b;     // or maybe image[y;x;2]
> >   image[x*3+y*XRES*3+2]=b;
>
> I don't suggest that at all.
>
> > Wich one is something you would like to write, surely not the second
one!
>
> Not an issue. I propose having classes with the necessary operator
overloading.
>
> > Some people need these types a lot, and it is a big limitation to have to know arrays size at compile time, this is often not possible, and even if it is, there is no way to test if the allocation was
succesful.
>
> Not what I'm suggesting. I am suggesting that there would be classes that
would
> have their sizes determined at runtime, just as with stlsoft::fixed_array. However, I am starting to think that built-in is best. ;)

So the best solution would be to provide better operator oveloading, and add built-in rectangular arrays so they would work in a natural way.

I think there is analogy: associative arrays and map. Sometimes you need
the aditional functionallity so you use map but sometimes good old
associative array
is good enough :)





April 30, 2004
Ivan Senji wrote:
>>I know there are problems with the comma operator but I think the most
>>obvious way for a rectangular array is
>>
>>image[y, x, 2] =b;
> 
> 
> I could live with this. But this is probbably impossible to parse.

I could too.

As for parsing, is there any compelling argument for keeping the comma operator?  The only place I have ever (sanely) seen it used is in for loops, and I don't think it's particularly pretty even then.

 -- andy
April 30, 2004
I find it very useful for small function bodies:

    bool func(X *px)
    {
        return (NULL == px) ? false : (px->method(), true);
    }

But I concede that that's only sugar. A more compelling need is when initialising const variables and class members in member initialiser lists.

    class Thing
    {
    public:
        Thing(thing_t x)
            : m_member1((ThingApi_Init(), ThingApi_Alloc(x))
        {}

    private:
        thing_t const    m_member;
    };

but this is not needed in D.



"Andy Friesen" <andy@ikagames.com> wrote in message news:c6u1n2$10v$1@digitaldaemon.com...
> Ivan Senji wrote:
> >>I know there are problems with the comma operator but I think the most obvious way for a rectangular array is
> >>
> >>image[y, x, 2] =b;
> >
> >
> > I could live with this. But this is probbably impossible to parse.
>
> I could too.
>
> As for parsing, is there any compelling argument for keeping the comma operator?  The only place I have ever (sanely) seen it used is in for loops, and I don't think it's particularly pretty even then.
>
>   -- andy



April 30, 2004
http://stlsoft.org/download.html - get the latest beta. The files are stlsoft_fixed_array.h and stlsoft_frame_array.h. These have been recently upgraded for speed and kick the pants of Boost's multi_array (which they did before, actually, just more so now).


"Drew McCormack" <drewmccormack@mac.com> wrote in message news:c6t695$1jcd$1@digitaldaemon.com...
> On 2004-04-29 22:25:26 +0200, Ilya Minkov <minkov@cs.tum.edu> said:
>
> > If i recall correctly, Matthew has just written a tamplate making dynamic solid ("rectangular") arrays. It is very easy: it maintains one linear array of type, and computes and returns slices of it. It is really not coming close to any C solution by elegance.
> >
> > -eye
>
> Is this available somewhere? I was playing with the idea myself, but if someone has already done it...
>
> Drew McCormack
>


April 30, 2004
"Matthew" <matthew.hat@stlsoft.dot.org> wrote in message news:c6u9ng$en4$1@digitaldaemon.com...
> http://stlsoft.org/download.html - get the latest beta. The files are stlsoft_fixed_array.h and stlsoft_frame_array.h. These have been recently upgraded for speed and kick the pants of Boost's multi_array (which they
did
> before, actually, just more so now).
>
>
> "Drew McCormack" <drewmccormack@mac.com> wrote in message news:c6t695$1jcd$1@digitaldaemon.com...
> > On 2004-04-29 22:25:26 +0200, Ilya Minkov <minkov@cs.tum.edu> said:
> >
> > > If i recall correctly, Matthew has just written a tamplate making dynamic solid ("rectangular") arrays. It is very easy: it maintains
one
> > > linear array of type, and computes and returns slices of it. It is really not coming close to any C solution by elegance.
> > >
> > > -eye
> >
> > Is this available somewhere? I was playing with the idea myself, but if someone has already done it...
> >
> > Drew McCormack
> >
>
>

I think jagged arrays and dynamic arrays should be part of the language. It's one of those things that programmers expect to find in a language. It's basic stuff.



May 01, 2004
On 2004-04-30 21:34:16 +0200, "Matthew" <matthew.hat@stlsoft.dot.org> said:

> http://stlsoft.org/download.html - get the latest beta. The files are
> stlsoft_fixed_array.h and stlsoft_frame_array.h. These have been recently
> upgraded for speed and kick the pants of Boost's multi_array (which they did
> before, actually, just more so now).

Hi Matthew,

Have you got anything written in D? Any plans to create similar D classes?

Regarding the C++ versions, how do they compare to Blitz++? Do you use expression templates, or is it a straight multidimensional array setup like Boost?

Lastly, in your experience, do you see any problems with writing similar classes for D? Are the templates in D powerful enough? I assume they are just as powerful or more powerful than C++, but...

Drew


May 01, 2004
"Drew McCormack" <drewmccormack@mac.com> wrote in message news:c6vuok$2s0v$1@digitaldaemon.com...
> On 2004-04-30 21:34:16 +0200, "Matthew" <matthew.hat@stlsoft.dot.org> said:
>
> > http://stlsoft.org/download.html - get the latest beta. The files are stlsoft_fixed_array.h and stlsoft_frame_array.h. These have been recently upgraded for speed and kick the pants of Boost's multi_array (which they did before, actually, just more so now).
>
> Hi Matthew,
>
> Have you got anything written in D?

std.windows.registry
std.recls
std.loader
std.mmfile
std.perf (not out yet)

I've also done several tools which may be included with Phobos as samples when I get the time to present them to big-W.

> Any plans to create similar D classes?

Yes, I'm writing the DTL (D Template Library), a library of template containers,
interfaces, algorithms and mixins, which will support enumeration by foreach,
iterators and user-customisable interfaces (a la Java, .NET), as well as ranges
via mixins (all described in detail in other threads).

Unless someone else works on one, it stands a reasonable chance of becoming the D standard container/algorithm library, unless someone else beats me to it.

The current status is that it's waiting for fixes and enhancements to the compiler (and the language), which Walter is working on at the moment.

> Regarding the C++ versions, how do they compare to Blitz++?

Don't know. I'd be interested to find out. Do you want to do some comparative tests? That'd be great.

I won't be too upset of Blitz is better. It's dedicated to scientific stuff, is it not, whereas STLSoft is more general purpose.

> Do you use
> expression templates, or is it a straight multidimensional array setup
> like Boost?

It's an even more straightforward array setup than Boost's, hence the performance advantage. (It also works with a lot more compilers.)

> Lastly, in your experience, do you see any problems with writing similar classes for D?

Some, but I believe they can all be ironed out.

> Are the templates in D powerful enough?

I think the answer is probably yes. But we all have to make the adjustments to lack of implicit instantiation, etc. It just requires a different way of looking at the problems.

A good example is the DTL. My C++ brain told me that iterators were the way to go, but with D's fundamental enumeration construct being foreach, it has transpired that adaptation of containers via mixins based on the container's opApply() (the method that facilitates the foreach statement) is the way forward. This is very much like Ruby's Enumeration mixin (http://ruby-lang.org/)


> I assume
> they are just as powerful or more powerful than C++, but...

Yes, but in different ways. We are all just learning about the ramifications of this.



1 2
Next ›   Last »