lambda functions
lambda functions
Posted Dec 9, 2005 9:08 UTC (Fri) by khim (subscriber, #9252)In reply to: lambda functions by ncm
Parent article: The Boost C++ Libraries
Yes, it's very true that C, FORTRAN, COBOL and even Java/C# do not include a lot of modern ideas. The fact of the matter is: they are used more often by "industry" then C++. C++ has it's place but the only reason it's used at all are few good (and few not-so-good) toolkits: Qt, MFC, ATL, etc. In last 10 years I was involved in many projects and only tiny part was written in C++ - mostly things for Windows (Microsoft only recently switched away from C++).
While what you said is true (different languages are suitable for different purposes) it all looks to me like try to define "industrial use" in such a way as to make C++ winner.
Let's define "industrial use" as "something done by big boys". What ? They are using scripting laguages. Ok - let's explicitly exclude them. Oops - still no win: huge number of things is done in C or FORTRAN ? Let's say that "ancient laguages" are not of concern. Still C++ is not winner ? Ok - let's ignore VM-based laguages as well. And so on. In the end you'll define some niche where C++ is clear leader - but this can be done for almost any language. Even very obscure langauges.
Posted Dec 9, 2005 18:43 UTC (Fri)
by ncm (guest, #165)
[Link] (6 responses)
Any language suffices for easy problems. Hard problems demand range. If you confine yourself to easy problems, you won't notice the built-in limits of your language. When you do need the range, minor inconveniences are easy to overlook.
Of course most problems are easy, and most people spend their time solving easy problems. It's generally not hard to ignore the hard problems, and the people working on them.
Posted Dec 9, 2005 21:25 UTC (Fri)
by dvdeug (guest, #10998)
[Link] (5 responses)
C++ has less range than Common Lisp. If you demand that all core language features "map to a machine instruction or two", what more can you expect?
It's seriously absurd to dismiss all problems besides "industrial" problems as easy. There's no challenge to writing a paycheck generator. There's challenge to writing code to control a 757 (code written in Ada, BTW), but it's not in the range; it's in getting things done, always exactly correct, on a very tight time schedule.
A game is not a trivial thing; it's funny that many game programmers either refuse to use C++ for speed reasons, or use scripting languages to control much of the game's actions. Obviously, C++ doesn't provide the right range for them.
Posted Dec 10, 2005 6:03 UTC (Sat)
by mvogt (guest, #34379)
[Link] (4 responses)
If you look at sourceforge, two categories I sampled as having high-performance requirements (simulations and first-person shooters) have more than half of their listed projects listed with C++ as a development language.
C++ can be used with almost no abstraction penalty over C, depending on what features you choose to employ. There is a good document establishing the efficiency costs of various C++ features available at http://www.research.att.com/~bs/Performance-TR.pdf
I agree that many games have a component written in scripting languages; I think that this is probably a reflection of the rapid time-to-market pressure in the game market as much as anything else.
Posted Dec 10, 2005 7:32 UTC (Sat)
by dvdeug (guest, #10998)
[Link] (3 responses)
Posted Dec 10, 2005 8:22 UTC (Sat)
by mvogt (guest, #34379)
[Link] (2 responses)
Ideally, C++ can be used together with a language designed for embedding (such as Lua) for game development.
That said, games are an unusual domain, where even correctness can be less important than performance or speed-to-market.
Posted Dec 10, 2005 8:53 UTC (Sat)
by dvdeug (guest, #10998)
[Link] (1 responses)
Posted Dec 10, 2005 22:05 UTC (Sat)
by mvogt (guest, #34379)
[Link]
C++ does not put correctness second to performance, it ensures that you needn't pay for what you don't use. (Ignoring legacy C built-in arrays,) if you can guarantee array bounds will not be violated you can use the subscript operator for unchecked access; you can use the 'at' member function to get runtime checking where desirable. 'Relegating... to the library' has been the favoured C++ evolution strategy, for right or wrong. It doesn't indicate that something is less correct or important.
I will admit that C++ puts guranateed correctness second to pragmatism. Languages that don't have not been conspicuously successful in general purpose programming.
C++ is not a niche language. Webpage support is not, as a rule, an industrial use (although web interfaces occasionally appear in industrial settings). GUI coding, likewise, is not an industrial use.lambda functions
Writing an application as quickly as possible is not an easy job, yet it's one that Visual Basic makes easy. Solving complex problems of logical inference is not an easy job, but it's one that PROLOG and similar logical languages make easy. Writing an expandable editor like EMACS is not easy, but it's one that LISP makes easier. Writing a webpage generator isn't that hard, but it's a lot easier in Perl than C++.lambda functions
I disagree with your assertion that C++ is not used for games for performance reasons. I think commercial games are very often written in C++.C++ Game development
But rapid time-to-market is something that makes a problem hard, and there's no reason to dismiss languages that are ideal for solving such hard problems as unworthy of study.C++ Game development
Of course such languages should not be dismissed, but nor should they be espoused for tasks they're not designed for.C++ Game development
Since when is correctness taking second place to performance and speed-to-market unusual? C++ itself puts correctness second to performance in relegating bounded arrays to the library. If you put correctness first, you would use the SPARK programming language, or something similar, and never release unless every possible test has been passed. But in reality, virtually every program releases with known bugs, frequently major ones. Jon Bentley mentions in one of the Programming Pearls books that given a 10x speed improvement on his typesetting system or all the bugs fixed, that he would have taken the speed up. If you (believably) made the offer on the GCC list, I suspect the list would blow up in a flame war over the issue.C++ Game development
Fair enough, there are obviously application domains where approximations are acceptable, and those where they are not. What would be the point of a 'grep' that returned most matches, or a 'find' with false positives?C++ Game development