[Vala] Read from InputStream using read(2) semantic
Hi, read(2) is a system call like this: ssize_t read(int fd, void *buf, size_t count) I believe that Vala 0.10 has read method like this: ssize_t read (uint8[] buffer, size_t count, Cancellable? cancellable = null) You should see the similarity. I'm dealing with some code that uses 0.10 read() in multiple places. However, count parameter seems to be removed in later Vala versions since the code doesn't compile with later Vala versions. I noted that there is new method called read_bytes() that provides similar semantic. http://valadoc.org/#!api=gio-2.0/GLib.InputStream.read_bytes However, 0.14 says it doesn't know the type Bytes while 0.16 says it doesn't know read_bytes() method. Do I have to use 0.18? Can I have read(2) semantic on 0.12/0.14/0.16? A more general question, is there versioned Vala documentation available online? ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
[Vala] Setting and getting properties at the same time
Hello list, I stumbled on some (for me) unexpected behaviour when setting and getting a property at the same time, which is not consistend with simple types like int. When doing something like int x = (myclass.myproperty = y); x will be set to y, and not whatever mycalss.myproperty will be (or what was mycalss.myproperty set to before). Is this a limitation of Vala? The code below shows this behaviour and should be pretty self-explanatory. -- snip -- public class myclass : Object { private int _number; public int number { set { _number = value * 2; } get { return _number; } } } public void main(string[] args) { myclass m = new myclass(); int i = 2; m.number = 2; // prints 4, ok stdout.printf(number: %d\n, m.number); // prints 3, not 6 (or at least 4) stdout.printf(number: %d\n, m.number = 3); // prints 6, ok stdout.printf(number: %d\n, m.number); / prints 5, ok stdout.printf(i: %d\n, i = 5); } -- snip -- ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Setting and getting properties at the same time
I think that it is pretty consistent and expected behaviour not only in Vala but in other languages as well (as long as they allow such things). I would be worried if it would work other way around. Example: int x, y; x = 2; y = x = 3; I expect that both y and x will have same value, 3. I would not like to get y=2 and x=3. I hope that this clears things up but I also wonder in which language it works differently. JC 2012/11/1 foracc for...@d00m.info Hello list, I stumbled on some (for me) unexpected behaviour when setting and getting a property at the same time, which is not consistend with simple types like int. When doing something like int x = (myclass.myproperty = y); x will be set to y, and not whatever mycalss.myproperty will be (or what was mycalss.myproperty set to before). Is this a limitation of Vala? The code below shows this behaviour and should be pretty self-explanatory. -- snip -- public class myclass : Object { private int _number; public int number { set { _number = value * 2; } get { return _number; } } } public void main(string[] args) { myclass m = new myclass(); int i = 2; m.number = 2; // prints 4, ok stdout.printf(number: %d\n, m.number); // prints 3, not 6 (or at least 4) stdout.printf(number: %d\n, m.number = 3); // prints 6, ok stdout.printf(number: %d\n, m.number); / prints 5, ok stdout.printf(i: %d\n, i = 5); } -- snip -- __**_ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/**mailman/listinfo/vala-listhttps://mail.gnome.org/mailman/listinfo/vala-list ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Setting and getting properties at the same time
int x, y = 9; 2012/11/1 Jarosław Ciupiński kotow...@gmail.com I think that it is pretty consistent and expected behaviour not only in Vala but in other languages as well (as long as they allow such things). I would be worried if it would work other way around. Example: int x, y; x = 2; y = x = 3; I expect that both y and x will have same value, 3. I would not like to get y=2 and x=3. I hope that this clears things up but I also wonder in which language it works differently. JC 2012/11/1 foracc for...@d00m.info Hello list, I stumbled on some (for me) unexpected behaviour when setting and getting a property at the same time, which is not consistend with simple types like int. When doing something like int x = (myclass.myproperty = y); x will be set to y, and not whatever mycalss.myproperty will be (or what was mycalss.myproperty set to before). Is this a limitation of Vala? The code below shows this behaviour and should be pretty self-explanatory. -- snip -- public class myclass : Object { private int _number; public int number { set { _number = value * 2; } get { return _number; } } } public void main(string[] args) { myclass m = new myclass(); int i = 2; m.number = 2; // prints 4, ok stdout.printf(number: %d\n, m.number); // prints 3, not 6 (or at least 4) stdout.printf(number: %d\n, m.number = 3); // prints 6, ok stdout.printf(number: %d\n, m.number); / prints 5, ok stdout.printf(i: %d\n, i = 5); } -- snip -- __**_ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/**mailman/listinfo/vala-list https://mail.gnome.org/mailman/listinfo/vala-list ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Setting and getting properties at the same time
I just checked it out with C# and it shows exactly the same behaviour. I expected it to do x = 3; y = x; rather than x = 3; y = 3; Very interesting and good to know. I think that it is pretty consistent and expected behaviour not only in Vala but in other languages as well (as long as they allow such things). I would be worried if it would work other way around. Example: int x, y; x = 2; y = x = 3; I expect that both y and x will have same value, 3. I would not like to get y=2 and x=3. I hope that this clears things up but I also wonder in which language it works differently. JC 2012/11/1 foracc for...@d00m.info Hello list, I stumbled on some (for me) unexpected behaviour when setting and getting a property at the same time, which is not consistend with simple types like int. When doing something like int x = (myclass.myproperty = y); x will be set to y, and not whatever mycalss.myproperty will be (or what was mycalss.myproperty set to before). Is this a limitation of Vala? The code below shows this behaviour and should be pretty self-explanatory. -- snip -- public class myclass : Object { private int _number; public int number { set { _number = value * 2; } get { return _number; } } } public void main(string[] args) { myclass m = new myclass(); int i = 2; m.number = 2; // prints 4, ok stdout.printf(number: %d\n, m.number); // prints 3, not 6 (or at least 4) stdout.printf(number: %d\n, m.number = 3); // prints 6, ok stdout.printf(number: %d\n, m.number); / prints 5, ok stdout.printf(i: %d\n, i = 5); } -- snip -- __**_ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/**mailman/listinfo/vala-listhttps://mail.gnome.org/mailman/listinfo/vala-list ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list