Boolean operators &=, |= in Xtend

73 views
Skip to first unread message

ioannes.ca...@gmail.com

unread,
Jun 3, 2015, 5:23:09 AM6/3/15
to xtend...@googlegroups.com
Hello Xtend experts!
I work only a couple of weeks with Xtend and am not very familiar with it yet.
I have a simple question. In my code I tried to use a construction like this:

var bool_var = ( /* some boolean expression */ )

// ... some code ...

bool_var
|= ( /* another boolean expression */ )


But I get the error message "No viable alternative at input '|'". Of course I could write it like this, but it's not really nice.

bool_var = bool_var || (...)

Does Xtend really not support such operators (|=, &=) or what is the correct short syntax for that?
Thanks for your answers in advance!

Sebastian Zarnekow

unread,
Jun 3, 2015, 5:36:54 AM6/3/15
to xtend...@googlegroups.com
Hi,

Xtend doesn't support not-short-circuiting boolean operators. The compound assignments &= and |= are non circuiting thus they are currently not available. What's your usecase for these except from saving a few chars in the code?

Best,
Sebastian

--
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/d/optout.

Jean Cauvin

unread,
Jun 3, 2015, 5:48:37 AM6/3/15
to xtend...@googlegroups.com
Hi Sebastian,
thanks for your answer. I just wanted a shorter and cleaner code, because in a class I have ca. 10 expressions of this kind of pattern. There is no specific use case behind it.

lum...@gmail.com

unread,
Jun 3, 2015, 6:11:02 AM6/3/15
to xtend...@googlegroups.com
Hi Jean,

With Xtend becoming more and more popular, the team is focused on getting some of the larger features and crucial bugfixes in order. (IntelliJ, etc)
As far as I understand one of Xtend's core goals is code brevity, so I have full confidence this issue will be addressed in the long run.
Reply all
Reply to author
Forward
0 new messages