Talk:Vala (programming language): Difference between revisions

Content deleted Content added
Kiamlaluno (talk | contribs)
syntaxhighlight & fix lint
 
(3 intermediate revisions by 3 users not shown)
Line 1:
{{Talk header}}
{{WikiProject C/C++banner shell|class=Start|importance=Mid|c=yes}}
{{WikiProjectBannerShell|1=
{{WikiProject Computer science|class=Start|importance=Low}}
{{WikiProject Computing|class=Start|importance=Low|science=yes|science-importance=Low|free-software=yes|free-software-importance=Mid|software=yes}}
{{WikiProject C/C++|importance=Mid|c=yes}}
 
{{WikiProject C/C++|class=Start|importance=Mid|c=yes}}
}}
{{findsourcesnotice|programming language|Vala}}
 
==run()==
Line 14 ⟶ 12:
 
If it should be as simple as possible, we should use something like this:
<sourcesyntaxhighlight lang="csharp">
using GLib;
 
Line 20 ⟶ 18:
print ("Hello World\n");
}
</syntaxhighlight>
</source>
However, it would be useful to have a second example, then, that shows a bit more of the syntax.
[[User:Juergbi|Juergbi]] ([[User talk:Juergbi|talk]]) 14:14, 22 June 2008 (UTC)
 
::If it were to be as simple as possible you could drop the glib import and just have the one-liner:
<blockquote><blockquote><sourcesyntaxhighlight lang="csharp">
void main() { print("Hello World\n"); }
</sourcesyntaxhighlight></blockquote></blockquote>
 
::[[Special:Contributions/24.243.3.27|24.243.3.27]] ([[User talk:24.243.3.27|talk]]) 09:53, 19 October 2008 (UTC)
Line 64 ⟶ 62:
:Ps. As an example of how easy it is to wrap C libraries, one can copy the default glib-2.0.vapi somewhere and edit it to wrap g_chdir by putting the following code under the DirUtils namespace, then compiling with the switch --vapidir=/path/to/modified/vapi:
 
<blockquote><sourcesyntaxhighlight lang="csharp">
[CCode (cname = "g_chdir")]
public static int chdir (string pathname);
</sourcesyntaxhighlight></blockquote>
 
:Which then be used from Vala code:
 
<blockquote><sourcesyntaxhighlight lang="csharp">
DirUtils.chdir( "/foo/bar" );
</sourcesyntaxhighlight></blockquote>
 
:[[Special:Contributions/24.243.3.27|24.243.3.27]] ([[User talk:24.243.3.27|talk]]) 08:00, 22 September 2008 (UTC)
Line 147 ⟶ 145:
 
the line:
<syntaxhighlight lang="text">
<code>
stdout.printf("hello world!\n");
</codesyntaxhighlight>
 
means that <code>stdout</code>, which is an instance of the streams class, which is capable to process the <code>printf("hello world!\n")</code> message.