Nor Jaidi Tuah | 2 May 2011 05:32
Favicon

[Vala] Struct property bug: get, but not set

The following displays 0 for button.color.red.
Expected: 100.

	void main (string[] args) {
		Gtk.init (ref args);
		var button = new Gtk.ColorButton ();
		button.color.red = 100; /*1*/
		debug ("%d", button.color.red);
	}

Line /*1*/ is compiled to:
	gtk_color_button_get_color (button, &_tmp1_);
	_tmp1_.red = (guint16) 100;

There is no set access to button.color at all!

Is this a known bug?

hand
Nor Jaidi Tuah
Mike Ma | 2 May 2011 05:58
Picon
Gravatar

[Vala] `stdout.puts' doesn't have "\n"?

I wrote a Hello World app like this:

  int main ()
  {
    stdout.puts ("Hello World");
    return 0;
  }

then,
$ valac hello.vala
$ ./hello
Hello World$   #NO \n!

Is it a bug?

--------------------
Mike is here.
My OS:                     Fedora x64
My blog:                   www.ekd123.org [Powered by Chito]
My favorite editor:        Emacs 23.2
My E-mail client:          Mew 6.3 on Emacs 23.2.
--------------------
_______________________________________________
vala-list mailing list
vala-list@...
http://mail.gnome.org/mailman/listinfo/vala-list
jryan | 2 May 2011 06:47
Gravatar

Re: [Vala] `stdout.puts' doesn't have "\n"?

Excerpts from Mike Ma's message of 2011-05-01 23:58:52 -0400:
> I wrote a Hello World app like this:
> 
>   int main ()
>   {
>     stdout.puts ("Hello World");
>     return 0;
>   }
> 
> then,
> $ valac hello.vala
> $ ./hello
> Hello World$   #NO \n!
> 
> Is it a bug?
> 

Looking in the vapi:

public class FileStream {
...
	[CCode (cname="fputs",...)]
	public void puts(string s);
}

Then looking at man fputs():

fputs() writes the string s to stream, without its trailing '\0'
...
puts() writes the string s and a trailing newline to stdout
(Continue reading)

jryan | 2 May 2011 07:13
Gravatar

Re: [Vala] Struct property bug: get, but not set

Excerpts from Nor Jaidi Tuah's message of 2011-05-01 23:32:19 -0400:
> The following displays 0 for button.color.red.
> Expected: 100.
> 
>     void main (string[] args) {
>         Gtk.init (ref args);
>         var button = new Gtk.ColorButton ();
>         button.color.red = 100; /*1*/
>         debug ("%d", button.color.red);
>     }
> 
> Line /*1*/ is compiled to:
>     gtk_color_button_get_color (button, &_tmp1_);
>     _tmp1_.red = (guint16) 100;
> 
> There is no set access to button.color at all!
> 
> Is this a known bug?
> 
> hand
> Nor Jaidi Tuah
> 

Not a bug.

Explanation:
http://bugzilla.gnome.org/show_bug.cgi?id=621787

I think you're going to have to create a new Color:

(Continue reading)

Nor Jaidi Tuah | 2 May 2011 08:10
Favicon

Re: [Vala] Struct property bug: get, but not set


> Not a bug.
> 
> Explanation:
> http://bugzilla.gnome.org/show_bug.cgi?id=621787

So, the code

>         var button = new Gtk.ColorButton ();
>         button.color.red = 100; /*1*/

should have been invalid. (A compiler bug, but
a different kind).

But, since vala is a higher level language than C,
is there any strong reason to absolutely treat
"button.color.red = 100" as invalid. Can't the 
compiler treat it as a shortcut for:

	var c = button.color;
	c.red = 100;
	button.color = c;

? Are there any cases where such shortcuts do not
work?

hand
Nor Jaidi Tuah
Abderrahim KITOUNI | 2 May 2011 19:17
Picon

Re: [Vala] Remove line numbers from logging

Hi,

2011/4/29 Ricardo Gladwell <ricardo.gladwell@...>:
> Hi Guys
>
> I'm writing some code that uses the GLib log, debug, message etc. static
> methods. Is there anyway to disable/remove the pre-pending of file name
> and line number to these outputs so that instead of:
>
> [vain] DefaultVainExecution.vala:18: Scanning for projects...
>
> I just print:
>
> [vain] Scanning for projects...

This is because of the [Diagnostics] annotation, I'm not sure if we
should really have it for everything (one could argue that it's only
useful for debug), but it's this way.

Anyway, the workaround I see is to write your own logging functions
that call logv directly.

HTH,
Abderrahim.
Ricardo Gladwell | 3 May 2011 09:23
Picon
Gravatar

Re: [Vala] Remove line numbers from logging

Hi Abderrahim.

On Mon, 2011-05-02 at 18:17 +0100, Abderrahim KITOUNI wrote:
> This is because of the [Diagnostics] annotation, I'm not sure if we
> should really have it for everything (one could argue that it's only
> useful for debug), but it's this way.
> 
> Anyway, the workaround I see is to write your own logging functions
> that call logv directly.

Thanks for the info, what exactly does the [Diagnostics] annotation do
and where is it used?

Thanks, I will create my own logging functions.

Regards...

--

-- 
Ricardo Gladwell <ricardo.gladwell@...>
http://www.google.com/profiles/ricardo.gladwell
Twitter:  <at> rgladwell - MSN: axonrg@...
Abderrahim KITOUNI | 3 May 2011 22:48
Picon

Re: [Vala] Remove line numbers from logging

Hello,

2011/5/3, Ricardo Gladwell <ricardo.gladwell@...>:
> Thanks for the info, what exactly does the [Diagnostics] annotation do
> and where is it used?

It is used in the bindings for GLib (look for glib-2.0.vapi), and
tells the compiler to prepend the file name/line number to the actual
message. logv doesn't have the annotation, so you can use it if you
want things to go through GLib's logging system.

Regards,
Abderrahim
Ricardo Gladwell | 4 May 2011 15:00
Picon
Gravatar

Re: [Vala] Support for custom attribute introspection/reflection?

On 24 April 2011 18:53, Luca Bruno <lethalman88@...> wrote:
> On Sun, Apr 24, 2011 at 06:48:39PM +0100, Ricardo Gladwell wrote:
>> If not, are there any plans to provide such a feature?
>
> Not at the moment, it could be implemented for GObject classes though.

Could this be done by modifying the Vala GObject vapi definition, or
would it require support from the underlying C gobject API?

Regards...

--
Ricardo Gladwell <ricardo.gladwell@...>
http://www.google.com/profiles/ricardo.gladwell
Twitter:  <at> rgladwell - MSN: axonrg@...
Andrea Del Signore | 4 May 2011 15:15
Picon

[Vala] Vala Toys 0.12 Beta 1

Hi,

I've just released a beta1 tarball of what will became Vala Toys for
gEdit 0.12.

If you want a Vala Toys version that works well with Vala 0.12, the new
gEdit 3.0 and Gtk+ 3.0 please download it at: 

http://vtg.googlecode.com/files/vtg-0.12.0.0-beta1.tar.bz2

and don't forget to file a bug if you find a crash or a regression from
the previous 0.11 release ( http://code.google.com/p/vtg/issues/entry ).

Happy hacking,
Andrea

Gmane