Xtend vs. Kotlin

1,523 views
Skip to first unread message

Sven Efftinge

unread,
May 22, 2015, 2:59:21 AM5/22/15
to xtend...@googlegroups.com
Hi all,

not sure if you’ve seen this:

Looks like a post by someone who needs to justify his use of Kotlin by spreading FUD about Xtend. Very annoying.
Especially after Jake Wharton’s recent analysis of Kotlin for Android [1], where he simply said he didn’t look at Xtend at all (well still better than spreading an uneducated opinion).


Shouldn’t we do something about this?

Cheers,
Sven



signature.asc

Stefan Oehme

unread,
May 22, 2015, 3:37:47 AM5/22/15
to xtend...@googlegroups.com, sven.e...@itemis.de
I would definitely engage in an objective discussion, since some of the points made are wrong: 

- We don't have a singleton keyword, because it's trivial with Active Annotations. Also the use of Singletons is highly questionable.
- Setting up Xtend is incredibly easy, no matter if you're using Maven/Gradle or an Eclipse build
- We did not change anything from the JDK, we just added a bit of sugar

The rest of the post is mostly about superficial syntax differences (how are functions defined, how are extensions defined etc). So it's hard to understand how at the end the author arrives at "Kotlin is clearly superior".
Objectively he only showed two big differences:

- Xtend has Active Annotations vs. Kotlin has Default/Named Params
- Xtend has better Eclipse support vs Kotlin has better IDEA support

What he didn't mention is:

- Xtend has far cleaner Java interop due to using exactly the same type system
- Xtend is excellent for code generation, Kotlin does not provide benefits there

Sven Efftinge

unread,
May 22, 2015, 3:51:10 AM5/22/15
to xtend...@googlegroups.com
Yes, I fully agree. And of course one could even go into showing some of the interop problems Kotlin has.
I just think it would be a bit better if this wouldn’t come from a committer in the first place ;-)

--
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.

signature.asc

Jan Koehnlein

unread,
May 22, 2015, 4:12:54 AM5/22/15
to xtend...@googlegroups.com
I’d prefer that some non-committer steps in, but if that doesn’t happen one of us should at least correct the wrong statements on Xtend. We should not rant on Kotlin.

Toby Kurien

unread,
May 22, 2015, 11:12:11 AM5/22/15
to xtend...@googlegroups.com
I've been tweaking and tweaking the documentation for Xtendroid, but somehow, I don't think I'm getting the point across. Whenever I demo Xtendroid to android developers, they are blown away. However, when it's posted up on an Android dev site, the response is... meh! I sure could use some input on thsi, 'cos I don't think people have time for screencasts.

Stefan Oehme

unread,
May 22, 2015, 11:22:51 AM5/22/15
to xtend...@googlegroups.com
I think your documentation captures the upsides pretty nicely. You can remove the bugs from the "gotchas" section, as they have been resolved. 

As for the screencast: I think it's a good idea. The awesome IDE integration is easily lost in pictures. A short video could help with that. Only show some interesting aspects like auto completion and live feedback as you change the XML files etc.

2015-05-22 17:12 GMT+02:00 Toby Kurien <tobyk...@gmail.com>:
I've been tweaking and tweaking the documentation for Xtendroid, but somehow, I don't think I'm getting the point across. Whenever I demo Xtendroid to android developers, they are blown away. However, when it's posted up on an Android dev site, the response is... meh! I sure could use some input on thsi, 'cos I don't think people have time for screencasts.

--
You received this message because you are subscribed to a topic in the Google Groups "Xtend Programming Language" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/xtend-lang/FOtaAa2Fr7Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to xtend-lang+...@googlegroups.com.

Toby Kurien

unread,
May 22, 2015, 11:38:09 AM5/22/15
to xtend...@googlegroups.com
Thanks. I actually have linked to a video Sven posted showing off the IDE integration, but perhaps I need to embed it to make it more obvious.

Also, those bugs, even though marked as resolved, aren't. They re-surface in a not-easy-to-replicate way.

I'm eagerly awaiting the beta of the IntelliJ plugin in order to release Xtendroid v0.12 and make some noise. Currently, the fact that Xtendroid only works in Eclipse makes it a non-starter.

Stefan Oehme

unread,
May 22, 2015, 11:46:32 AM5/22/15
to xtend...@googlegroups.com
Yes, embedding it sounds like a good idea. At least I only follow a link if I'm actively searching for something, but not when I'm just scanning a text.

Stefan Oehme

unread,
May 22, 2015, 4:25:58 PM5/22/15
to xtend...@googlegroups.com
Thanks to the community for chiming in, you guys are great =)
To unsubscribe from this group and all its topics, send an email to xtend-lang+unsubscribe@googlegroups.com.

Mark Derricutt

unread,
May 25, 2015, 2:05:53 AM5/25/15
to xtend...@googlegroups.com
On 22 May 2015, at 19:37, Stefan Oehme wrote:

> The rest of the post is mostly about superficial syntax differences (how are functions defined, how are extensions defined etc). So it's hard to understand how at the end the author arrives at "Kotlin is clearly superior".

Doesn't he state, that in the context of Android development - since a lot of people have moved to IntelliJ - Kotlin is superior.

Once the Xtend IntelliJ Plugin is available, that point SHOULD become moot, and the comparison should again be put back to purely language.

Mark


--
Mark Derricutt
http://www.theoryinpractice.net
http://www.chaliceofblood.net
http://plus.google.com/+MarkDerricutt
http://twitter.com/talios
http://facebook.com/mderricutt
signature.asc

Javier Fernandes

unread,
May 30, 2015, 11:00:13 PM5/30/15
to xtend...@googlegroups.com
Hi guys !

Just a question to see if maybe here in this list someone has experience in Kotlin,
In the docs they say that their extension methods are actually statically dispatched (I'm not sure that's even the correct way of telling it, but "resolved statically" instead).
So basically that's just comparable to xtend "static extension methods", which, for me, it's just a tiny part or application of the power of xtend extension methods.

In particular, of course static methods don't support polymorphism (through [dynamic] dispatch), which is THE most important concept in OOP.

Xtend supports this through a combination of extension methods + multiple dispatch.

Take this example in Kotlin:


fun main(args: Array<String>) {
    val i = 1
    i.doSomething()   // FINE
    val s = "string"
    s.doSomething()   // FINE
    
  val col = linkedListOf(i, s)
    col forEach { it.doSomething() }   // COMPILATION ERROR
}

fun Int.doSomething() { println("This is a List Extension")  }
fun String.doSomething() { println("This is a Set Extension")  }


It doesn't compile because the type of the list is Any, and there are no extension method for Any. Well.. a static check.


On the other hand, in XTend:


def static void main(String[] args) {

val i = 1

    i.doSomething()   // FINE

    val s = "string"

    s.doSomething()   // FINE

    

    val col = newLinkedList(i, s)

    col.forEach [ it.doSomething() ]  // FINE   

}

def static dispatch doSomething(Integer i) { println("This is a List Extension") }

def static dispatch doSomething(String i) { println("This is a String Extension") }


And this is still not the most powerful usage of extension methods.
With multiple providers (i.e an interface with multiple implementations) plus multiple dispatch, you can get a really flexible mechanism.
I don't see extension methods just as a way to add new methods that someone just forgot to add to the SDK classes. XTend extension methods allow you to "design" for complex problems.
It even has some relation to Subject-Oriented Programming.


Well, anyway, if someone can confirm Kotlin extension methods are just static methods, then I'll jump in to comment this to the post :)
Because the guy there just states as if they were the same, and putting focus in the syntax being more "intention revealing" in Kotlin,
The syntax may be just a matter of taste, but this is not the case.

Thanks !

Regards



 


--
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.

Sven Efftinge

unread,
May 31, 2015, 9:53:30 AM5/31/15
to xtend...@googlegroups.com
Yes, it is as you said.
More differences are:
 - Xtend extensions work on instances as well, as it supports extension keyword on local variables and fields as well.
 - Xtend extensions are usage side rather than declaration side, which lets you use existing Java APIs as extensions methods and helps reading code.

Sven

Micael Pedrosa

unread,
Oct 23, 2015, 7:47:38 PM10/23/15
to Xtend Programming Language
Link is not working anymore. Between, kotlin looks like another language that offers nothing new to the table.
I haven't seen anything similar to to AA in any other language, and has the potential to fill any features that the language lacks.

I take the opportunity to ask for a feature that can add another nail in the coffin to languages like kotlin. How about, deep integration of Xtext/Xtend projects?
Something that can compile check code like:

@SqlQuery('''select id, name, birthday from person where name like :name''')
def Person personByName(String name)

where the AA SqlQuery will be the entry point for a Xtext DSL for SQL.
There are a lot of use cases for this kind of feature.

Efftinge, Sven

unread,
Oct 24, 2015, 5:50:04 AM10/24/15
to xtend...@googlegroups.com
Yes, that would be cool and is one of the things I would love to add.
I'd like to have that based on annotated CharSequence types, so it wouldn't be limited to annotation values.

E.g. it should support something like:

 def setRegex(@Regex String myRegex)...

so I get full regex editor support and validation when I call such a method.
For that also type annotations would be helpful, which are not yet supported.

And then of course one need to be able to implement the @Regex annotations with at least
 - syntax coloring
 - validation
 - content assist

Allowing easy reuse of Xtext languages makes sense, but for widespread formats there are already parsers and linters, so you'd want to reuse them.

Could be a nice topic for a master thesis. :-)

--

Christian Vogel

unread,
Oct 27, 2015, 3:19:59 PM10/27/15
to Xtend Programming Language
Sven, mixing in other Xtext languages like that would be killer.

True mixing in of custom languages like that would not just be amazing but also really leverage the work you guys put into Xtext, and set Xtend apart from the rest.
Reply all
Reply to author
Forward
0 new messages