
What kind of things, barring coding on Haskell-less platforms and library interfaces would you choose to do in C++? I'm asking 'cos I'm learning C++ and can't get the proper motivation to do any program I can think of in it: If I need abstraction, I'm thinking Haskell or Scheme, and if I'm thinking performance, C itself more than suffices. Plus template programming makes me shudder because of its atrocities against clear and straightforward FP, but that's a different matter. Coming to think of it, a compiler from a clean syntax to C++ templates sounds like a fun project... which I'd do in Haskell. -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited.

C++ is nicer to work with, when you have the option, on embedded
microprocessors. Dealing with C all the time can be a little cumbersome.
Actually, I've parroted this over and over, if I *could* use Haskell on an
embedded micro, I would. There needs to be more work in that area.
/jve
On Sun, Oct 19, 2008 at 5:08 PM, Achim Schneider
What kind of things, barring coding on Haskell-less platforms and library interfaces would you choose to do in C++?
I'm asking 'cos I'm learning C++ and can't get the proper motivation to do any program I can think of in it: If I need abstraction, I'm thinking Haskell or Scheme, and if I'm thinking performance, C itself more than suffices.
Plus template programming makes me shudder because of its atrocities against clear and straightforward FP, but that's a different matter.
Coming to think of it, a compiler from a clean syntax to C++ templates sounds like a fun project... which I'd do in Haskell.
-- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On 20 Oct 2008, at 01:08, Achim Schneider wrote:
I'm asking 'cos I'm learning C++ and can't get the proper motivation to do any program I can think of in it: If I need abstraction, I'm thinking Haskell or Scheme, and if I'm thinking performance, C itself more than suffices.
Seems like you've just explained why C++ isn't good for anything.

On Sun, 2008-10-19 at 23:08 +0200, Achim Schneider wrote:
What kind of things, barring coding on Haskell-less platforms and library interfaces would you choose to do in C++?
I'm asking 'cos I'm learning C++ and can't get the proper motivation to do any program I can think of in it: If I need abstraction, I'm thinking Haskell or Scheme, and if I'm thinking performance, C itself more than suffices.
Plus template programming makes me shudder because of its atrocities against clear and straightforward FP, but that's a different matter.
I tend to use C++ whenever I strongly care about data representation (which is admittedly rarely.) You can use C for that; I just prefer C to C++ for almost everything. The only other thing that would almost certainly lead me to using C++ is if I needed to use to a C++ library. C++ is extremely difficult to interface to.
Coming to think of it, a compiler from a clean syntax to C++ templates sounds like a fun project... which I'd do in Haskell.
This is actually one of the first things I wrote in Haskell. It's not even much of a compiler but mostly just filling in the blanks of some templates. So I could write: fac 0 = 1 fac n = n * fac (n - 1) and get output akin to the example on wikipedia.

G'day all. On Sun, 2008-10-19 at 23:08 +0200, Achim Schneider wrote:
I'm asking 'cos I'm learning C++ and can't get the proper motivation to do any program I can think of in it: If I need abstraction, I'm thinking Haskell or Scheme, and if I'm thinking performance, C itself more than suffices.
Unless I'm working on a platform where memory is so tight that I
can't afford the cost of vtables, EH, RTTI and extra stack usage,
I always prefer C++ to C. Always. On the sorts of CPUs you find
on desktops and servers, and even most embedded platforms these
days, there is no advantage in using C over C++, and significant
advantages in using C++ over C.
The trouble is that C++ is a tool that's hard to use well. But that's
why they pay us the big bucks, right?
Quoting Derek Elkins
I tend to use C++ whenever I strongly care about data representation (which is admittedly rarely.)
Indeed. Having said that, type families mean that Haskell now gives you much finer control over data representation, though still not fine enough for many applications. The more general thing is that C++ gives you fine control over resources. Resources appear and disappear at predictable times, which in some applications is important. My last point is that C++ has a lot more tool support: compilers, libraries, frameworks, refactoring browsers and so on. Cheers, Andrew Bromage

Hello ajb, Monday, October 20, 2008, 4:50:45 AM, you wrote:
The trouble is that C++ is a tool that's hard to use well. But that's why they pay us the big bucks, right?
i think that one day we will hear that ML was too easy language and they invented Haskell in order to keep future salaries high LOL -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On 2008 Oct 19, at 21:07, Bulat Ziganshin wrote:
Monday, October 20, 2008, 4:50:45 AM, you wrote:
The trouble is that C++ is a tool that's hard to use well. But that's why they pay us the big bucks, right?
i think that one day we will hear that ML was too easy language and they invented Haskell in order to keep future salaries high LOL
I thought that was what Agda was for. :) -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

On Sun, 19 Oct 2008 20:50:45 -0400, ajb@spamcop.net wrote:
The trouble is that C++ is a tool that's hard to use well. But that's why they pay us the big bucks, right?
Interesting argument. At first I thought that the following uncensored interview with Bjarne Stroustrup was a joke, but your argument makes it seem all the more plausible: An Interview with Bjarne Stroustrup http://www.ariel.com.au/jokes/An_Interview_with_Bjarne_Stroustrup.html Some say that C++ was intentionally designed to be extremely difficult to use specifically in order for C++ programmers to earn those "big bucks." Maybe this is just me, but if I had to choose a tool, I'd choose one that would be easy to use well. -- Benjamin L. Russell

G'day aoll.
Quoting "Benjamin L.Russell"
Interesting argument. At first I thought that the following uncensored interview with Bjarne Stroustrup was a joke, but your argument makes it seem all the more plausible:
That's not quite what I meant. What I meant is that Visual Basic script kiddie-ing may well be easy, real software development is hard. C++ is a hard tool to use well, but that's because it is doing a hard job.
Some say that C++ was intentionally designed to be extremely difficult to use specifically in order for C++ programmers to earn those "big bucks."
Maybe this is just me, but if I had to choose a tool, I'd choose one that would be easy to use well.
A paintbrush is easy to use, but hard to use well. Cheers, Andrew Bromage

Benjamin L.Russell wrote:
On Tue, 21 Oct 2008 01:46:00 -0400, ajb@spamcop.net wrote:
A paintbrush is easy to use, but hard to use well.
An interesting analogy. Then, in the style of a verbal analogy exam question:
C++ : paintbrush :: Haskell : ?
C++ : paintbrush :: Haskell : gimp or photoshop ? (A twist on what "paintbrush" refers to. :) You can get gimp and photoshop to do wonder once you become computer-literate. You can get Haskell to do wonder once you become category-literate.) C++ : paintbrush :: Haskell : OpenGL ? (OpenGL has combinators for affine transformations. Plus, it has one more dimension than paintbrush painting!) C++ : paintbrush :: Haskell : graphics software used for the Lord of the Rings movies? ("Real artists" swear by the paintbrush. The rest of us need automation in rendering things, postponing evaluation, and freeing memory!) :)

On Thu, Oct 23, 2008 at 11:21 AM, Albert Y. C. Lai
Benjamin L.Russell wrote:
C++ : paintbrush :: Haskell : ?
C++ : paintbrush :: Haskell : gimp or photoshop ? [...] C++ : paintbrush :: Haskell : OpenGL ? [...] C++ : paintbrush :: Haskell : graphics software used for the Lord of the Rings movies?
Nah, I'd say it's: C++ : paintbrush :: Haskell : category theory :-) Luke

For the record, C++ (and a crippled scripting language call MEL that makes C look good) were used in the Maya 3D graphics software used for the Lord of the Rings movies [1]: "Weta Digital utilized Maya® as the core 3D animation software technology throughout the process of creating digital characters and effects for the Lord of the Rings™ films -- Lord of the Rings: The Fellowship of the Ring ™, Lord of the Rings: The Two Towers™, and Lord of the Rings: The Return of the King™." [1] http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=6878908&linkID=7679654 Maya provided at that time (as now) a C++ API for plugins, with a data-structure poor MEL scripting language. Now (but not at that time), Python can also be used for both scripting and plugins. There is (as yet) no Haskell API (anyone up for writing one?). Sorry to burst y'alls delusions of grandeur. I love Haskell greatly over C++, but the claims I've been reading about its use in industry are a still a wee bit premature. Dan Luke Palmer wrote:
On Thu, Oct 23, 2008 at 11:21 AM, Albert Y. C. Lai
wrote: Benjamin L.Russell wrote:
C++ : paintbrush :: Haskell : ? C++ : paintbrush :: Haskell : gimp or photoshop ? [...] C++ : paintbrush :: Haskell : OpenGL ? [...] C++ : paintbrush :: Haskell : graphics software used for the Lord of the Rings movies?
Nah, I'd say it's:
C++ : paintbrush :: Haskell : category theory
:-)
Luke _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

G'day all.
Quoting Dan Weston
For the record, C++ (and a crippled scripting language call MEL that makes C look good) [...]
To be fair, MEL does exactly what it's designed to do. It was supposed to powerful enough to be a scripting language, UI builder and save file format, while being restricted to the point where concurrency issues (e.g. locking) are not exposed to the user. In 1998. (The concurrency issue is the main reason, I think, why you can't implement a dependency node in MEL.)
There is (as yet) no Haskell API (anyone up for writing one?). Sorry to burst y'alls delusions of grandeur. I love Haskell greatly over C++, but the claims I've been reading about its use in industry are a still a wee bit premature.
It depends on the industry. Cheers, Andrew Bromage

"Bulat" == Bulat Ziganshin
writes:
Bulat> Hello Benjamin, Bulat> Tuesday, October 21, 2008, 8:13:55 AM, you wrote:
Maybe this is just me, but if I had to choose a tool, I'd choose one >> that would be easy to use well.
Bulat> and what tool you choose in 80's? :) A TARDIS. -- Colin Adams Preston Lancashire

Achim Schneider wrote:
What kind of things, barring coding on Haskell-less platforms and library interfaces would you choose to do in C++?
I'm realatively new to Haskell but I've been coding pretty intensively in Ocaml for a number of years. For new code, there is stuff I would do in C over Haskell/Ocaml; low level libraries, realtime audio DSP (digital signal processing) and device drivers. For all of these I would choose C over C++ because C is a cleaner less cluttered language. As soon as I want to do something more high level, then I choose a real high level languague like Ocaml and maybe some day even Haskell. Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- "A task always takes longer than you expect, even when you take into account Hofstadter's Law." -- Douglas Hofstadter

On Sun, Oct 19, 2008 at 2:08 PM, Achim Schneider
What kind of things, barring coding on Haskell-less platforms and library interfaces would you choose to do in C++?
You're asking a crowd that is heavily biased towards Haskell, what they would use C++ for? You should expect many answers to be of the form, "Well, if Haskell doesn't work, I'll try generating C or C++ from Haskell." :) Which means, people here often see other languages as target languages for code generators. Which is something I think is pretty cool. But, getting back to your question... If I were considering writing something in C++ here are some of my considerations: 1) Is the thing I'm writing known to be easy to solve in C++? 2) Will writing it in C++ instead of, say, Haskell give me access to a developer pool that is superior for the task? 3) Will dealing with the very few drawbacks of laziness, in particular lazy IO or space leaks from laziness, end up dominating the development effort? 4) Is it a work related project? 5) Am I just making a prototype or executable specification? I put (2) and (4) up there because I think it's important to consider who you'll be working with. I can't really get way with using Haskell much at my day job because I'm the only one there that wants to use it. The company has to deal with the code I create even if I move on. Also, programming is hard regardless of how cool your language is. So it always seems wise to work with the sharpest set of programmers that you can. Sometimes that means picking a particular language. It's also important to think about the merits of the languages themselves, such as (1), (3) and (5) point out. If you're prototyping, Haskell is light years ahead of C++. Then again, optimizing C++ programs, while tedious and error prone, is understood by far more people than optimizing Haskell programs. Laziness can be unpredictable. I like Haskell a lot and I'd bias all my answers to the above 5 towards it, but C++ is also a very cool language. It's just cool for very different reasons than Haskell is cool. I'm asking 'cos I'm learning C++ and can't get the proper motivation to
do any program I can think of in it: If I need abstraction, I'm thinking Haskell or Scheme, and if I'm thinking performance, C itself more than suffices.
Plus template programming makes me shudder because of its atrocities against clear and straightforward FP, but that's a different matter.
Heh. Yeah, it can be ugly, but it's also very powerful. The template system is Turing complete as you may know. Boost and Loki are two good examples of some of the cool things you can do with C++ if you really work the template system. Coming to think of it, a compiler from a clean syntax to C++ templates
sounds like a fun project... which I'd do in Haskell.
Ah yes, even you're thinking about code generators. It's a very common way to think in this community it would seem. Jason

On Sun, Oct 19, 2008 at 3:08 PM, Achim Schneider
What kind of things, barring coding on Haskell-less platforms and library interfaces would you choose to do in C++?
I would recommend programming a simple game using SDL. That is currently not that much easier in Haskell than it is in C++ (only a couple orders of magnitude ;-). As for what would actually be strictly *easier* or *better* to use C++ for... well let me just say that I used to be a C++ guru, and now I haven't used it for two years. Luke

Hello Achim, Monday, October 20, 2008, 1:08:06 AM, you wrote:
thinking Haskell or Scheme, and if I'm thinking performance, C itself more than suffices.
... and machine code too :D C++ is the highest level language that provide asm-like speed, so it's hard to find reasons to use C instead. and templates may be used to generates lots of efficient code automatically -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

What kind of things do you prefer? Databases, science, math, web? At first, make sure you have Bjarne Stroustrup book (very important: last edition). If there's anything good in C++, it's there. Look also at his homepage: http://www.research.att.com/~bs/homepage.html Bjarne is the guy who first started C++, and in a certain way still leads its development.
What kind of things, barring coding on Haskell-less platforms and library interfaces would you choose to do in C++?
I'm asking 'cos I'm learning C++ and can't get the proper motivation to do any program I can think of in it: If I need abstraction, I'm thinking Haskell or Scheme, and if I'm thinking performance, C itself more than suffices.
Plus template programming makes me shudder because of its atrocities against clear and straightforward FP, but that's a different matter.
Coming to think of it, a compiler from a clean syntax to C++ templates sounds like a fun project... which I'd do in Haskell.

Mauricio
At first, make sure you have Bjarne Stroustrup book (very important: last edition). If there's anything good in C++, it's there. Look also at his homepage:
I got the third edition and read it a couple of times... It's not that I'm lacking knowledge of the language, but routine and a deeper grokking of it's essence like I have with C, Scheme, Java and I guess also Haskell. -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited.

At first, make sure you have Bjarne Stroustrup book (very important: last edition). If there's anything good in C++, it's there. Look also at his homepage:
I got the third edition and read it a couple of times... It's not that I'm lacking knowledge of the language, but routine and a deeper grokking of it's essence like I have with C, Scheme, Java and I guess also Haskell.
Well, one thing I miss from C++ is the idea of acquiring resources in constructors and releasing them in destructors, as explained here: http://www.research.att.com/~bs/bs_faq2.html#finally (Haskell uses that in 'with...' functions, like 'withFile', but the syntax in C++ seems cleaner to me.) So, I can sugest you to try something where dealing with external (out of your control) resources is important, and where you need graceful handling of exceptions. Also, it's very easy to write your own memory allocator and use it to manage memory "under pressure", and so you can go far beyond where 'Foreign.Marshal.Pool' Haskell module can go. Here is my sugestion: write something to interface with hardware. I tried to find something more specific but failed in available time, so I sugest you to take a look at many stuff you can find in thinkgeek. Then you can try unusual uses for it. For instance, they have a USB microscope. I don't know if you can move the microscope from the computer, but if you do, you could write something to automatically find evidences of failure in some kind of material or traces of chemical dust in surfaces. Or maybe you can get some security toys and try to identify people using their faces, or allow them to type text using just the movements of their heads. All of that involves heavy processing and at the same time interaction with equipment that can behave badly (like faces that can just go away from the computer). The nice thing about this is that in the end you can write a C wrapper over the main code and we can use it from Haskell :) Best, Maurício

Hello Mauricio, Wednesday, October 22, 2008, 2:23:55 PM, you wrote:
Well, one thing I miss from C++ is the idea of acquiring resources in constructors and releasing them in destructors, as explained here:
(Haskell uses that in 'with...' functions, like 'withFile', but the syntax in C++ seems cleaner to me.)
i think that in haskell you may put to action any syntax of RAII - both Java-like (with finally) and C++ like (with implicit destructors). what concrete style you need to simulate? -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

Bulat Ziganshin
Hello Mauricio,
Wednesday, October 22, 2008, 2:23:55 PM, you wrote:
Well, one thing I miss from C++ is the idea of acquiring resources in constructors and releasing them in destructors, as explained here:
(Haskell uses that in 'with...' functions, like 'withFile', but the syntax in C++ seems cleaner to me.)
i think that in haskell you may put to action any syntax of RAII - both Java-like (with finally) and C++ like (with implicit destructors). what concrete style you need to simulate?
Haskell: What language do you want to speak today? -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited.

On Sun, 19 Oct 2008 23:08:06 +0200, Achim Schneider
What kind of things, barring coding on Haskell-less platforms and library interfaces would you choose to do in C++?
I'm asking 'cos I'm learning C++ and can't get the proper motivation to do any program I can think of in it: If I need abstraction, I'm thinking Haskell or Scheme, and if I'm thinking performance, C itself more than suffices.
Plus template programming makes me shudder because of its atrocities against clear and straightforward FP, but that's a different matter.
Coming to think of it, a compiler from a clean syntax to C++ templates sounds like a fun project... which I'd do in Haskell.
Read the following uncensored interview with Bjarne Stroustrup, the designer of C++, and then tell me what you think: An Interview with Bjarne Stroustrup http://www.ariel.com.au/jokes/An_Interview_with_Bjarne_Stroustrup.html -- Benjamin L. Russell

On Mon, Oct 20, 2008 at 8:07 PM, Benjamin L. Russell wrote: On Sun, 19 Oct 2008 23:08:06 +0200, Achim Schneider What kind of things, barring coding on Haskell-less platforms and
library interfaces would you choose to do in C++? I'm asking 'cos I'm learning C++ and can't get the proper motivation to
do any program I can think of in it: If I need abstraction, I'm
thinking Haskell or Scheme, and if I'm thinking performance, C itself
more than suffices. Plus template programming makes me shudder because of its atrocities
against clear and straightforward FP, but that's a different matter. Coming to think of it, a compiler from a clean syntax to C++ templates
sounds like a fun project... which I'd do in Haskell. Read the following uncensored interview with Bjarne Stroustrup, the
designer of C++, and then tell me what you think: An Interview with Bjarne Stroustrup
http://www.ariel.com.au/jokes/An_Interview_with_Bjarne_Stroustrup.html I'm pretty sure that "interview" is a fake one. -- Benjamin L. Russell _______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Benjamin L.Russell
Read the following uncensored interview with Bjarne Stroustrup, the designer of C++, and then tell me what you think:
An Interview with Bjarne Stroustrup http://www.ariel.com.au/jokes/An_Interview_with_Bjarne_Stroustrup.html
As I read it the first time (it has been posted here before) I discovered things I dislike in C++ that I hadn't discovered yet. I wouldn't be surprised if Bjarne actually wrote it and submitted it as a joke. -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited.
participants (17)
-
Achim Schneider
-
ajb@spamcop.net
-
Albert Y. C. Lai
-
Benjamin L.Russell
-
Brandon S. Allbery KF8NH
-
Bulat Ziganshin
-
Colin Paul Adams
-
Dan Weston
-
David Leimbach
-
Derek Elkins
-
Eric Willigers
-
Erik de Castro Lopo
-
Jason Dagit
-
John Van Enk
-
Luke Palmer
-
Mauricio
-
Miguel Mitrofanov