| 1   2     3   | Next
maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Vala for Maemo development (https://talk.maemo.org/showthread.php?t=18968)

Bundyo 2008-04-10 21:07

Vala for Maemo development
 
I'm playing lately with Vala and Cairo and got interested - does any of you use Vala for Maemo/Hildon development and what are your overall thoughts on the language.

Also i'm searching for a good Vala IDE if there is any (upgrading to Gnome 2.22 now to try Anjuta 2.4)?

TA-t3 2008-04-11 09:02

Re: Vala for Maemo development
 
I started to look at Vala some months ago, and compiled a few test programs. Since then there's been progress, the language has evolved and there are more bindings. What looks really nice is that there's a Hildon binding (the OS2008 kind, not the OS2007 kind, which is why I haven't written anything yet that'll execute on my N800), and what's more - Debian (for the desktop) now includes full Hildon, so the application I started on a while ago compiles and run on my Debian computer - hildonized and all. When the time comes it should be just a recompile to make it run on my N800 (when I get around to switch to OS2008).

As for IDEs, I don't personally care much for those, I just need an Emacs binding. For now C-mode works close enough, but I'm sure someone has a Vala binding somewhere.

fanoush 2008-04-11 09:12

Re: Vala for Maemo development
 
I tried few small things with D-BUS. This is really pain to do in C and I still consider python a bit bloated and complex to install on device for average person (until we have supported it officially and with the promising quick launcher) so Vala is best fit for stuff like replacement of kbbd with a bit of UI etc. Current 0.2.0 seems to compile in chinook again. Too bad we don't have vala for Bora (OS2007HE). I hope that they at least won't move faster than IT200x in minimal glib/gtk/whatever version support.

Bundyo 2008-07-09 05:43

Re: Vala for Maemo development
 
I've found out that MonoDevelop has a Vala plugin and along with the features and project support of the IDE you can have a very good working environment. As I understand you can even setup the project build to be done in scratchbox, since it uses scripts for that. I'll update the thread when i know more.

Jaffa 2008-07-09 11:48

Re: Vala for Maemo development
 
I've bundled vala and libgee into Extras-devel using mud, and will promote them to Extras - after some further testing - hopefully this weekend along with a simple demo app.

Personally, I'm quite excited about Vala for the tablets: the advantages of a high-level language (like C#, Java or Python) with none of the downsides.

IDE support would be good, but there are plugins for GEdit which help with internal navigation.

lcuk 2008-07-09 11:53

Re: Vala for Maemo development
 
Quote:

Originally Posted by Jaffa (Post 200834)
IDE support would be good, but there are plugins for GEdit which help with internal navigation.

On device IDE or external in scratchbox?

Bundyo 2008-07-09 11:57

Re: Vala for Maemo development
 
External outside of scratchbox, but if Geany adds support for Vala, you can have it on the device. Vala compilation on device will be very slow though.

Bundyo 2008-07-09 12:05

Re: Vala for Maemo development
 
Quote:

Originally Posted by Jaffa (Post 200834)
Personally, I'm quite excited about Vala for the tablets: the advantages of a high-level language (like C#, Java or Python) with none of the downsides.

I've been eyeing Vala for a while and i'm hopeful Nokia can notice the potential it has. The lack of documentation and proper tools are a problem for its current usage, but if grown properly this language can singlehandedly boost maemo development in the future.

Baloo 2008-07-09 18:32

Re: Vala for Maemo development
 
Quote:

Originally Posted by Jaffa (Post 200834)
Personally, I'm quite excited about Vala for the tablets: the advantages of a high-level language (like C#, Java or Python) with none of the downsides.

Indeed, vala is an interesting prospect although I get a feeling that python is 'old' now so the cool kids are moving on to the next new hip thing.

Benson 2008-07-09 18:34

Re: Vala for Maemo development
 
No, Python is ******ed now, same as it's always been. :p

Subjective flamebait aside, certainly some people want to always play with a new language, but I do think that's a small factor in this area.

Baloo 2008-07-09 18:47

Re: Vala for Maemo development
 
Quote:

Originally Posted by Benson (Post 201000)
No, Python is ******ed now, same as it's always been. :p

Subjective flamebait aside, certainly some people want to always play with a new language, but I do think that's a small factor in this area.

Vala is definitely in its infancy and to be honest I don't see what the fuss about it. It may become a great language over time (probably not) but I'm definitely sitting on the fence with this one.

Bundyo 2008-07-10 07:33

Re: Vala for Maemo development
 
The fuss is that Vala can offer simplicity, speed and OO at the same time.

So back on the original topic - i did automate building Vala projects in scratchbox and running them on tablet directly from Monodevelop (will work with every editor that can run scripts).

Firstly - use WAF - its faster than autotools, simpler and supports Vala. Vala template here.

You will need ssh passwordless login with key - instructions here.

Use the WAF template to create your project in scratchbox, edit to your liking, create a solution in Monodevelop with the root dir in the your project dir in scratchbox (/scratchbox/users/[user]/home/[user]/[your-project-dir]), check the project option to auto add the files in the folder, reload it.

Add this build and execute commands in Monodevelop project options:

Build:
Code:

/scratchbox/login -d ~/[your-project-dir] -p ./project-build.sh
Execute:
Code:

/scratchbox/login -d ~/[your-project-dir] -p ./project-run.sh
Create executable project-build.sh and project-run.sh in [your-project-dir] with these contents:

project-build.sh:
Code:

#! /bin/sh

cd ~/[your-project-dir]
./waf configure
./waf

project-run.sh:
Code:

#! /bin/bash

scp ~/[your-project-dir]/_build_/default/[your-path-and-executable] root@[your-tablet-ip]:/usr/bin/
ssh user@[your-tablet-ip] '/bin/sh --login -c "/usr/bin/[your-executable]"'


EDIT: Forgot to mention - I'm using Monodevelop 2.0 alpha 1

Jaffa 2008-07-10 14:22

Re: Vala for Maemo development
 
I've uploaded vala to extras-devel. Build log is at:

https://garage.maemo.org/builder/diablo/vala_0.3.4/

I've done a quick command line test, I might not have time to test it with the Hildon bindings today, so any feedback welcome.

luca 2008-07-10 18:33

Re: Vala for Maemo development
 
Quote:

Originally Posted by Bundyo (Post 201170)
The fuss is that Vala can offer simplicity, speed and OO at the same time.

Oh, I see, like delphi did almost 15 years ago ;) (alas, I doubt that vala can be as good as delphi, maybe in 15 more years...:D).
Pity that fpc doesn't work right with armel yet :(

Baloo 2008-07-10 18:43

Re: Vala for Maemo development
 
Quote:

Originally Posted by luca (Post 201398)
Oh, I see, like delphi did almost 15 years ago ;) (alas, I doubt that vala can be as good as delphi, maybe in 15 more years...:D).
Pity that fpc doesn't work right with armel yet :(

Lets not get into a language debate. Having programmed for around 18 years in a wide variety of languages (I programmed on a z80 commercially for 6 years straight! :() I can safely say that you get lovers and haters of any language. We can debate semantics for hours but I learnt early on that you cannot convert the inconvertible in most cases.

I think the 'horses for courses' argument is best, select the best tool for the job. (BTW I have to fly to another country next week to debate the merits of Python on a particular project :D)

Vala may be the answer in some cases but, from a purely technical point of view, I'm on the fence.

Great work on the port though!

Bundyo 2008-07-10 18:48

Re: Vala for Maemo development
 
I doubt Delphi is coming back... :(

What port? Vala compiles straight for the tablet/SDK. Even has some bindings on the official page.

Baloo 2008-07-10 18:52

Re: Vala for Maemo development
 
Quote:

Originally Posted by Bundyo (Post 201413)
What port? Vala compiles straight for the tablet/SDK. Even has some bindings on the official page.

Quote:

Originally Posted by Jaffa (Post 201267)
I've uploaded vala to extras-devel. Build log is at:

https://garage.maemo.org/builder/diablo/vala_0.3.4/

I've done a quick command line test, I might not have time to test it with the Hildon bindings today, so any feedback welcome.

Am I miss-reading Jaffa's comments?

luca 2008-07-10 20:05

Re: Vala for Maemo development
 
Quote:

Originally Posted by Bundyo (Post 201413)
I doubt Delphi is coming back... :(

Probably not, but Lazarus is going forward at a steady pace.

Lee 2008-07-11 16:34

Re: Vala for Maemo development
 
I am starting to feel like modern languages need support for concurrency. Stackless Python is a good example. I've written so many state machines in my time that mimic this behavior that I feel it should be standard. Although I wish Stackless Python would automatically take advantage of symmetric multiprocessing (although python doesn't have rock solid threading in general :P).

Jaffa 2008-07-11 19:30

Re: Vala for Maemo development
 
Quote:

Originally Posted by Bundyo (Post 201413)
I doubt Delphi is coming back... :(

What port? Vala compiles straight for the tablet/SDK. Even has some bindings on the official page.

It compiles straight and cleanly, as you say. Still needs to be in extras for other apps to use it for building.

Besides, it makes a good test of mud-builder given the package is entirely defined by:

Code:

<package>
  <fetch type="tarball">
    <url>http://download.gnome.org/sources/vala/0.3/vala-0.3.4.tar.bz2</url>
  </fetch>
  <build>
    <copyright>lgpl</copyright>
  </build>
  <deb prefix-section="0">
    <section>programming</section>
    <depends>c-compiler</depends>
          <description>Vala is a modern programming language compiling to C.
Vala is a new programming language that aims to bring modern programming language
features to GNOME developers without imposing any additional
runtime requirements and without using a different ABI
compared with applications and libraries written in C.
.
Given its dependence on gcc, this is intended for use within the Maemo
SDK.</description>
  </deb>
</package>


Jaffa 2008-07-12 10:16

Re: Vala for Maemo development
 
Quote:

Originally Posted by Bundyo (Post 201170)
The fuss is that Vala can offer simplicity, speed and OO at the same time.

Agreed.

Quote:

So back on the original topic - i did automate building Vala projects in scratchbox and running them on tablet directly from Monodevelop (will work with every editor that can run scripts).
I think what sets aside a good language from a great language is tools. That's why I increasingly prefer Java to Groovy/Python/Ruby or - shock horror - Perl.

Vala, being a statically typed, compiled language can have the same powerful IDE support that Java has. The other thing which distinguishes a good platform is the libraries. The port of Java's Collections API to libgee, making it usable from Vala was a great idea IMHO.

Anyway, back to IDEs. Eclipse has spoilt me, so my ideal Vala IDE would be similar (possibly even an Eclipse plugin - why develop all the accoutrement rather than concentrate on the language itself). Can Monodevelop/Anjuta/Val(a)IDE do:
  • Syntax highlighting
  • Outline view of the current class/file.
  • Code complete for classes/methods in the same file
  • Code complete for classes/methods in the same project
  • Code complete for classes/methods in included vapi files
  • As-you-type compilation and error reporting
  • Interactive debugging in the IDE using breakpoints, with variable inspection etc.
  • Refactoring of method signatures/classes with the changes rippled through the rest of the project
  • Management of dependent VAPIs
  • Production of a waf config/Makefile or something which can be used to build the project (including the pkg-config lines etc) outside of the IDE

Gedit does the first one. With a plugin, it does the second - ish.

I'd be very happy to push - or even help develop - plugins for a proper IDE to do that: I think it'd give the tablet a really powerful development tool. Dynamic languages like Ruby and Python can't easily have the same powerful IDE support (due to the exact same features which make them so powerful for the other tasks).

TBH, it doesn't matter what the language is: if there's an easy to use IDE with a powerful modern programming language, we might see a lot more apps being developed.

Bundyo 2008-07-12 12:00

Re: Vala for Maemo development
 
Completely agree with you.

There is a good free/non-free IDE for Python/Ruby/Perl - Komodo, not as good as Eclipse, but it has the main things in place. Vala however still has nothing. Val(a)IDE is far from being usable and i couldn't find anything else than Monodevelop, Emacs and VI support for it. Monodevelop is closer to what i want it to do, but its Vala plugin is targeted to the 2.0 alpha and doesn't have even code completion yet. And code completion is one of the important things to have when learning a new language. At least it has project support in place, along with syntax highlighting and other goodies supported by the IDE and not related to Vala. And as much as i like Eclipse for its other features, its project system is really convoluted.

Then again, maybe Monodevelop Vala plugin has completion, but i wasn't successful in activating it.

EDIT: This is interesting:
http://mail.gnome.org/archives/vala-...er/001093.html

Jaffa 2008-07-12 14:02

Re: Vala for Maemo development
 
Yeah, I'd seen that thread. Unfortunately it doesn't seem to go anywhere and the original poster's website makes no mention of Vala at all.

My attempts to get Monodevelop working seem to have stalled: it's all compiled, but fails to startup properly:

Quote:

Extension node not found in path: /MonoDevelop/Ide/Commands
There's an Eclipse plugin for Vala, called Valable which has basic syntax highlighting, but doesn't seem to have had any commits recently. Got it running, but there's nothing it gives over Gedit at the moment.

Bundyo 2008-07-12 16:55

Re: Vala for Maemo development
 
Nightly sources and openSUSE rpms here:
http://mono.ximian.com/monobuild/sna...ownload-trunk/

I'm using them, what distro are you on?

EDIT: Something with apt-get it seems :)

EDIT EDIT: Seems i've been mistaken, the class browser is working. At least i can browse the Libosso VAPI (I updated the libosso VAPI originally made by one of the Canola guys to work with 0.3.4, should i upload it somewhere, i'm also trying to create a VAPI for hildon-desktop, but it looks like i should first go through some Xorg libs).

EDIT EDIT EDIT: Strangely enough i can only see libosso (which is a VAPI i keep in the project structure). There is also autocompletion for it... That can only mean two things: bug or i'm not doing something right.

And another: After i copied all VAPIs in my project folder (symlink won't do), i have completion and class browser working. :)

Jaffa 2008-07-12 19:49

Re: Vala for Maemo development
 
Yeah, using Ubuntu 8.04.

Will try running alien across those nightlies.

Interesting that you can get code complete & browsing across VAPIs within your project structure. Either it's supposed to do it and doesn't know where your system-wide VAPIs are, or it should be a trivial addition to make it work. Alternatively, do you need to add the package in an equivalent of a Java project in Eclipse's Project Properties > Build path > Libraries?

With regard to VAPIs, we were discussing in #maemo about how it should be possible to auto-generate at least a static, procedural API for any given library and .h - probably after at least cpp has done its job (and maybe there's an even better point in the gcc chain in which to intercept and get some data). This'd help with the X.org libs...

For an updated libosso - is the existing one somewhere online? If so, a small patch in mud-builder for it would do, and handle the debianification of it. Alternatively worth submitting upstream? I get the impression that bundling more VAPIs isn't going to be something they're going to reject. Failing that, is it worth a Garage project?

Bundyo 2008-07-12 20:11

Re: Vala for Maemo development
 
There is Project Options -> Code Generation -> Libraries/Paths. I didn't specify any libs, but i specified the path of libosso and also the general vapi path. Seems it doesn't work with the latter. Kinda buggy yet. When i only had libosso in path, Monodevelop showed it in the class browser and i had completion. Now that i have all the libs in the path, class browser works (updates not very fast and i have to click refresh to get the ahole list in the end), but code completion refuses to show up. Maybe some overflow, will test it more.

About the VAPIs - the process of vapi generation is somewhat automated and can be fully so maybe with a list of libs and namespaces. VAPI metadata files can help even more as to define the variable types in the libs, so that they can be easily rebuilt on the next release. The process of generation is described here, although not very detailed. You can get all types of errors there, like duplicate signal and method names for instance :)

libosso.vapi is available online (in several versions), so patch will be best (i didn't do much). And yes, Vala project probably will benefit from a growing vapi repository.

Jaffa 2008-07-13 06:34

Re: Vala for Maemo development
 
Quote:

Originally Posted by Bundyo (Post 202266)
About the VAPIs - the process of vapi generation is somewhat automated and can be fully so maybe with a list of libs and namespaces. VAPI metadata files can help even more as to define the variable types in the libs, so that they can be easily rebuilt on the next release. The process of generation is described here, although not very detailed. You can get all types of errors there, like duplicate signal and method names for instance :)

Indeed, but my reading of that - and the manpage - suggests that vapigen can only be used on libraries based on GObject so you can use introspection. There seems to be no mention of automatically converting any library - which is what you'd need for a starting point for the X.org libs.

Bundyo 2008-07-13 06:59

Re: Vala for Maemo development
 
Yes, you are right, hadn't thought of that.

Bundyo 2008-07-13 13:18

Re: Vala for Maemo development
 
Just generated VAPI from the smallest X11 include - Xmd.h, seems to work OK, dunno if it will be usable, but I'm gonna try at least to get hildon-desktop VAPI built.

Bundyo 2008-07-13 21:27

Re: Vala for Maemo development
 
I generated a X VAPI, but Vapigen is generating x_[something]_free() for default free function, but as far as i can see, X uses destroy_[something](). I can declare them by hand (there's a free_function declaration in the VAPI)... but that would require much time... Will see if there is any pattern in the function names and if some regular expression can help...

EDIT: Doesn't work with destroy_[something](). However it works with simple free() and i'm able to compile, but can this lead to not freeing resources effectively?

Jaffa 2008-07-14 12:47

Re: Vala for Maemo development
 
Quote:

Originally Posted by Bundyo (Post 202618)
I generated a X VAPI, [...]
EDIT: Doesn't work with destroy_[something](). However it works with simple free() and i'm able to compile, but can this lead to not freeing resources effectively?

Dunno, I've never done that much low-level X handling. My guess is that free() is freeing the memory allocated to that object, but that destroy_...() will also clean up references in other data structures. So, if I had to guess, I'd say free() on its own will leak memory, yes.

Haven't tried the nightlies yet: how many packages make up one IDE?! Sheesh... [EDIT: these 1.9.1 backports look quite handy for Ubuntu]

Bundyo 2008-07-14 13:17

Re: Vala for Maemo development
 
Yes, but destroy_image() for instance takes two parameters and probably that is the reason why it doesn't do its destruction magic. Another thing i noticed - vapigen inserts only one header filename for the whole VAPI, even though i used a whole bunch of headers for vala-gen-introspect. Maybe I'm doing something wrong.

:) The IDE is only one package, but the framework is quite a number. That's one of the reasons why I don't like .NET.

lcuk 2008-07-14 13:25

Re: Vala for Maemo development
 
The C functions in X11 are called not just to free the base memory but to also free anything linked under them.
This is similar to most other APIs as well.

Where a distinct cleanup function is provided for instance data you should use that and must not call free(...) on that memory unless explicitly told otherwise.


for instance, in liqbase i close up the x server:

int xv_canvas_close()
{
XShmDetach(dpy,&yuv_shminfo);
XFreeGC(dpy,gc);
XUnmapWindow(dpy,window);
XSPSetTSRawMode(dpy, False);
XDestroyWindow(dpy,window);
return 0;
}



(I hope i've not got the wrong end of the stick with this thread, you are automatically creating bindings to the x11 libraries for use in vala)

Bundyo 2008-07-14 13:30

Re: Vala for Maemo development
 
As it turns out it can't be done automatically :) At least not for not GObject based libs.

I wonder if it is possible at all, since as i see it, X destroy functions are using two parameters and Vala uses one, but that may be configurable.

EDIT: Then again, HildonDesktop needs only some functions and structs to generate, maybe i can add them by hand with specific header links (most are in Xlib.h i think). This can probably create a conflict when a real X VAPI arrives.

fpp 2008-07-14 17:28

Re: Vala for Maemo development
 
It would be great (at least for brace-challenged coders :-) to have a python-to-vala translator+compiler. Doesn't look totally impossible, either...

Bundyo 2008-07-14 18:13

Re: Vala for Maemo development
 
Python to C would be faster :) Since Vala is converted to C before compilation :)

Jaffa 2008-07-15 12:24

Re: Vala for Maemo development
 
Python->Vala would be easier though ;-)

What's a more interesting idea, though, is using existing OO bindings for libraries - say from Python - to generate VAPI files for Vala.

Jaffa 2008-07-24 22:48

Re: Vala for Maemo development
 
Update: after struggling to get MonoDevelop 2.0 alpha built & running; and then failing to get it doing anything with Vala, I decided to look more closely at Valable, an Eclipse plugin.

After a few nights of hacking it now does:
  • Auto-determination of packages to include in build from "using ...;" lines (no need to futz around with pkg-config)
  • Incremental builds (edit a file, press Save and only the necessary files get rebuilt, before whole project is relinked)
  • Compile failures shown in editor on correct line
  • Basic code-complete

This is in addition to the syntax highlighting and smart editing it already did. One possibly major limitation is that a project can only have a single main() method, otherwise gcc complains when it tries to link the object files.

http://www.bleb.org/software/valable/valable-1.png
http://www.bleb.org/software/valable/valable-2.png
http://www.bleb.org/software/valable/valable-3.png

My primary aims next are:
  1. Improve code complete (context sensitive, include available packages etc.)
  2. Test Maemo integration, e.g. with Scratchbox to build Hildon binaries.
  3. Make it output a simple shell script which can be used to rebuild the project outside of Eclipse (e.g. a source package for the autobuilder)
  4. Figure out how to use Launchpad better, so I can see about getting it committed as a branch.

darklajid 2008-07-25 19:02

Re: Vala for Maemo development
 
Running MonoDevelop was no problem here, but so far I cannot really find a way to activate code completion or anything other than syntax highlighting, really.
That eclipse plugin seems to be abandoned, unfortunately. At least that's what the main branch says:
https://code.launchpad.net/~jprieur/.../valable.devel
So - vim for now here.

Jaffa 2008-07-25 19:17

Re: Vala for Maemo development
 
My changes to the plugin have been pushed into a branch:

https://code.launchpad.net/~aflegg/valable/jaffa

I've also made contact with the other developers to make sure we're not duplicating any work.

Current focus: trying to access libvala through Java (by converting the vala-1.0.vapi into something JNA can handle) so that code complete can be as intelligent, and context-sensitive, as we're used to in Eclipse.


| 1   2     3   | Next
All times are GMT. The time now is 07:20.

vBulletin® Version 3.8.8