[Vala] operator overloading

2012-04-12 Thread Nasser Mansouri
is possible to operator overloading in vala? and vala wants to cover all C# features? is there an forum for vala beginners? ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list

[Vala] Operator Overloading

2011-09-19 Thread Sepehr Aryani
Why there is no support for operator overloading in Vala. For a cool OO language like Vala not having this feature it is a big shame! If there is a plan to add this feature, when would it be possible to see this in the future? ___ vala-list mailing list

Re: [Vala] Operator overloading

2009-03-27 Thread James Livingston
On 27/03/2009, at 9:24 AM, Maciej Piechotka wrote: i * j = k -j * i = k k/i = j or -j? Do you mean left-divide or right-divide? In the first equation you are left-multiplying by i, the latter you are right-multiplying by i. k / i is ambiguous as to which it means.

Re: [Vala] Operator overloading (SOC idea)

2009-03-26 Thread Conrad Steenberg
Hi Michael, Thanks for the response. I've used Python + numerical/numpy in various guises since 1996, and it's great for many things, especially compared to the sluggishness of Matlab. A lot of our code needs a little (OK a lot) more speed in the glue parts that usually gets handled by Python,

Re: [Vala] Operator overloading

2009-03-26 Thread Maciej Piechotka
William Swanson wrote: --- Quaternions --- Quaternions are complex numbers generalized into four dimensions. As with complex numbers, all four basic operators (+ - * /) are well-defined. Quaternions are used to represent rotations in 3D, among other things. Nearly. Quaternions doesn't have

Re: [Vala] Operator overloading

2009-03-24 Thread Levi Bard
Sure, but it's equally easy to use one of: Vertex a = Vertex.add(b,c); Vertex a = new Vertex.add(b,c); That is not true. Imagine what would happen if Vala lost support for operators on the built-in types like int or float. Would anybody say Vala was equally easy to use when even a simple

Re: [Vala] Operator overloading

2009-03-24 Thread pancake
Levi Bard wrote: Sure, but it's equally easy to use one of: Vertex a = Vertex.add(b,c); Vertex a = new Vertex.add(b,c); That is not true. Imagine what would happen if Vala lost support for operators on the built-in types like int or float. Would anybody say Vala was equally easy to use

Re: [Vala] Operator overloading

2009-03-24 Thread Xavier Bestel
On Tue, 2009-03-24 at 15:15 +0100, pancake wrote: Why do you want to limit those operators statically linked to native or pseudo-native data types to the compiler instead of letting the developer to choose? Because in the end it's unreadable. Math operators should be limited to purely math

Re: [Vala] Operator overloading

2009-03-24 Thread Levi Bard
Which is the definition between a concatenation and an addition of two vectors? i see no difference. What you get at the end is the resulting vector of the sum of both ones. Oops, that was a mental conflation of geometric vectors and matrix vectors on my part. --

Re: [Vala] Operator overloading

2009-03-24 Thread William Swanson
It seems useful to catalog the use-cases for operator overloading at this point, since folks are missing the big picture by focusing on only one or two: --- Non-standard number representations --- * Arbitrary-sized large integers * Fractional (int/int) number represtations * Base-10 floats for

Re: [Vala] Operator overloading

2009-03-24 Thread Xavier Bestel
Le mardi 24 mars 2009 à 16:22 -0700, William Swanson a écrit : A locked-down implementation [...] would not leave much room for nightmarish horror stories. This isn't C++, where you can overload the [] or - operators to shoot yourself in the foot. Maybe. But this is not GObject either, and

Re: [Vala] Operator overloading

2009-03-24 Thread Vlad Grecescu
2009/3/25 William Swanson swanson...@gmail.com A locked-down implementation that supports only the basic math operators (+ - * / %), forces those operators to be const to eliminate side effects, and forces the assignment operators (+= -= *= /= %=) to behave predictably Obligatory notes

Re: [Vala] Operator overloading

2009-03-24 Thread Yu Feng
Would it be reasonable to write some Vala compiler modules that implements these types internally? The implementations can then be shared across the entire vala user base. Yet these modules can be release under different packages, eg, vala-ccode-currency, vala-ccode-vector, vala-ccode-complex ...

Re: [Vala] Operator overloading

2009-03-23 Thread Levi Bard
At the same time, by having operator overloading we can have our own implementation for any arithmetic operation over any kind of object which will make Vala a more flexible language and this will open lot of possibilities in video game programming. This is, at best, syntax sugar. It doesn't

Re: [Vala] Operator overloading

2009-03-23 Thread John Carr
On Mon, Mar 23, 2009 at 5:13 PM, Levi Bard taktaktaktaktaktaktaktaktak...@gmail.com wrote: At the same time, by having operator overloading we can have our own implementation for any arithmetic operation over any kind of object which will make Vala a more flexible language and this will open

Re: [Vala] Operator overloading

2009-03-23 Thread Levi Bard
How this relates to video game programming is beyond me. A typical thing i used to see when modding Half-Life is the Vector class which allows you to do vector math as though you were dealing with simple types. vector.x *= 5; vector.y *= 5; vector.z *= 5; becomes vector *= 5; You can

Re: [Vala] Operator overloading

2009-03-23 Thread Levi Bard
In game programming it's very common to use Vertex classes to store X,Y,Z values and sum them in a single with Vertex a = b + c; for example (this is probably the only thing i find useful and clear in C++). This is very used in OpenGL programming f.ex. Sure, but it's equally easy to use one

Re: [Vala] Operator overloading

2009-03-23 Thread Frederik Sdun
Hi, operator overloading might bring some more readable code. But sometimes they have heavy side effects. Here is just a tiny example in c++: #includeiostream int main( int argc, char* argv[] ) { int i=0; std::cout ++i ++i std::endl; std::cout i++ i++ std::endl; return 0; }

Re: [Vala] Operator overloading

2009-03-23 Thread James Cox
I personally think operator overloading is a good feature, and that the only arguments for and against it are personal preference. There is no technical reason not to include them, allowing those who like and understand operator overloading to use the feature. I think it would be a shame not to

Re: [Vala] Operator overloading

2009-03-23 Thread A. Walton
2009/3/23 James Cox jamesco...@googlemail.com: I personally think operator overloading is a good feature, and that the only arguments for and against it are personal preference.  There is no technical reason not to include them, allowing those who like and understand operator overloading to

Re: [Vala] Operator overloading

2009-03-23 Thread alberto colombo
Speaking of personal preferences... I think that operator overloading can provide much more readable code when working with mathematical applications (complex numbers, arrays and matrices, etc). Could it be provided in such a way that keeps read/write-ability, without causing the technical

Re: [Vala] Operator overloading

2009-03-23 Thread William Swanson
Levi Bard wrote: Sure, but it's equally easy to use one of: Vertex a = Vertex.add(b,c); Vertex a = new Vertex.add(b,c); That is not true. Imagine what would happen if Vala lost support for operators on the built-in types like int or float. Would anybody say Vala was equally easy to use when

[Vala] Operator overloading

2009-03-22 Thread pancake
Are there any plans to implement operator overloading in Vala? I will find them really useful because it is a really nice addition feature for the language. Using it will allow us to wrap all the arithmetic access to use APIs like GMP for big number operations. Bignum b = new Bignum(3); //

Re: [Vala] Operator overloading

2009-03-22 Thread Yu Feng
On Sun, 2009-03-22 at 15:27 +, pancake wrote: Are there any plans to implement operator overloading in Vala? I will find them really useful because it is a really nice addition feature for the language. Using it will allow us to wrap all the arithmetic access to use APIs like GMP for

Re: [Vala] Operator overloading

2009-03-22 Thread pancake
Yu Feng wrote: On Sun, 2009-03-22 at 15:27 +, pancake wrote: Are there any plans to implement operator overloading in Vala? We can also use the operator overloading to wrap access to optimize paralelized operations to be done in a while by using external APIs like OpemMPI or any liboil

Re: [Vala] Operator overloading

2009-03-22 Thread Laszlo Pandy
Java does not support operator overloading. Python does: class Complex: def __init__(self, x, y): self.x = x self.y = y def __add__(self, other): return Complex(self.x + other.x, self.y + other.y) Even though Python already has complex numbers build into the