Code Comments
Programming Forum and web based access to our favorite programming groups.On 3 apr, 02:39, "Gerry Ford" <ge...@nowhere.ford> wrote: > "Arjen Markus" <arjen.mar...@wldelft.nl> wrote in message > > news:d9078f0f-d62f-4d3b-8cea-caf6168f563d@e23g2000prf.googlegroups.com... > > > > > > > > > > > > Stepanov thought it was important that one of the above was & and the othe r > was const &. The distinction is lost on me. > > My problem with c++ is that when you take out Microsoft and C, I'm not lef t > with much. The template syntax is, e.g., beyond me. > > I like Stepanov's emphasis on algorithms. I was in a somewhat frivolous mood when I wrote my answer, but indeed Fortran has had generic features at least since FORTRAN 77. There are two important aspects to generic programming: 1. Notational: C++'s templates are one form, smart macros are another 2. Conceptual: creating a sort of meta-algorithm to solve a whole class of problems, not just a particular one (albeit one with lots of parameters) I like the description of the conceptual aspect, I think it captures the essence of what you want to achieve. The notational aspect is just as important, but the two templates you gave are very idiosyncratic to C++: it has to do with passing values/objects by reference or by value (note: in C you _always_ pass by value, but sometimes you pass the address by value, resulting more or less effectively in a pass by reference, but it is up to you to use the asterisk in the right places). As for generic design of algorithms: in my opinion, reverse communication, though it may not seem modern or even have a awkward reputation, is a very flexible solution on the client side to this: You only have to fill in a few blanks in whatever way you find necessary and there you go. A solution with callbacks is much more restrictive. The interface for each callback is fixed. And it does not do much more to hide the details, you still need to fill the blanks. But with the right design, either can do the job. Regards, Arjen
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.