Re: Operator add not working

40 views
Skip to first unread message

Sebastian Zarnekow

unread,
Apr 4, 2013, 12:24:54 PM4/4/13
to xtend...@googlegroups.com
Hi,

thanks for your interest in Xtend.

The unary ++ and the binary += operator is currently not support in Xtend. Generally speaking, operators are different from Java since they are not hardcoded into the language but are backed by plain Java methods. Since ++ / += for integers have a complicated semantics regarding read / write and the used value, the are not yet implemented. You may want to follow https://bugs.eclipse.org/bugs/show_bug.cgi?id=379178

Best regards,
Sebastian


On 04.04.2013, at 18:20, regis...@gmail.com wrote:

Hi, I am trying to start using Xtend (already read the full documentation) but I am facing some problems. I am using Xtend 2.4 with Eclipse Juno R2 under Linux Mint Maya Kde (idk if this matters). I am writing this:

package prueba

class PruebaXtend {
    def static void main(String[] args) {
        var valor = 1
        valor++
        valor+=1
       
        println(valor)
    }
   
}


and eclipse will throw me errors in the "++" and in the "+=" . The message in the last one is "+= cannot be resolved". I tried writing the same in java:

package prueba;

public class Prueba {
    public static void main(String[] args) {
        int valor = 1;
        valor++;
        valor += 1;

        System.out.println(valor);
    }
}

and everything goes all right. What I am doing wrong? That was my first try in Xtend and I failed. I planned to start my new Android project using Xtend but I don't know if more of this weird errors will appear again.

I attached the image showing the errors in Eclipse. Notice the red underline under "++" and under "+="

Thanks for your help!

--
You received this message because you are subscribed to the Google Groups "Xtend Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xtend-lang+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
<operator_add xtend.jpg>

Reply all
Reply to author
Forward
0 new messages