Files
kotlin-fork/docs/confluence.jetbrains.com/Kotlin/40702623_FAQ.confluence
T
2012-05-30 14:41:40 +04:00

75 lines
4.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
h3. What is [Kotlin]?
"Project [Kotlin]" is the codename of a statically-typed JVM-targeted programming language developed by [JetBrains|http://jetbrains.com] intended for industrial use.
h4. Why a new language?
At [JetBrains|http://jetbrains.com], weve been developing for the *Java* platform for a long time, and we know how good it is. On the other hand, we know that the *Java* programming language has certain limitations and problems that are either impossible or very hard to fix due to backward-compatibility issues. We know that *Java* is going to stand long, but we believe that the community can benefit from a new statically typed JVM-targeted language free of the legacy trouble and having the features so desperately wanted by the developers.
{anchor:Design goals}
The main design goals behind this project are
* to create a *Java-compatible* language,
* that *compiles* at least *as fast as Java*,
* make it *safer* than Java, i.e. statically check for common pitfalls such as [null pointer dereference|Null-safety],
* make it *more concise* than *Java* by supporting [variable type inference|Basic syntax walk-through#Define a local variable], [higher-order functions|Functions#Higher-order functions] (closures), [extension functions|Extension functions], [mixins and first-class delegation|Classes and Inheritance], etc;
* and, keeping the useful level of expressiveness (see above), make it way *simpler* than the most mature competitor -- *Scala*.
See [Comparison to Java] and [Comparison to Scala].
h4. Is this an open source project? What's the license?
Both the compiler and the IntelliJ IDEA plugin are open source under the Apache 2 license. We're happy to accept [contributions|Kontributions].
h4. Is it Java-compatible?
Yes. The compiler emits *Java* byte-code. [Kotlin] can call *Java*, and *Java* can call [Kotlin]. See [Java interoperability].
h4. Other platforms than Java?
We have started a JavaScript back-end recently. There are external Kontributors willing to work on an LLVM back-end.
{anchor:Eclipse}
h4. Eclipse-based IDE?
We plan to provide two things:
1) An open source Eclipse plugin that will be initially contributed by JetBrains, and later we will gradually move it's support onto the community.
2) API exposed by the compiler, to make it easy to retrieve semantic information from within the plugin.
In any case, Eclipse support will be released later that IntelliJ support.
h4. Is this a functional language? Is this an object-oriented language?
This is an object-oriented language. It supports [higher-order functions|Functions#Higher-order functions] and [function literals|Function literals], but that does not make it a functional language. It targets OO-developers.
h4. What about generics?
[Kotlin] has [generics|Generics]. They are [retained at runtime|Generics#Reified generics], support [declaration-site variance|Generics#Declarations-site variance] and [usage-site variance|Generics#Type projections], and [Kotlin] does not have any wildcard types.
h4. Does it have type inference? Is it a good idea?
[Kotlin] infers type arguments when generic functions are called, as well as types of variables from their initializers. This makes the code more concise.
h4. Does it have semicolons, curly braces, etc?
Semicolons are [optional|Grammar#Semicolons]. Curly braces are there. Types of [variables|Basic syntax walk-through] and [functions|Functions] are written on the right after a colon (like *Scala*, and unlike *C*-style languages).
h4. Why types on the right?
We believe that it makes the code more readable. Besides, it enables some nice syntactic features, for example, it's easy to leave type annotations out, and *Scala* has proven pretty well that this is not really a problem.
h4. Is this language extensible?
We are planning to make it extensible in a few ways: from [inline functions|Functions#Inline functions] to annotations, type loaders and language-quotations.
h4. Can I embed my DSL into this language?
Yes, [Kotlin] provides a few features that help here: [Operator overloading], [Custom control structures via inline functions|Functions#Inline functions], [Infix function calls|Functions#infix function calls], [Extension functions], annotations, language-quotations.
h4. Does it have IDE support?
Yes. The compiler is developed as an [IntelliJ IDEA|http://jetbrains.com/idea] plugin, and user-facing IDE features are there from the very beginning (we make good use of them while debugging and testing).
h4. Where to ask more questions?
Join our [*Forum*|http://devnet.jetbrains.net/community/kotlin].
h3. What to read next
* [Hello, world!]