I've been thinking about it, I'm not sure if there's any language I'll ever be more in love with than C++. If there was, I'd like to meet it.
I've been thinking about it, I'm not sure if there's any language I'll ever be more in love with than C++. If there was, I'd like to meet it.
Pardon me, but I changed the title of this thread as the original one reads like flamebait. Actually, this revised one isn't necessarily much better, but at least it makes it clearer that you're looking at your own love of C++ and what else you might be drawn to more than C++, rather than straight out doing a language comparison war with no context.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Well, lets look at the candidates....
Erm, well there are dozens. If you love C++, maybe go with a language that shares
similar syntax. C#, Java even PHP has braces .
If you really want to live outside of the comfort zone, learn the language I studied before I
went to college.
Ada
Beautiful language - well designed but quite difficult to decipher. I highly recommend it.
Double Helix STL
If you want something different, there's APL (A Programming Language), from back in the 1960s.
Youtube example: Instructional video on how to implement Conway's game of life, taking very little code to implement:
Conway's Game Of Life in APL - YouTube
Last edited by rcgldr; 08-05-2016 at 04:43 AM.
I've developed a fondness for Go. It lacks many of the features of C++ that I love (operator and function overloading, templates), but it makes up for that in a number of areas. If you haven't checked out Go, I suggest you give it a try.
What can this strange device be?
When I touch it, it gives forth a sound
It's got wires that vibrate and give music
What can this thing be that I found?
Sorry, didn't mean to make a thread that sounded like flame bait.
I've heard good things about Go. A famous JavaScripter left Node for Go, actually. I don't blame him.
I've thought about Ada. I looked into it a little bit but I'm not sure.
The things I like about C++ is that it's so versatile. I think it combines imperative, object-oriented and functional paradigms very adequately. Plus, it's fast, got a strong type-system and still allows you to access low-level features. It's an all-around good tool that grows with you which is what makes it attractive to me.
I've purposely tried to do more tasks in Perl, Python and C# lately. I'd say I'm used to C++ and I agree it can be useful, but I'm enjoying languages with richer libraries now. I just wish I wasn't so bad at programming so I could arrive at good solutions faster in non-C-derived languages
I've been considering Ada lately. I am getting a little past PLC programming and looking more at embedded and whatnot, and the safety aspects of Ada are attractive for that type of programming, to me.
I've heard this before, definitely.
Which is funny too because I've implementing some basic matrix routines myself and I've really been enjoying the C++ approach where I create a Matrix class. Using things like operator and function overloading making working with it very enjoyable. Plus, I can template it and things like enable_if checks and all this jazz.
This is why anyone who does a lot of work with math + any dimension arrays would like Fortran, because it's already done for you. Math operators already work out of the box with arrays. And you can't beat the array subscripting either. It's basically the ease of use of MATLAB but with a compiled language.
Examples:
Concurrency is built-in to the language in several ways, with FORALL, DO CONCURRENT, and coarray Fortran, among other things.Code:! array addition x = x + dx ! calculate the L2norm of an array of residuals res = SQRT(SUM(r**2)) ! or if you use gfortran + GNU extensions res = NORM2(r) ! using array subscripting to set up the edges of a grid; first line sets the whole array to zero p = 0 p(1:k-n+1:n) = 500*EXP(-50*(1 + y**2)) p(n:k:n) = 100*(1-y) + 500*EXP(-50*y**2) p(2:n-1) = 500*EXP(-50*(1-x(2:n-1))**2) + 100*x(2:n-1) p(k-n+2:k-1) = 500*EXP(-50*((1-x(2:n-1))**2 + 1))
Interesting. There's a lot of stuff that I wouldn't need Fortran for. But it'd be nice if I could write all these back-end math functions in Fortran, call them from CUDA C code and then just make it all work. I'm not sure if the tools are available for all that though. I'll have to do some research and then see if it's possible to link Fortran with C for CUDA.
It's only good if you have to do a ton of math with a lot of arrays. OOTB built-in facilities make code much cleaner and more concise. The code is very human readable. Otherwise though, another programming language is probably a good choice.
Edit: I'm going to keep slowly jabbing you with Fortran until you try it, simply because you're always mentioning meshing and other things related to scientific/numeric computing.
Last edited by Epy; 08-05-2016 at 02:33 PM.
I'm also curious if I'd even see _that_ much of a speed-up. The math is largely stack-based and meant for relatively small matrices (5x5 at the largest).
Though Fortran may not be applicable for this one application, it sounds like there's a lot of other features that would make it attractive. Namely, the syntax, inclusion of mathematical routines and the execution policies.
I know C++17 is supposed to be getting those as well but still, it's nice knowing that Fortran would be a good alternative.