Optimizing AI for immediate response in Smart CCTV
The best of AltJava is Xtend
1. The best of AltJava is
Naoki Takezoe
@takezoen
BizReach, Inc
#渋谷java
2. What's Xtend?
● Hosted by Eclipse Foundation
● Based on Xtext
● Similar syntax to Scala or Kotlin
● Compiled to Java source code (not class file)
● Eclipse and IntelliJ support
9. About Xtext
● Framework for development of languages
● Define language using BNF like DSL
● Generate toolkit like parser or editor from it
Language
Definition
Parser
Compiler
Linker
Type checker
Editor
Generate
10. Xtext Summit
● In EclipseCon 2017 France
● June 20-21 (2days!!)
● One of the hottest projects in Eclipse.org
12. Basic syntax
● def / var / val
● () in method invocation is optional
● return and return type are optional
● null-safe call: myRef?.doStuff
● All exceptions are treated as runtime
● if, try, switch and block are expression
(for and while are void, unfortunately)
17. Switch expressions
def length(Object x) {
switch x {
String case x.length > 0 : x.length
List<?> : x.size
default : -1
}
}
Type guard and case guard are available