Better HN
topnewbestaskshowjobs
Log inSign up

IReadYourCode

3 karma · joined Apr 4, 2014 (12y ago) · 9 submissions

Submissions

comment 12y ago · link · parent

A search on Github for Xtend classes reveals 10,502 results: https://github.com/search?q=class+extension%3Axtend&type=Cod...

This beats Ceylon by factor two (4,189 results) and is close to Kotlin (12,233 result).

comment 12y ago · link · parent

Did you have a look at Xtend's Active Annotations? http://www.eclipse.org/community/eclipse_newsletter/2013/mar... You can define your own annotation processors without having to understand Java Byte Code. With Xtend, an annotation processor is basically a small Java code generator that can add/remove/modify classes/interfaces/fields/methods. It's quite awesome for automating design patterns, e.g. generating getters/setters, observer pattern, property objects, delegators, etc.

comment 12y ago · link · parent

If you press CTRL+SPACE the Eclipse content assist will insert a pair of « ». This only works when « » are valid, i.e. between ''' and '''.

Wikipedia has a nice list of key combinations for each OS/language/keyboard: http://en.wikipedia.org/wiki/Guillemet#Typing_.22.C2.AB.22_a...

comment 12y ago · link · parent

Because many languages were designed with only the compiler in mind, but IDEs have requirements regarding language design, too…

Example 1: text-based preprocessors such as the ones you find in C or C++ are a nightmare for IDE developers. They turn static analysis into a game of guessing because your source code can manifest itself into too many variations.

Example 2: SQL: If a user wants to write "SELECT mycolumn FROM mytable;" but he/she has only written "SELECT " and now trigger auto-completion… it can not work, because the IDE has no idea from which table it can list the columns. If the language would have the syntax the other way around "FROM mytable SELECT mycolumn" auto-complete could easily propose the tables first and all the columns from a specific table later.

comment 12y ago · link · parent

It's finally a syntax that doesn't get into your way when you want to generate stuff.

Think of XSLT. Every time you want to generate a "<" or ">" you need to escape it.

Think of PHP. Every time you want to embed a command you need at least two characters to escape it: <? ?>

Xtend choose «guillemets» because they're concise and very unlikely to occur in the string/text/file your generating. You might want to use UTF-8 or ISO-8859-1 encoding.

comment 12y ago · link · parent

Xtend isn't supposed to replace Java. It enhances it. That's why Xtend doesn't compile to byte code but to Java code.

If you do imperative programing in Xtend, there will be exactly one Java method for each Xtend method. I.e. the "Xtend stack trace" (if it would exist) is exactly the same as the Java stack trace.

If you do a more function style of programming and use lambda expressions, each lambda will be a anonymous class in Java 7 or older. So you'll see them in your stack trace. But I guess that you would also see them in Java 8.

comment 12y ago · link · parent

You can debug Xtend code using the Eclipse Java debugger and debug Xtend code just like you would usually debug Java.

During debugging, you can select for every stack frame if you want to see the Java code or the Xtend code. This makes sense since Xtend code gets compiled to Java code which then gets compiled to byte code.

comment 12y ago · link · parent

Xtend is statically typed but your Xtend code can be as lean and concise as your groovy code because the Xtend compiler can infer the correct types for you.

Because Xtend is statically typed, the Eclipse Xtend editor has quite an excellent autocomplete. For your cursors's location it can propose you a list of all valid keyword, methods names, filed names, local variable names, Class names, etc.

And by excellent I mean: Autocompletion will not forget things and it won't show invalid proposals. No guessing!

For Groovy this just isn't possible because it is mostly unknown to the editor which methods and fields an object has. It's only known at runtime.

comment 12y ago · link · parent

Autocompletion in the Xtend editor is quite excellent, you might want to try a recent version. The last time I tried the Scala IDE (during the first Coursera lecture), Scala's autocompletion suggested may invalid proposals. It felt more like the editor was guessing about types than actually doing proper type analysis. If you happen to have a Java stack trace from Xtend code and click on a stack frame, Eclipse will open the Xtend file and highlight the proper line in your Xtend code.