> A Standard Template Library that doesn't keep up with C++ (a la the stable trunk of GCC),
Pardon my bluntness, but gcc is not C++. It is gcc that is supposed to be keeping up with C++, not the other way around, and the C++ standard has not changed in years.
> that has but one developer, that has not seen a release since Q3-2006, well...
Well, that's because it's more or less done. The library has a standard, well-defined interface, mostly derived from the C++ standard. The interface is complete and I do not expect to add any more features; it's meant to be a small library, not the kitchen sink. I have a few changes in the queue, mostly additional size optimizations, and a few very minor fixes, but I have a hard time justifying another release. Maybe in a few more months.
Another way of looking at it is that the code is of excellent quality, and doesn't need to be fixed very often.
> Pardon my bluntness but that's not really such a loss.
Me? A loss? I doubt that my absence will be particularly noticed or missed. I was simply pointing out that I am not the only one and lots of developers can add up to a lot of projects, code, and effort, of which mine is just a small part. You might not miss just me, but will you notice when they all pack up and leave your GPLv3 la-la land? I rather think so.
> I'm sure you have your reasons. I haven't seen them enumerated here;
That's a whole other discussion, and a redundant one at best, since thousands of Slashdot comments have already enumerated those reasons. Here, it is irrelevant. My only point is that I will not use a GPLv3 gcc, and that may affect you if you want to use my code. Note that I am in no way obligated to support your GPLv3 platform, any more than I am obligated to support Windows, or PDP-11, or whatever other obscure thing you may be running.
Generally, yes, but I do not find it quite as offensive. Linus's arguments are pretty much the same ones I'd give for the difference.
I will already not contribute any code to a GPL project, although I have helped a few, including gcc, with testing, code review, and bug reports. But GPLv3 really crosses a line for me, so I don't want to touch it at all in any manner.
> Just out of curiosity, if someone sent you a patch with changes to make the > library work with a GPLv3 GCC, would you merge them into your official code base?
Probably no. That rather depends on the patch. Let's say gcc 5.4 has some nifty new warnings that tell you how to rearrange your code to make it compile smaller, even with gcc 4.2.1. I would merge such a change. But say gcc 5.4 has decided that __attribute__ syntax is no longer acceptable and changes it to some other mechanism, like back to #pragma or whatever. I would reject such a change.
> I suppose you could make the argument that you cannot test them, so provide > an alternate unsupported version... But would you even do that?
No, I would politely tell them to maintain their own version, if they feel like it. I may help them out if they need something explained. I might even link to it. There is already one such fork, for the Symbian project, which I decline to merge into the mainline. There are numerous very platform-specific things in it, and I have no interest in supporting such a marginal platform. The only burden in this scenario lies on the maintainer of the fork, and it is not a very heavy one, since the library code has been quite stable for a while now. I make releases once a year or so, and pulling my changes into a fork should really not be that hard. The Linux kernel maintains several trees in this manner, so this development model is very well tested and established. Now, if I could only switch to git...
> You're holding them hostage. If they rely on your uSTL, they may be > prevented from moving to a later version of gcc.
Not at all. They are welcome to make whatever changes, if any, that are required to make it work. And, since uSTL is distributed under the MIT license, doing this places no obligations on them for doing so. I think that is quite reasonable and quite a bit more than what you'd get from a GPL'ed project.
> Given that, I'd only use uSTL if I was willing to maintain it myself
That's true of all OSS projects. I will probably keep maintaining uSTL, but there is no reason for you to expect that. Most projects are eventually abandoned. Some get new maintainers, some just vanish into black holes on SourceForge. This is true of commercial software as well. Microsoft could go out of business in five years and then where will your Windows installations be? At least with uSTL, like with all other open source projects, you get the option of maintaining it yourself. It is better than having no such option, as with commercial software, and is one of the main reasons for using open source software in the first place.
> What makes you think there's going to be three people (including you) who will > boycott new gcc versions because they don't like the license?
The american entrepreneural spirit. In this country we have been traditionally opposed to communism in all its forms, preferring our free market society. It may be changing now, but most people still hold such beliefs, and will instinctively revile GPLv3, which is profoundly anti-business.
> No, they're expected to have at least an occasional desire to contribute,
Or be branded "freeloaders" and face social ostracism from the community. Oh, sure, it doesn't matter much to me, since I couldn't care less what GPL fanatics think, but I'm obviously not a member of that community. If I were, the pressure would be far more real. This is rather beside the point though. The point is that you get no incentive for doing your work. No, "getting excellent software" is not an incentive, because one, it isn't that good, and two, you get it anyway, whether you contribute or not. I was born in the Soviet Union, so I know exactly how this works. Everyone gets paid the same, no matter how much they work, so nobody works. That's communism for you.
> The FSF is quite insistent on the ability to sell GPLed software
In theory, but not in practice. Read my earlier rant on this subject. Hell, you can even get it from the horse's mouth; RMS himself repeatedly states that his most cherished goal is the destruction of all commercial software.
> So, why are you maintaining a free software project (or, if you prefer, open source)?
Because it isn't worth anything. You just go and try setting a reasonable price for uSTL. Would you pay $10? $5? How about $1? No? I didn't think so. You can't compete against free. Sure, I believe my implementation is a very good one, but would anyone really care? Yes, you can reduce C++ overhead by a factor of four if you use uSTL, but in today's world of terabyte hard disks and gigabyte RAM sticks, nobody cares enough to pay any money for such a reduction. Another reason is that it isn't really my work; I only implemented a standard, there isn't that much original work in it. I wouldn't feel correct in charging money for something I didn't do.
I keep it open source because it costs me nothing. I don't really gain anything from it. I've had perhaps less than ten bug reports in the entire lifetime of the project. Nobody contributed any code. So why bother? Because someone might write some good software with it. Something nice, small, and blazingly fast. Sure it hasn't happened yet, but it might, and it costs me nothing to keep the project on SourceForge.
Note that I did not say that the "nice, small, and blazingly fast" project
> Fair enough, it's your right to throw a tantrum and stamp your little foot > if you want, but it's purely political showboating on your part.
Well, of course it is. That's what all protests are. Sometimes it pays to keep your seat on the bus for a better cause, and sometimes it furthers that cause.
> and your crocodile tears for your poor users are thoroughly specious, since you're the one holding them hostage
That's not exactly true. I am not holding them hostage; I am giving them a choice - GPL3 software or me. A perfectly free choice, just like the one GPL projects give their users to not touch their code or switch to GPL. Turnabout is fair play.
> It's a massively unprofessional attitude of you, you are cutting off your project's nose to spite your users' faces
Not at all. I am simply exercising my right to choose whom I do business with. Some forms of discrimination are illegal, such as on race, sex, or religion, but discrimination against GPL fanatics is still perfectly legal. The result of my actions is that people in the GPL camp would be less likely to use my project (in the hypothetical long run, anyway; a GPL3 gcc hasn't even been released yet), which suits me very well. I fully expect normal people to follow suit and boycott all GPL3 software, and those people (who are precisely the sort for whom I would most like to write for) will never have any problems compiling my projects. I call this getting exactly what you deserve.
> we could really do without someone whose ego so far outweighs their desire to contribute.
Indeed you could, because the premise of FSF's communist philosophy dictates that nobody is allowed to have an ego of any kind. If you join their commune, I wish you luck, because its members are expected to have a perpetual "desire to contribute" without getting anything in return. For myself, I prefer the capitalist system, where I am paid for my efforts instead of being a penniless slave to society.
> And example are the ads in Circuit Cellar magazine or Cycle World magazine.
Magazines? Somebody still reads those?
> Yes I may be looking for a new AVR programmer when I see the ad in Circuit Cellar. > Of course I will do some research but how else will I know that the company exists?
By doing a Google search for what you want, of course. Every company has a web site these days. This will show you all the companies available, not just the one whose ad you happened to see. How will you know if the company is any good if not by comparing it with its competitors? What's needed here, is not advertisement, but a global directory of companies, where you could search by type of good and see a list of all brands, with prices and a short commentary. There are some web sites that try to do this, but they are not as complete as I would like.
> When reading Cycle World I might see a company offering a really good price on Shoei helmets this month.
Or, you could have checked eBay for what the best deal is this month and gotten an even lower price for it. On eBay you can see all the other prices it's compared with too. Can you do that in a magazine ad? I thought not.
> However isn't a company that sells you exactly what they advertise > the kind of company you want to do business with?
I would rather do business with a company that doesn't waste money on advertising and instead spends time on putting truthful and complete information on their web site. With prices, dammit!
> There was no policy change between 3 and 4 with respect of aliasing.
The change I am referring to is the new error you get when you alias a pointer and then dereference it. I use it extensively in my library to generate more compact code. For example, if you have a struct with two shorts in it, an implicit copy constructor would be created with four movw instructions. By casting the pointer to the struct to an int, you can write a copy constructor with only two movl instructions. This technique worked fine in gcc3, but gcc4 gives an error because it is more aggressive in rearrangements and the generated code will not work in some cases. I have to do various asm workarounds to make it work.
> GCC is now more able to take more advantages of what the standards say about aliasing.
And I am quite happy about that. I just want the ability to turn it off for a specific code block, which is not currently possible.
>> Since I am strongly opposed to GPLv3 and anything that uses it > You mention this but without any backing of why.
I have no interest in repeating the same tired arguments over and over. Hell, you can see hundreds of them in every post on GPL3. Go and read them.
> Then are you paying for a Slashdot subscription?
Damn right, I am. I just don't usually take the bonus because nobody wants to moderate subscribers.
> I block ads also but I understand that they put the food on the table and provide for hosting space and bandwidth.
If there were no advertisers, the web sites would figure out other ways to earn income, like by paid subscription or by selling various bonus services. I will pay for a subscription if I like the site. I have one here, and I have one on SourceForge. This covers the news and my hobby projects. I'd pay for a generic news site too, but all the ones that offer a subscription are crap.
> Ads are not in themselves evil or even all that bad.
Oh yes they are. The very premise of advertising, that you can sell your stuff to people who don't initially want to buy it borders on brainwashing and is extremely offensive to me.
> I don't think people really hate most Google ads since they are just simple text.
I never notice Google ads, since Google is nice enough to put them off to the side. Since I never read them either, companies should just stop wasting their money on them.
> then this kind of content will not be available. At least not for free.
So what? It's ok to charge money for what you do. That is how capitalism works in the real world. Look at food; you have to pay for it, but most americans are fat anyway. I predict that if we did away with all ads, the quality of online content would go up dramatically.
> Please make sure to put that in big bold letters on your web page,
If you visited the site, you'd see that I already did.
> so people know they have to migrate or fork your project.
Oh, please do! Unlike the members of the GPL camp, I love it when people use my code. After all, what other reason can there be for publishing it? It is all under the MIT license, which, unlike the GPL, does not tell you what you can not do with the code, so you can fork, fudge, or make a profit from it, all of which are perfectly ok with me.
> This weekend I have to look for an STL implementation with bounds checking. > Now I know not to bother looking at yours. Thanks.
Well, that's your loss, because uSTL does indeed have bounds checking.
Techies are known for a negative attitude toward advertising. I know I always block all ads on every site. If I see an ad, I automatically right-click and block it. If an advertiser does manage to get my attention after all, I am going to hate him so much for it that I wouldn't buy the product no matter how good it was or how much I wanted it. My guess is that the majority of people here feel the same way. We hate ads. We hate spam. We hate being sold to, period. And this isn't because we don't buy anything; we do. I buy lots of things all the time, but I will never base my decision on an advertisement. I'll do some research, decide what I want, figure out what quality level is acceptable, and then find the lowest price that fits those criteria. As a result, I am not a target demographic for advertisers, because to send me ads is counterproductive. Hence Alexa, which, by its method of measurement, naturally excludes the people like us, is a very useful tool to give advertisers what they want. It's that simple.
> this begs the question: What does GCC's license have to do with your code's license?
Why, nothing, of course. The effect of the gcc license in my case is not that it would directly affect my project, but rather that my project is affected by the fact that I don't want to use a GPL3 gcc or any other GPL3 software.
> I strongly doubt that there are many other people in the world who are > sufficiently obsessed with hating GPLv3 that they'll go through contortions > to avoid using any application with that license.
Be serious. Avoiding a particular version of gcc and refusing to support it can hardly be called "contortions". Avoiding other GPLv3 software is no more difficult; there is no loss of any kind since everything anyone needs is available under a non-evil license. The only loss sustained here is that of the GPL community losing users and developers, and I doubt there are many tears shed at FSF over that.
Possibly, but not legal ones
on
GCC 4.2.1 Released
·
· Score: 4, Interesting
I maintain a more or less portable OSS project (uSTL - an STL implementation) and I have had to make at least a few changes for each compiler release. Sometimes it happens due to new warnings that catch potential bugs I didn't know about. Sometimes it is due to policy changes (like the stricter aliasing rules in gcc 4), and sometimes there are new features I want to take advantage of.
Since I am strongly opposed to GPLv3 and anything that uses it, I am not going to upgrade my gcc any further than 4.2.1, which I'll probably do today. This means that uSTL, and my other five projects on SourceForge, may have problems compiling on later gcc releases, even though I will not intentionally put any incompatibilities in my code. Not being able to predict the future, I don't know whether these problems would be minor ones or major ones, but I do know that unless they expose some fundamental problem with my code, I will reject any bugs related to them and state explicitly that any gcc > 4.2.1 is not supported and never will be.
Now, you probably wouldn't care about this. After all, I only had a few thousand downloads - a minute fraction of the developers in the world. And you might say "oh, who needs this guy's code anyway?" But I have a feeling I'm not the only one, and I do occasionally contribute to projects other than my own. Perhaps you don't care if you lose my skills and the skills of all those other developers, but I suspect that they do all add up to quite a bit, and while you might not notice it at first, the GPLv3 camp might get lonelier and emptier as time passes.
> But part of me wishes that the majority of consumers in the U.S. would shop based > on the quality of products and services, not just the price.
There is a point when quality no longer matters because even the cheapest products are good enough. For example, I can go to the grocery store and have a choice of buying a brand name hunk of cheese for $6 or the store brand for $3. Since I can't tell the difference anyway, there is no reason for me to buy the more expensive product. Even when we look at products where durability matters, like, say, hard drives, the cheapest is usually good enough. All three hard drives in my machine were bought based entirely on price and are still running just fine after five, four, and three years. Sure, you say, just wait until one of them crashes. Yes, there is that risk, but considering that I keep regular backups, have no seriously critical data, and have never seen a hard drive crash, I consider the risk acceptable. I could go on, but it should be clear to anyone that the cheapest is usually good enough, and always buying "quality" in their stead is a waste of money.
> It may surprise you to learn that the two are not mutually exclusive.
Perhaps not, but I am forced to repeat myself that jobs in which mathematical research is required are very rare. Most programmers will never encounter such requirements.
> In any case, by your argument people should stop doing science and mathematical degrees > altogether unless they intend to go on to doctoral research, because most people will > never use the advanced mathematics, physics, chemistry, or whatever they learn in an > undergrad degree otherwise. Of course, this completely ignores the benefits of studying > a subject at undergraduate level beyond rote learning, such as understanding different > approaches to solving problems
Oh, please! You don't go to college to learn things. You go to college to get a degree. If you want to learn something, go to the library. Everything I learned in college, I learned there. Classes are useless; I can read the book by myself, thank you very much. The professors are of no help outside of class either, even if you manage to get to see them. In fact, the only reason to take any science classes at all is for the labs, where you can get practical xperience. Yes, I spent a lot of time in the chemistry labs even though I was a CS major, and it was time well spent. But any classroom time? A total waste.
>> The so-called multithreaded algorithms are little more than hot air. > What a very sad, narrow-minded view. Maybe if you studied a little more about the formal > models underlying programming,
I have studied them, thank you very much.
> No-one questions the usefulness of optimising compilers
Optimizing a code for a processor is an entirely different task from making non-threaded code run on multiple processors. The former is a mere technical algorithm, applying a bunch of little rules. The latter requires MAJOR code changes on the global level. There is no way you are ever going to take an algorithm and parallelize it without making some serious architectural changes to the entire application. It's just like a "computer scientist" to think about everything as an algorithm. Parallelization is a problem of program structure and cannot be solved by any amount of local tweaking. You have to set up data splitting and merging, flow control, and checkpointing, all of which are not generalizable for different types of data.
> Yeah, that PageRank thing is totally useless. I don't use it more then 20 or 30 times a day.
I said in the last decade. Google was founded in 1998, so I presume PageRank is a bit older than that.
> Bayesian spam filtering? Nobody uses that.
Bayesian methods have been around for centuries. Applying them to spam filtering is new, but it is more of an implementation detail than any significant research breakthrough.
> Sure, the rendering itself is fairly straightforward, but how do you decide what to > render? And yes, I do do this for a living, and the maths and algorithms involved in serious CAD
So why didn't they just hire a mathematician to do that job? Programmers write programs, mathematicians do the math.
> You might be. The rest of us are talking about Computer Science.
Ok, let me clarify. The article is talking about maths in undergraduate CS degrees. Most people who have a BS in computer science will not be doing research; they will be programmers, which, I suppose is software engineering. I will not argue with you that someone with a PhD in CS should know higher maths, that is what they do. There are very few jobs out there that will require that sort of skills, but somebody needs to do them. However, there is no point in teaching maths to undergraduates, who will be programmers, not researchers.
> Sure. So tell me again the theory of how to get a compiler to automatically > subdivide work and hand out chunks to different threads
There isn't one and only a "computer scientist" thinks there is going to be. To take proper advantage of multiple processors, you need good software engineering practices of proper design, good abstractions, and solid structures, none of which require higher maths do to. The so-called multithreaded algorithms are little more than hot air.
> If a man only strings together components written by computer scientists
There are no components out there written by computer scientists. Computer scientists make algorithms that a real programmer has to implement. You wouldn't expect a computer scientist to know anything about performance optimizations or code readability.
Next, there are only a few components out there that have any algorithms. Numeric computaion is an extremely small part of any application. You might be reading jpegs, or decompressing zips, or decrypting something, but you don't write those libraries yourself and you don't need to know precisely how those algorithms work. The greatest bulk of your work will involve moving data around and interconnecting objects, and that is what all programmers need to know how to do, no mathematics.
>> Chances are, nobody will have to maintain what you wrote > Some developers whose projects I have inherited over the years had that exact attitude.
Yes, and many of them will have had CS degrees... Cause and effect? Perhaps.
> If your argument is that modern "programmers" are not (and need not be) _capable_ of > doing anything more than assembling pre-made components, let's call them something else.
It's funny you say this, for that is exactly what I think computer scientists are. After all, their work involves neither computers nor science.
As for pre-made components, I'll repeat myself that if you ever worked as a programmer, you'd know that there are very few pre-made components you can assemble. Most of the time you write stuff yourself, and no, you don't need higher mathematics for any of it.
> Your comment makes sense, but my previous job goes against what you said. > Performance and business analytics require math. A lot of it.
As I keep pointing out, this is not a programming position, it's a research position. Yes, there are a few jobs available where you will do research of some kind, analyzing data and making conclusions from that data. My point is that the vast majority of programming jobs out there are involved with making software, not with data analysis. The vast majority of CS graduates will not be doing research and have no interest in doing research, so it is pointless to make them learn higher maths. For a data analysis position you really should not be hiring CS people anyway; hire a mathematician, because that is the sort of job they are good for.
I'm more than happy to add predicate calculus to the list of maths a programmer does not need to know. Thank you for your contribution.
> If you are doing any serious statistics, please consider using gnumeric instead.
If you are using Windows, you are going to be using Excel because that is what comes with it. Whether to use MS Office or free software is company policy.
> I hate to break this to you, but no. Drawing in 3D is often heavily supported by > hardware and coded using libraries like OpenGL or Direct3D. But how do you think > these libraries know where to put things?
Having written a software renderer myself, I am very well aware how such libraries work, and I can tell you that very little higher math is involved in making them, and all that math has already been done. Yes, you need to know a bit about linear algebra, like how matrices work, and have some idea about vector transforms. But you only need to know how to visualize what you are doing and how to implement it, you will not be doing proofs and you will not be doing any theoretical research. All the formulas for transforms, matrix operations, viewport building, clipping, lighting, are already easily available at your local library and on the net. If you want to write your own renderers, you'll need to know a bit about calculus and how to use derivatives to manually step your iterators. But that's all. All your lambda calculus, discrete maths, set theory, group theory, and all other mathematical garbage are of no use here.
> And who did you think newer versions of the libraries themselves grow on trees?
My point is that the vast majority of programmers use libraries, not write them. There might be a small niche for a mathematician on a library development team, but that's a negligibly small market for such skills.
> OK, but we're not talking about Software Engineering, we're talking about Computer Science.
No, we are talking about Software Engineering, which is what most people here do. Yes, universities employ a few thousand professors that do computer science, but that requires an entirely different education path through a PhD, focusing on theory. Most programmers are programmers, and have no need for higher mathematics, which is the point made in the article.
> And you'd better hope the people who are doing that have sound theoretical bases for the models they adopt.
Bullshit. Nobody has developed anything useful in the field of computer science in more than a decade. All the higher-level theory has been done already. What really sucks is the implementation of those theories, and part of the reason that implementations suck is that ivory tower academics developing those theories are so stuck in their higher math, that they are ignorant of the problems of the real world and the implications for their theories that those problems impose.
> Tell me about it --- just a few days ago, I had to give myself a refresher on > complex probability and statistics (specifically, binomial probability and related > distributions) to analyze some advertising data.
You are not writing an application, you are doing research, which makes you an academic, at least in this particular instance. Chances are, nobody will have to maintain what you wrote, so you could write the whole thing in FORTRAN or APL, or whatever. You are simply illustrating my point is that writing software for real people is very different from writing little programs for research.
> Agreed, for the most part. Lack of object ownership is a big problem. > People's eyes tend to glaze over when you start talking about it, though
The existence of stupid people is not a good argument for a language feature.
> That said, there are times when reference counting is the right solution --- consider graphs!
That's right. Consider graphs, and discard them. If you need a graph for anything, you are already in deep dudu because you haven't optimized object relationships. That said, if you really think you have a graph-like structure, the graph should not own the nodes. Put the nodes in an array and use another array to store links. This is the proper ownership structure for this problem. The benefits include not having to worry about memory management, an automatic incentive to implement inversion of control (which you probably will want eventually in this situation), less template bloat because the link array will probably be type compatible with something simpler, easier database integration (this is how you do many-to-many relations there), faster node lookup (links are smaller than the nodes, and so the lookup array has a better chance of fitting into cache), and easier debugging (you can dump the graph nodes or links in a simple loop).
> Also, I don't see what memory ownership has to do with locking. > An object might be owned by another, yet accessed from a different thread anyway.
Use your abstraction skills, man!:) When you have objects shared between threads, you have not properly defined object access rights, which are a part of defining ownership. Ideally, you should not share data between threads at all. Data flow should be one way. You create a data packet, give it to a thread, the thread processes the packet and notifies you when it's done. If you need to access data from more than one thread, it usually means you need to combine that code in a single thread. If you don't, lock contention will wipe out any performance gains you might have had from parallel processing.
> [snip rant about template bloat] > Those are all compiler problems, not language ones.
Not always. When you create a bound function, you have to instantiate an object, which is indeed a language requirement. Yes, sometimes a trivial constructor can be inlined, but you need to look at the assembly every time to make sure it happened.
> Agreed, as far as abstraction goes, but this is really getting into an argument about > object-oriented versus generic programming. Okay, say you're using a compiler that > can't optimize the call through the member function pointer, and you have to use an > indirect call. How is that differently, exactly, from calling a virtual function through > a vtable (which is what I imagine your abstraction layer doing) in terms of performance?
A virtual call generates less code than a member call by pointer, but that's not really where the problem is. The real difference is that generic programming generates more code. Every time you instantiate an algorithm, you essentually cut-n-paste all the code in it. Templates eliminate the errors inherent to cut-n-paste programming by doing it automatically, but you still have code bloat. In the approach I am advocating you have true code reuse, not just in the source, but in the compiled executable as well. Once you realize that it is possible to do everything just as simply by creating proper abstractions, generic programming ceases to have any benefits at all.
In general, the proper use of templates is type safety, not code duplication. Yes, it is occasionally useful to have a templated function; I have written quite a few of them. You just need to realize that it is cut-n-paste programming and is not a substitute for correct design.
> Can you give me an example of a better abstraction setup, one that doesn't incur these penalties, but remains reusable?
> take a look at boost for C++. It makes working with the STL (even with member functions) a breeze.
No it doesn't. Using algorithms with bound templates in boost is no different than using them with STL. It in no way addresses the problems with member functions and general bloat problems when using binds of any kind. With member functions I still have the same gripes. First, you have to specify the fullly qualified name, which is not fatal, but creates more code to read. Second, when you bind a member function by pointer, you call it by pointer, which incurs runtime overhead of at least four extra instructions per call, a branch misprediction, and a cache miss due to that. Yes, sometimes the compiler can figure out which function you are calling and use a direct call, but that is rare. Third, you seldom just call a member function; you call it with some argument, which necessitates the use of bind objects, which are never inlined due to object construction requirement. And, finally, there is the readability issue. Functional, LISP-like syntax is what makes math-oriented academics comfortable, but it makes normal people scream. The resulting hit in readability and performance makes binding a really bad idea. It is always better to create a proper abstraction by examining your class hierarchy and creating a generic, non-templated algorithm that works on everything. Yes, this is always possible! If you think you can't, check your assumptions.
> shared_ptr,
Love of refcounted pointers and garbage collection are a sure indication that you have no idea how to define object lifetime. An experienced programmer knows that it is essential to know who owns what object and how long they live. This is not just a memory management problem, it is also a threading problem. Locks and lots of shared objects are symptoms of the same thing. Once you strictly define object ownership and lifetime, you'll quickly discover that garbage collection is unncecessary, refcounted pointers are not needed, and all threading problems disappear.
> lambda libraries.
Suffer the same problems as binding, as outlined above. Additionally, this capability encourages turning C++ into LISP, which is the treasured goal of academics, and is utterly despised by all real programmers.
> A Standard Template Library that doesn't keep up with C++ (a la the stable trunk of GCC),
Pardon my bluntness, but gcc is not C++. It is gcc that is supposed to be keeping up with C++, not the other way around, and the C++ standard has not changed in years.
> that has but one developer, that has not seen a release since Q3-2006, well...
Well, that's because it's more or less done. The library has a standard, well-defined interface, mostly derived from the C++ standard. The interface is complete and I do not expect to add any more features; it's meant to be a small library, not the kitchen sink. I have a few changes in the queue, mostly additional size optimizations, and a few very minor fixes, but I have a hard time justifying another release. Maybe in a few more months.
Another way of looking at it is that the code is of excellent quality, and doesn't need to be fixed very often.
> Pardon my bluntness but that's not really such a loss.
Me? A loss? I doubt that my absence will be particularly noticed or missed. I was simply pointing out that I am not the only one and lots of developers can add up to a lot of projects, code, and effort, of which mine is just a small part. You might not miss just me, but will you notice when they all pack up and leave your GPLv3 la-la land? I rather think so.
> I'm sure you have your reasons. I haven't seen them enumerated here;
That's a whole other discussion, and a redundant one at best, since thousands of Slashdot comments have already enumerated those reasons. Here, it is irrelevant. My only point is that I will not use a GPLv3 gcc, and that may affect you if you want to use my code. Note that I am in no way obligated to support your GPLv3 platform, any more than I am obligated to support Windows, or PDP-11, or whatever other obscure thing you may be running.
> Are you also opposed to GPLv2
Generally, yes, but I do not find it quite as offensive. Linus's arguments are pretty much the same ones I'd give for the difference.
I will already not contribute any code to a GPL project, although I have helped a few, including gcc, with testing, code review, and bug reports. But GPLv3 really crosses a line for me, so I don't want to touch it at all in any manner.
> Just out of curiosity, if someone sent you a patch with changes to make the
> library work with a GPLv3 GCC, would you merge them into your official code base?
Probably no. That rather depends on the patch. Let's say gcc 5.4 has some nifty new warnings that tell you how to rearrange your code to make it compile smaller, even with gcc 4.2.1. I would merge such a change. But say gcc 5.4 has decided that __attribute__ syntax is no longer acceptable and changes it to some other mechanism, like back to #pragma or whatever. I would reject such a change.
> I suppose you could make the argument that you cannot test them, so provide
> an alternate unsupported version... But would you even do that?
No, I would politely tell them to maintain their own version, if they feel like it. I may help them out if they need something explained. I might even link to it. There is already one such fork, for the Symbian project, which I decline to merge into the mainline. There are numerous very platform-specific things in it, and I have no interest in supporting such a marginal platform. The only burden in this scenario lies on the maintainer of the fork, and it is not a very heavy one, since the library code has been quite stable for a while now. I make releases once a year or so, and pulling my changes into a fork should really not be that hard. The Linux kernel maintains several trees in this manner, so this development model is very well tested and established. Now, if I could only switch to git...
> You're holding them hostage. If they rely on your uSTL, they may be
> prevented from moving to a later version of gcc.
Not at all. They are welcome to make whatever changes, if any, that are required to make it work. And, since uSTL is distributed under the MIT license, doing this places no obligations on them for doing so. I think that is quite reasonable and quite a bit more than what you'd get from a GPL'ed project.
> Given that, I'd only use uSTL if I was willing to maintain it myself
That's true of all OSS projects. I will probably keep maintaining uSTL, but there is no reason for you to expect that. Most projects are eventually abandoned. Some get new maintainers, some just vanish into black holes on SourceForge. This is true of commercial software as well. Microsoft could go out of business in five years and then where will your Windows installations be? At least with uSTL, like with all other open source projects, you get the option of maintaining it yourself. It is better than having no such option, as with commercial software, and is one of the main reasons for using open source software in the first place.
> What makes you think there's going to be three people (including you) who will
> boycott new gcc versions because they don't like the license?
The american entrepreneural spirit. In this country we have been traditionally opposed to communism in all its forms, preferring our free market society. It may be changing now, but most people still hold such beliefs, and will instinctively revile GPLv3, which is profoundly anti-business.
> No, they're expected to have at least an occasional desire to contribute,
Or be branded "freeloaders" and face social ostracism from the community. Oh, sure, it doesn't matter much to me, since I couldn't care less what GPL fanatics think, but I'm obviously not a member of that community. If I were, the pressure would be far more real. This is rather beside the point though. The point is that you get no incentive for doing your work. No, "getting excellent software" is not an incentive, because one, it isn't that good, and two, you get it anyway, whether you contribute or not. I was born in the Soviet Union, so I know exactly how this works. Everyone gets paid the same, no matter how much they work, so nobody works. That's communism for you.
> The FSF is quite insistent on the ability to sell GPLed software
In theory, but not in practice. Read my earlier rant on this subject. Hell, you can even get it from the horse's mouth; RMS himself repeatedly states that his most cherished goal is the destruction of all commercial software.
> So, why are you maintaining a free software project (or, if you prefer, open source)?
Because it isn't worth anything. You just go and try setting a reasonable price for uSTL. Would you pay $10? $5? How about $1? No? I didn't think so. You can't compete against free. Sure, I believe my implementation is a very good one, but would anyone really care? Yes, you can reduce C++ overhead by a factor of four if you use uSTL, but in today's world of terabyte hard disks and gigabyte RAM sticks, nobody cares enough to pay any money for such a reduction. Another reason is that it isn't really my work; I only implemented a standard, there isn't that much original work in it. I wouldn't feel correct in charging money for something I didn't do.
I keep it open source because it costs me nothing. I don't really gain anything from it. I've had perhaps less than ten bug reports in the entire lifetime of the project. Nobody contributed any code. So why bother? Because someone might write some good software with it. Something nice, small, and blazingly fast. Sure it hasn't happened yet, but it might, and it costs me nothing to keep the project on SourceForge.
Note that I did not say that the "nice, small, and blazingly fast" project
> Fair enough, it's your right to throw a tantrum and stamp your little foot
> if you want, but it's purely political showboating on your part.
Well, of course it is. That's what all protests are. Sometimes it pays to keep your seat on the bus for a better cause, and sometimes it furthers that cause.
> and your crocodile tears for your poor users are thoroughly specious, since you're the one holding them hostage
That's not exactly true. I am not holding them hostage; I am giving them a choice - GPL3 software or me. A perfectly free choice, just like the one GPL projects give their users to not touch their code or switch to GPL. Turnabout is fair play.
> It's a massively unprofessional attitude of you, you are cutting off your project's nose to spite your users' faces
Not at all. I am simply exercising my right to choose whom I do business with. Some forms of discrimination are illegal, such as on race, sex, or religion, but discrimination against GPL fanatics is still perfectly legal. The result of my actions is that people in the GPL camp would be less likely to use my project (in the hypothetical long run, anyway; a GPL3 gcc hasn't even been released yet), which suits me very well. I fully expect normal people to follow suit and boycott all GPL3 software, and those people (who are precisely the sort for whom I would most like to write for) will never have any problems compiling my projects. I call this getting exactly what you deserve.
> we could really do without someone whose ego so far outweighs their desire to contribute.
Indeed you could, because the premise of FSF's communist philosophy dictates that nobody is allowed to have an ego of any kind. If you join their commune, I wish you luck, because its members are expected to have a perpetual "desire to contribute" without getting anything in return. For myself, I prefer the capitalist system, where I am paid for my efforts instead of being a penniless slave to society.
> And example are the ads in Circuit Cellar magazine or Cycle World magazine.
Magazines? Somebody still reads those?
> Yes I may be looking for a new AVR programmer when I see the ad in Circuit Cellar.
> Of course I will do some research but how else will I know that the company exists?
By doing a Google search for what you want, of course. Every company has a web site these days. This will show you all the companies available, not just the one whose ad you happened to see. How will you know if the company is any good if not by comparing it with its competitors? What's needed here, is not advertisement, but a global directory of companies, where you could search by type of good and see a list of all brands, with prices and a short commentary. There are some web sites that try to do this, but they are not as complete as I would like.
> When reading Cycle World I might see a company offering a really good price on Shoei helmets this month.
Or, you could have checked eBay for what the best deal is this month and gotten an even lower price for it. On eBay you can see all the other prices it's compared with too. Can you do that in a magazine ad? I thought not.
> However isn't a company that sells you exactly what they advertise
> the kind of company you want to do business with?
I would rather do business with a company that doesn't waste money on advertising and instead spends time on putting truthful and complete information on their web site. With prices, dammit!
> The world isn't just black and white.
It is, when you know what you want.
> There was no policy change between 3 and 4 with respect of aliasing.
The change I am referring to is the new error you get when you alias a pointer and then dereference it. I use it extensively in my library to generate more compact code. For example, if you have a struct with two shorts in it, an implicit copy constructor would be created with four movw instructions. By casting the pointer to the struct to an int, you can write a copy constructor with only two movl instructions. This technique worked fine in gcc3, but gcc4 gives an error because it is more aggressive in rearrangements and the generated code will not work in some cases. I have to do various asm workarounds to make it work.
> GCC is now more able to take more advantages of what the standards say about aliasing.
And I am quite happy about that. I just want the ability to turn it off for a specific code block, which is not currently possible.
>> Since I am strongly opposed to GPLv3 and anything that uses it
> You mention this but without any backing of why.
I have no interest in repeating the same tired arguments over and over. Hell, you can see hundreds of them in every post on GPL3. Go and read them.
> Then are you paying for a Slashdot subscription?
Damn right, I am. I just don't usually take the bonus because nobody wants to moderate subscribers.
> I block ads also but I understand that they put the food on the table and provide for hosting space and bandwidth.
If there were no advertisers, the web sites would figure out other ways to earn income, like by paid subscription or by selling various bonus services. I will pay for a subscription if I like the site. I have one here, and I have one on SourceForge. This covers the news and my hobby projects. I'd pay for a generic news site too, but all the ones that offer a subscription are crap.
> Ads are not in themselves evil or even all that bad.
Oh yes they are. The very premise of advertising, that you can sell your stuff to people who don't initially want to buy it borders on brainwashing and is extremely offensive to me.
> I don't think people really hate most Google ads since they are just simple text.
I never notice Google ads, since Google is nice enough to put them off to the side. Since I never read them either, companies should just stop wasting their money on them.
> then this kind of content will not be available. At least not for free.
So what? It's ok to charge money for what you do. That is how capitalism works in the real world. Look at food; you have to pay for it, but most americans are fat anyway. I predict that if we did away with all ads, the quality of online content would go up dramatically.
> Please make sure to put that in big bold letters on your web page,
If you visited the site, you'd see that I already did.
> so people know they have to migrate or fork your project.
Oh, please do! Unlike the members of the GPL camp, I love it when people use my code. After all, what other reason can there be for publishing it? It is all under the MIT license, which, unlike the GPL, does not tell you what you can not do with the code, so you can fork, fudge, or make a profit from it, all of which are perfectly ok with me.
> This weekend I have to look for an STL implementation with bounds checking.
> Now I know not to bother looking at yours. Thanks.
Well, that's your loss, because uSTL does indeed have bounds checking.
Techies are known for a negative attitude toward advertising. I know I always block all ads on every site. If I see an ad, I automatically right-click and block it. If an advertiser does manage to get my attention after all, I am going to hate him so much for it that I wouldn't buy the product no matter how good it was or how much I wanted it. My guess is that the majority of people here feel the same way. We hate ads. We hate spam. We hate being sold to, period. And this isn't because we don't buy anything; we do. I buy lots of things all the time, but I will never base my decision on an advertisement. I'll do some research, decide what I want, figure out what quality level is acceptable, and then find the lowest price that fits those criteria. As a result, I am not a target demographic for advertisers, because to send me ads is counterproductive. Hence Alexa, which, by its method of measurement, naturally excludes the people like us, is a very useful tool to give advertisers what they want. It's that simple.
> this begs the question: What does GCC's license have to do with your code's license?
Why, nothing, of course. The effect of the gcc license in my case is not that it would directly affect my project, but rather that my project is affected by the fact that I don't want to use a GPL3 gcc or any other GPL3 software.
> I strongly doubt that there are many other people in the world who are
> sufficiently obsessed with hating GPLv3 that they'll go through contortions
> to avoid using any application with that license.
Be serious. Avoiding a particular version of gcc and refusing to support it can hardly be called "contortions". Avoiding other GPLv3 software is no more difficult; there is no loss of any kind since everything anyone needs is available under a non-evil license. The only loss sustained here is that of the GPL community losing users and developers, and I doubt there are many tears shed at FSF over that.
I maintain a more or less portable OSS project (uSTL - an STL implementation) and I have had to make at least a few changes for each compiler release. Sometimes it happens due to new warnings that catch potential bugs I didn't know about. Sometimes it is due to policy changes (like the stricter aliasing rules in gcc 4), and sometimes there are new features I want to take advantage of.
Since I am strongly opposed to GPLv3 and anything that uses it, I am not going to upgrade my gcc any further than 4.2.1, which I'll probably do today. This means that uSTL, and my other five projects on SourceForge, may have problems compiling on later gcc releases, even though I will not intentionally put any incompatibilities in my code. Not being able to predict the future, I don't know whether these problems would be minor ones or major ones, but I do know that unless they expose some fundamental problem with my code, I will reject any bugs related to them and state explicitly that any gcc > 4.2.1 is not supported and never will be.
Now, you probably wouldn't care about this. After all, I only had a few thousand downloads - a minute fraction of the developers in the world. And you might say "oh, who needs this guy's code anyway?" But I have a feeling I'm not the only one, and I do occasionally contribute to projects other than my own. Perhaps you don't care if you lose my skills and the skills of all those other developers, but I suspect that they do all add up to quite a bit, and while you might not notice it at first, the GPLv3 camp might get lonelier and emptier as time passes.
> But part of me wishes that the majority of consumers in the U.S. would shop based
> on the quality of products and services, not just the price.
There is a point when quality no longer matters because even the cheapest products are good enough. For example, I can go to the grocery store and have a choice of buying a brand name hunk of cheese for $6 or the store brand for $3. Since I can't tell the difference anyway, there is no reason for me to buy the more expensive product. Even when we look at products where durability matters, like, say, hard drives, the cheapest is usually good enough. All three hard drives in my machine were bought based entirely on price and are still running just fine after five, four, and three years. Sure, you say, just wait until one of them crashes. Yes, there is that risk, but considering that I keep regular backups, have no seriously critical data, and have never seen a hard drive crash, I consider the risk acceptable. I could go on, but it should be clear to anyone that the cheapest is usually good enough, and always buying "quality" in their stead is a waste of money.
> Why would you want to cure fear?
So you could become one of our new fearless mouse overlords instead of having to welcome them.
> It may surprise you to learn that the two are not mutually exclusive.
Perhaps not, but I am forced to repeat myself that jobs in which mathematical research is required are very rare. Most programmers will never encounter such requirements.
> In any case, by your argument people should stop doing science and mathematical degrees
> altogether unless they intend to go on to doctoral research, because most people will
> never use the advanced mathematics, physics, chemistry, or whatever they learn in an
> undergrad degree otherwise. Of course, this completely ignores the benefits of studying
> a subject at undergraduate level beyond rote learning, such as understanding different
> approaches to solving problems
Oh, please! You don't go to college to learn things. You go to college to get a degree. If you want to learn something, go to the library. Everything I learned in college, I learned there. Classes are useless; I can read the book by myself, thank you very much. The professors are of no help outside of class either, even if you manage to get to see them. In fact, the only reason to take any science classes at all is for the labs, where you can get practical xperience. Yes, I spent a lot of time in the chemistry labs even though I was a CS major, and it was time well spent. But any classroom time? A total waste.
>> The so-called multithreaded algorithms are little more than hot air.
> What a very sad, narrow-minded view. Maybe if you studied a little more about the formal
> models underlying programming,
I have studied them, thank you very much.
> No-one questions the usefulness of optimising compilers
Optimizing a code for a processor is an entirely different task from making non-threaded code run on multiple processors. The former is a mere technical algorithm, applying a bunch of little rules. The latter requires MAJOR code changes on the global level. There is no way you are ever going to take an algorithm and parallelize it without making some serious architectural changes to the entire application. It's just like a "computer scientist" to think about everything as an algorithm. Parallelization is a problem of program structure and cannot be solved by any amount of local tweaking. You have to set up data splitting and merging, flow control, and checkpointing, all of which are not generalizable for different types of data.
> Yeah, that PageRank thing is totally useless. I don't use it more then 20 or 30 times a day.
I said in the last decade. Google was founded in 1998, so I presume PageRank is a bit older than that.
> Bayesian spam filtering? Nobody uses that.
Bayesian methods have been around for centuries. Applying them to spam filtering is new, but it is more of an implementation detail than any significant research breakthrough.
> Sure, the rendering itself is fairly straightforward, but how do you decide what to
> render? And yes, I do do this for a living, and the maths and algorithms involved in serious CAD
So why didn't they just hire a mathematician to do that job? Programmers write programs, mathematicians do the math.
> You might be. The rest of us are talking about Computer Science.
Ok, let me clarify. The article is talking about maths in undergraduate CS degrees. Most people who have a BS in computer science will not be doing research; they will be programmers, which, I suppose is software engineering. I will not argue with you that someone with a PhD in CS should know higher maths, that is what they do. There are very few jobs out there that will require that sort of skills, but somebody needs to do them. However, there is no point in teaching maths to undergraduates, who will be programmers, not researchers.
> Sure. So tell me again the theory of how to get a compiler to automatically
> subdivide work and hand out chunks to different threads
There isn't one and only a "computer scientist" thinks there is going to be. To take proper advantage of multiple processors, you need good software engineering practices of proper design, good abstractions, and solid structures, none of which require higher maths do to. The so-called multithreaded algorithms are little more than hot air.
> If a man only strings together components written by computer scientists
There are no components out there written by computer scientists. Computer scientists make algorithms that a real programmer has to implement. You wouldn't expect a computer scientist to know anything about performance optimizations or code readability.
Next, there are only a few components out there that have any algorithms. Numeric computaion is an extremely small part of any application. You might be reading jpegs, or decompressing zips, or decrypting something, but you don't write those libraries yourself and you don't need to know precisely how those algorithms work. The greatest bulk of your work will involve moving data around and interconnecting objects, and that is what all programmers need to know how to do, no mathematics.
>> Chances are, nobody will have to maintain what you wrote
> Some developers whose projects I have inherited over the years had that exact attitude.
Yes, and many of them will have had CS degrees... Cause and effect? Perhaps.
> If your argument is that modern "programmers" are not (and need not be) _capable_ of
> doing anything more than assembling pre-made components, let's call them something else.
It's funny you say this, for that is exactly what I think computer scientists are.
After all, their work involves neither computers nor science.
As for pre-made components, I'll repeat myself that if you ever worked as a programmer, you'd know that there are very few pre-made components you can assemble. Most of the time you write stuff yourself, and no, you don't need higher mathematics for any of it.
> Your comment makes sense, but my previous job goes against what you said.
> Performance and business analytics require math. A lot of it.
As I keep pointing out, this is not a programming position, it's a research position. Yes, there are a few jobs available where you will do research of some kind, analyzing data and making conclusions from that data. My point is that the vast majority of programming jobs out there are involved with making software, not with data analysis. The vast majority of CS graduates will not be doing research and have no interest in doing research, so it is pointless to make them learn higher maths. For a data analysis position you really should not be hiring CS people anyway; hire a mathematician, because that is the sort of job they are good for.
> Expand your definition of maths: http://en.wikipedia.org/wiki/Predicate_calculus
I'm more than happy to add predicate calculus to the list of maths a programmer does not need to know. Thank you for your contribution.
> If you are doing any serious statistics, please consider using gnumeric instead.
If you are using Windows, you are going to be using Excel because that is what comes with it. Whether to use MS Office or free software is company policy.
> I hate to break this to you, but no. Drawing in 3D is often heavily supported by
> hardware and coded using libraries like OpenGL or Direct3D. But how do you think
> these libraries know where to put things?
Having written a software renderer myself, I am very well aware how such libraries work, and I can tell you that very little higher math is involved in making them, and all that math has already been done. Yes, you need to know a bit about linear algebra, like how matrices work, and have some idea about vector transforms. But you only need to know how to visualize what you are doing and how to implement it, you will not be doing proofs and you will not be doing any theoretical research. All the formulas for transforms, matrix operations, viewport building, clipping, lighting, are already easily available at your local library and on the net. If you want to write your own renderers, you'll need to know a bit about calculus and how to use derivatives to manually step your iterators. But that's all. All your lambda calculus, discrete maths, set theory, group theory, and all other mathematical garbage are of no use here.
> And who did you think newer versions of the libraries themselves grow on trees?
My point is that the vast majority of programmers use libraries, not write them. There might be a small niche for a mathematician on a library development team, but that's a negligibly small market for such skills.
> OK, but we're not talking about Software Engineering, we're talking about Computer Science.
No, we are talking about Software Engineering, which is what most people here do. Yes, universities employ a few thousand professors that do computer science, but that requires an entirely different education path through a PhD, focusing on theory. Most programmers are programmers, and have no need for higher mathematics, which is the point made in the article.
> And you'd better hope the people who are doing that have sound theoretical bases for the models they adopt.
Bullshit. Nobody has developed anything useful in the field of computer science in more than a decade. All the higher-level theory has been done already. What really sucks is the implementation of those theories, and part of the reason that implementations suck is that ivory tower academics developing those theories are so stuck in their higher math, that they are ignorant of the problems of the real world and the implications for their theories that those problems impose.
> Tell me about it --- just a few days ago, I had to give myself a refresher on
> complex probability and statistics (specifically, binomial probability and related
> distributions) to analyze some advertising data.
You are not writing an application, you are doing research, which makes you an academic, at least in this particular instance. Chances are, nobody will have to maintain what you wrote, so you could write the whole thing in FORTRAN or APL, or whatever. You are simply illustrating my point is that writing software for real people is very different from writing little programs for research.
> Agreed, for the most part. Lack of object ownership is a big problem.
:) When you have objects shared between threads, you have not properly defined object access rights, which are a part of defining ownership. Ideally, you should not share data between threads at all. Data flow should be one way. You create a data packet, give it to a thread, the thread processes the packet and notifies you when it's done. If you need to access data from more than one thread, it usually means you need to combine that code in a single thread. If you don't, lock contention will wipe out any performance gains you might have had from parallel processing.
> People's eyes tend to glaze over when you start talking about it, though
The existence of stupid people is not a good argument for a language feature.
> That said, there are times when reference counting is the right solution --- consider graphs!
That's right. Consider graphs, and discard them. If you need a graph for anything, you are already in deep dudu because you haven't optimized object relationships. That said, if you really think you have a graph-like structure, the graph should not own the nodes. Put the nodes in an array and use another array to store links. This is the proper ownership structure for this problem. The benefits include not having to worry about memory management, an automatic incentive to implement inversion of control (which you probably will want eventually in this situation), less template bloat because the link array will probably be type compatible with something simpler, easier database integration (this is how you do many-to-many relations there), faster node lookup (links are smaller than the nodes, and so the lookup array has a better chance of fitting into cache), and easier debugging (you can dump the graph nodes or links in a simple loop).
> Also, I don't see what memory ownership has to do with locking.
> An object might be owned by another, yet accessed from a different thread anyway.
Use your abstraction skills, man!
> [snip rant about template bloat]
> Those are all compiler problems, not language ones.
Not always. When you create a bound function, you have to instantiate an object, which is indeed a language requirement. Yes, sometimes a trivial constructor can be inlined, but you need to look at the assembly every time to make sure it happened.
> Agreed, as far as abstraction goes, but this is really getting into an argument about
> object-oriented versus generic programming. Okay, say you're using a compiler that
> can't optimize the call through the member function pointer, and you have to use an
> indirect call. How is that differently, exactly, from calling a virtual function through
> a vtable (which is what I imagine your abstraction layer doing) in terms of performance?
A virtual call generates less code than a member call by pointer, but that's not really where the problem is. The real difference is that generic programming generates more code. Every time you instantiate an algorithm, you essentually cut-n-paste all the code in it. Templates eliminate the errors inherent to cut-n-paste programming by doing it automatically, but you still have code bloat. In the approach I am advocating you have true code reuse, not just in the source, but in the compiled executable as well. Once you realize that it is possible to do everything just as simply by creating proper abstractions, generic programming ceases to have any benefits at all.
In general, the proper use of templates is type safety, not code duplication. Yes, it is occasionally useful to have a templated function; I have written quite a few of them. You just need to realize that it is cut-n-paste programming and is not a substitute for correct design.
> Can you give me an example of a better abstraction setup, one that doesn't incur these penalties, but remains reusable?
I can't give you an abstract abstraction!
> take a look at boost for C++. It makes working with the STL (even with member functions) a breeze.
No it doesn't. Using algorithms with bound templates in boost is no different than using them with STL. It in no way addresses the problems with member functions and general bloat problems when using binds of any kind. With member functions I still have the same gripes. First, you have to specify the fullly qualified name, which is not fatal, but creates more code to read. Second, when you bind a member function by pointer, you call it by pointer, which incurs runtime overhead of at least four extra instructions per call, a branch misprediction, and a cache miss due to that. Yes, sometimes the compiler can figure out which function you are calling and use a direct call, but that is rare. Third, you seldom just call a member function; you call it with some argument, which necessitates the use of bind objects, which are never inlined due to object construction requirement. And, finally, there is the readability issue. Functional, LISP-like syntax is what makes math-oriented academics comfortable, but it makes normal people scream. The resulting hit in readability and performance makes binding a really bad idea. It is always better to create a proper abstraction by examining your class hierarchy and creating a generic, non-templated algorithm that works on everything. Yes, this is always possible! If you think you can't, check your assumptions.
> shared_ptr,
Love of refcounted pointers and garbage collection are a sure indication that you have no idea how to define object lifetime. An experienced programmer knows that it is essential to know who owns what object and how long they live. This is not just a memory management problem, it is also a threading problem. Locks and lots of shared objects are symptoms of the same thing. Once you strictly define object ownership and lifetime, you'll quickly discover that garbage collection is unncecessary, refcounted pointers are not needed, and all threading problems disappear.
> lambda libraries.
Suffer the same problems as binding, as outlined above. Additionally, this capability encourages turning C++ into LISP, which is the treasured goal of academics, and is utterly despised by all real programmers.