martedì 17 marzo 2009

Hello Planet

Hello everyone,

I finally added my blog to the PlanetKDE, so here is the obligatory "Hello Planet" post.

First of all something about me: I'm an italian PhD student in Physics. I get to deal routinely with simulations and numerical analysis, which in my field means mostly FORTRAN. If you ever dealt with that you can probably feel my pain. I stick to C++ whenever I can, and in these cases Eigen is a life saver.

But sometimes I have some task which is not performance critical and is better suited for a scripting language. Then my choice is Lua.

My contributions to KDE include three things: Qt bindings for Lua, called "lqt" (with the help of Peter Kümmel), a tool that transforms C++ into XML ("cpptoxml") and a Kross backend for Lua named "kloss". I know, I suck at names...

If you look at the logs (or the fine graphics created by Paul Adams) you will notice that I commited two or three times in a several months period (my account dates from the KDE Bindings meeting in summer 2008). That is because I mostly develop in a separate repository and then commit a lot of changes at once.

You can find the most recent source of lqt here, with the most up to date version of cpptoxml. The Kross backend is kept in playground/bindings/kloss.

I plan to talk about what is lqt, how it works and what are our plans in the next posts.

I will also occasionally talk about how I hate FORTRAN, dislike C/C++ and feel the whole world should get rid of any other language to adopt Lua in every possible situation. Random ideas that somehow manage to evade the sanity filter may be spotted too...

10 commenti:

dhaumann ha detto...

Could xmltocpp be used for code completion in e.g. Kate?
There are other projects like icomplete from vim (also used in QDevelop), gccxml, KDevelop's parser and QtCreator's parser.
I still dream of a decent code completion for Kate that works good enough :)

Mauro Iazzi ha detto...

Sure it could.

I think KDevelop guys are thinking of using it in this way, since they asked for a copy in kdesupport.

Anonimo ha detto...

Actually, I also used to hate Fortran during my PhD (numerical physics too...), partly because most physics codes are, say, messy.

However, it turns out to have 3 major advantages :
* performance (when compiled with other compilers than gfortran, that is) always at least as good as highly tuned C/C++ code
* very comfortable to use for numerical calculations
* totally straightforward to call from python (f2py) and perhaps other scripting languages too.

So I settled to using fortran exclusively for computation-intensive parts and python for the remaining 90%. And I'm now pretty happy with it...

Just my 0.02€

Mauro Iazzi ha detto...

@Nicolas:

I understand why it is used and that it is very performant. Probably the fact that a C++ compiler is so difficult to write has something to do with this.

I was speaking mostly of coding style and readability. In this sense physics is filled with unreadable old code that takes ages to be understood.

Almost every research group here has a "totem" program several decades old. I suspect that all in all they are very inefficient, but no one is able to fix them.

Unknown ha detto...

As I understand the current situation of the code parsing tools for QtCreator, QtJambi, QtScriptGenerator, Amarok, and lqt: they all base on code initially written by Roberto Raggi. Seems he is currently involved in QtCreator.

Best would be to split out one code base which could be used by all the other projects. Or making it a official Qt tool, with a nice API, this would be cool.

Does Roberto already have a Creative Friday project? ;)

Unknown ha detto...

Found this in QtCreator's README:

Third-party components
======================
QtCreator includes the following third-party components,
we thank the authors who made this possible:

* Open Source front-end for C++ (license MIT), enhanced for use in Qt Creator
Roberto Raggi
QtCreator/src/shared/cplusplus

Unknown ha detto...

And here some details about the parser from Roberto,
http://apaku.wordpress.com/2008/11/01/qt-creator-or-what-qt-software-wants-from-a-qt-ide/

"Qt Creator features a new much improved version of my C++ front-end.

The new front-end is designed with semantic checks and code refactoring operations in mind :-) cool thing is - it’s going to be Open Source pretty soon, and I hope you guys will take some time and look at it. I didn’t really had much time to implement the code completion engine in Qt Creator. Actually, we did most of it in 2-3 weeks, that’s why you can clearly see that a lot of stuff is missing, but it already shows the potential of our C++ engine."

Related:
http://labs.trolltech.com/page/Projects/Compilers/QLALR

Anonimo ha detto...

Probably the fact that a C++ compiler is so difficult to write has something to do with this.

Certainly, but I think that the main "problem" is that there are no arrays in C++ language (only as array classes/templates). Therefore, some information on the use of the allocated memory is lost that make corresponding optimizations impossible.

Moreover, the brightest features of C++ are either numerically expensive (virtual calls...) or of little use for intensive computation (which again is always a minor part of most codes).

I was speaking mostly of coding style and readability. In this sense physics is filled with unreadable old code that takes ages to be understood.

I totally agree with you... but unfortunately, I'm afraid this has nothing to do with fortran.

After all, there is "goto" in C++ too...

All I can say is : welcome and good luck ;-)

Almost every research group here has a "totem" program several decades old. I suspect that all in all they are very inefficient, but no one is able to fix them.

Those I've seen are numerically very efficient, bun usually unmaintainable.

Mauro Iazzi ha detto...

@nicolas:

I sincerely hope that physicists' bad coding style is due to FORTRAN, instead of them being bad programmers :)

however since FORTRAN does not help to write a consistent API, I have seen some routines that constantly rearranged vectors for different functions...

After a while those things may hurt performance a lot.

Anonimo ha detto...

[url=http://www.23planet.com]casinos online[/url], also known as admired mark casinos or Internet casinos, are online versions of forefather ("chunk and mortar") casinos. Online casinos own gamblers to support up and wager on casino games because of the Internet.
Online casinos typically make an indecent up as a replacement mission of these days odds and payback percentages that are comparable to land-based casinos. Some online casinos label the harmony higher payback percentages with a nick it space gismo games, and some proclaim payout correlation audits on their websites. Assuming that the online casino is using an correctly programmed unspecific epitomize up generator, gaming-table games like blackjack curb an established forebears edge. The payout plot stalk of these games are established erstwhile the rules of the game.
Uncounted online casinos sublease or allot their software from companies like Microgaming, Realtime Gaming, Playtech, Intercontinental Sophistry Technology and CryptoLogic Inc.