Functional programming languages and Qt
-
The problem with Scala+Jambi is that the Qt classes (for example for collections) are not scala's collections and they will not have folds and similar.
I'm currently working on a small Qt addon library [1] to allow you to develop in Qt/C++ with some of the funtional concepts.
It will have greedy and lazy evals for most of the things, and whatnot. It is currently not in open development, but it will become soon, and it will be published under LGPL or some BSD-like license.
Obviously, this is not really a functional language, but lambdas in C++2011 brought some new very nice possibilities.
[1] http://ivan.fomentgroup.org/blog/category/qt-functional/
-
New C++ standard defines lambda support, so you will have Qt with functional language integrated... for free!! :-)
You have to wait only for a little time... -
Not really, if Qt doesn't have the APIs for lambdas and functors, you will not have too many places to use lambdas in your code.
At the moment, there's work being done for QObject::connect to work with lambdas. Lets hope it will get into Qt 5.
-
-
Anyone tried using Qt Jambi with "clojure":http://clojure.org?
-
[quote author="Ivan Čukić" date="1312874479"]Not really, if Qt doesn't have the APIs for lambdas and functors, you will not have too many places to use lambdas in your code.
At the moment, there's work being done for QObject::connect to work with lambdas. Lets hope it will get into Qt 5.[/quote]
And of course, you will be able to use them with QtConcurrent (works fine already with Boost's implementation). What is missing, do you think?
-
[quote author="Andre" date="1314860619"]What is missing, do you think? [/quote]
The missing is the stuff that I'm trying to address with QtFunctional - functional way of dealing with the collections - stuff like list.filter(some lambda), ... lazy evaluation for things ...
-
[quote author="Ivan Čukić" date="1314867006"][quote author="Andre" date="1314860619"]What is missing, do you think? [/quote]
The missing is the stuff that I'm trying to address with QtFunctional - functional way of dealing with the collections - stuff like list.filter(some lambda), ... lazy evaluation for things ...
[/quote]
If you get anything usable done, maybe we could generate Jambi bindings for it... So those using Scala could use this, or maybe in Java, hack some support for it somehow... Would be very interest at least.
Java 8 is said to get lambdas, so atleast something can be done, if not doing anything for actual model Jambi works for example with signals and slots.
-
Not sure how plusable would jambi bindings for this be since the library is overly template based, but yes, if it turns out to be possible, scala+qt would be quite awesome.
-
Templates just need manual mapping; if there is common idiom, I guess some kind of automation could be done for common types... All speculation without the library to convert, though :)
-
-
I have no clue how would you map things, but from my standpoint, it doesn't seem possible. Templates here are used for things that java generics can't do... heck, not even all C++ compilers can process the code :)
The library is at http://gitorious.org/qt-functional
Not sure how many more improvements it will receive in the next period. Hoping I'll have the times to work on it again in a few months.
20/20