<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 10 November 2013 15:44, Matthew Brush <span dir="ltr"><<a href="mailto:mbrush@codebrainz.ca" target="_blank">mbrush@codebrainz.ca</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi all,<br>
<br>
In the spirit of the previous discussions about using C99 and C++ in Geany code with similar subject lines, I'd like to take a poll/discussion for allowing the use of Vala for new/re-written Geany code. The pros and cons likely will be slightly biased since I would obviously like to use Vala in Geany, but here they are anyway:<br>


</blockquote><div><br></div><div>To help allay your concern about bias I have commented on a few below :)</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">



<br>
Pros:<br>
-----<br>
<br>
* Power of high-level OOP language using existing GObject backend with no C boilerplate required<br>
* Uses same type-system as existing C code<br>
* Automatic memory management<br></blockquote><div><br></div><div>Reference counting, not memory management, ie non-cyclic structures only, fine for GTK GUI structures, but not any old structures.  And of course it only applies to structures that support reference counting, not simple types as used in most of Geany.</div>


<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
* Clean expressive syntax (foreach, as, properties, signals, async, etc.)<br>
* Exceptions (which uses C/GError-style exceptions in generated C code)<br></blockquote><div><br></div><div>Existing Geany code is not exception safe so this can't be used until all existing code is changed, see the C++ discussion for details.</div>


<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
* No extra dependency for release users (generated C code can be shipped)<br></blockquote><div><br></div><div>But is unusable since its machine generated, ie we can't tell how it will change from Vala version to version, leads to problems like the Glade commit noise if its in the repository, but maybe it could be in the tarballs.  But of course you can't fix anything without vala since you would need Geany from git.</div>


<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
* Can generate Gobject-Introspection bindings automatically allowing use from a bunch of cool languages like Python, JavaScript, etc (and as many other languages as support Gobject-Introspection) for plugins.<br></blockquote>


<div><br></div><div>But only for those parts of Geany that are gobjectified, which is almost none ATM, Geany object only IIUC.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">



* Easy to learn for anyone who's used C++, Java, C#, etc.<br></blockquote><div><br></div><div>Its got {} so it *must* be the same (sorry :) in the end its just another object oriented language with its own quirks.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
* Uses all existing dependencies as its runtime library (ex. GLib/GIO).<br></blockquote><div><br></div><div>Good point.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

* Can generate C/H code that is usable from within existing C code, so no requirement to completely re-write, can just add on modular code as needed.<br></blockquote><div><br></div><div>But heavily restricted Vala code because it has to interact with existing C code, much care needed.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
* Can be tuned to output optimized C code, or call optimized C code quite easily<br>
* Can sometimes generate clever and/or optimized code that would be tedious to write in C.<br></blockquote><div><br></div><div>*All* code is tedious in C/C++/Java/ etc :)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

* Has Autotools and Waf support already, and using from plain GNU Make is trivial.<br></blockquote><div><br></div><div>How well does the windows version work, is it up to date, since it includes Glib and GTK which versions are they, and do they match ours?  The binaries for windows vala available seem to be 0.12, even my LTS Linux has 0.14, 0.16 and 0.18 valac available, more version hell and windows issues :(</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
* Actively developed and supported, and having active mailing list and IRC channels. (ex. it's easier to submit a patch to Vala language than ISO C).<br>
* AFAIK it generates C89-compliant code :)<br>
<br>
Cons:<br>
-----<br>
<br>
* A fairly new language (since 2006). It's hard to argue against this, but also impossible to move forward without adopting new stuff at some point.<br></blockquote><div><br></div><div>And not yet complete (by its own admission).</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
* Some dark corners/bugs due to being such a new language (compared to C/C++).<br>
* Actively developed so sometimes we probably have to require specific valac versions to support certain features (ie. nothing like c89, c99, c++98, etc but not unlike supporting newer G* versions).<br></blockquote><div>
<br></div><div>More version hell, just what we don't need.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

* As with above, may require to use fairly modern/specific dependency versions of the G* C libraries (ex. might not work on RHEL or some other LTS distros).<br></blockquote><div><br></div><div>So how do we handle windows?  Of course we could drop it :)</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
* Extra dependency (valac) for maintainers/developers.<br></blockquote><div><br></div><div>So long as its a version thats in LTS repos and has available binaries for windows that doesn't matter.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

* Using non-GLib-based libraries requires to write boring but trivial binding .vapi files (not huge deal for existing Geany code).<br></blockquote><div><br></div><div>Well, you already have done that for the plugin API IIUC, but still would be needed for the rest of Geany.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
* Can sometimes generate heap-heavy or non-optimized code.<br></blockquote><div><br></div><div>So does some of our C code ;)  I doubt its a significant issue.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

* Can sometimes generate C code that causes warnings with common compiler warning flags, would require to disable some compiler warnings on generated C code to have a completely clean build (ex. use -w on all .vala code)<br>
</blockquote><div><br></div><div>Ok if autotools and waf do that for the vala C code, but the existing Geany C code still needs pedantic settings.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">



* The documentation isn't as great as an ISO language that existed since forever. The official language specification isn't as complete or fleshed-out (ex. has TODOs) as an ISO language. There is lots of documentation out there, for example on the official Wiki, but it's still no substitude for definitive language reference and decades of books/literature on the subject.<br>
</blockquote><div><br></div><div>The draft manual at <a href="https://wiki.gnome.org/Vala/Manual">https://wiki.gnome.org/Vala/Manual</a> is a good deal better than the "official" version, it looks almost usable.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


* More people know C than C++/C#/Java (ie. style of Vala). IMO, this one is untrue since people who use C nowadays are either well-versed embedded programmers who already know the higher-level stuff, C/Gobject/Gtk+ programmers who already know or can easily understand how the higher-level stuff works (ex. by looking at generated C code), high-level-only programmers who for the most part don't need to care about how the underpinnings work and already would know Vala since it's basically C#(/Java), or finally, and I believe the least likely; complete n00bs who would be much safer writing garbage in any high-level language than directly in something like C/C++ anyway.<br>
</blockquote><div><br></div><div>I don't think it matters how many know it, how many are willing to contribute is the issue, and with a mixed language application it needs two languages.</div><div><br></div><div>And that leads to what I consider is the biggest problem with the proposal, having a project with parts in one language and parts in another.  Maintaining assumptions between them, some made by the vala compiler, some made by C coders, is going to be hard and a source of extra problems and bugs.  That alone is enough reason to not just start piling vala onto the existing Geany.</div>
<div><br></div><div>If there is really enough reason to change to vala I would suggest that the right way to do it is to define interfaces between those parts of Geany that are going to stay C for the foreseeable future, eg Scintilla, tagmangler etc and create vapi definitions for them.  Then build the basic skeleton of the app in vala, calling the C parts as required.  Its not as immediate as allowing random parts to be written in vala but is likely to be much more effective in moving the project forward, and ATM thats what Geany really needs, a good spruce up so new things can be more easily added.</div>
<div><br></div><div>Cheers</div><div>Lex</div><div><br></div><div>PS we discussed the inappropriateness of +-1 as a reply to something this complex on IRC, won't repeat here.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
[...]<br>
Cheers,<br>
Matthew Brush<br>
______________________________<u></u>_________________<br>
Devel mailing list<br>
<a href="mailto:Devel@lists.geany.org" target="_blank">Devel@lists.geany.org</a><br>
<a href="https://lists.geany.org/cgi-bin/mailman/listinfo/devel" target="_blank">https://lists.geany.org/cgi-<u></u>bin/mailman/listinfo/devel</a><br>
</blockquote></div><br></div></div>