https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
announcements
  • v

    vishna

    12/03/2018, 5:13 PM
    hmm… so is there a nicer way to get unique key based on position in the file, other than getting stack trace?
    a
    b
    • 3
    • 4
  • m

    mark

    12/03/2018, 8:31 PM
    any thoughts on this? did I just mess the syntax up?
    a
    • 2
    • 5
  • d

    Davio

    12/04/2018, 9:41 AM
    inline fun <reified T> calc(p: String): T? {
      return if (null is T) {
        println("nullable")
        null
      } else {
        println("not nullable")
        "foo" as T?
      }
    }
    
    fun main() {
      calc<String?>("hello")
      calc<String>("hello")
    }
    k
    r
    • 3
    • 3
  • e

    elect

    12/04/2018, 9:48 AM
    I noticed that simple
    val
    inside `object`s are translated in java as
    private
    , while
    const val
    are
    public
    .. why?
    ❓ 1
    g
    • 2
    • 3
  • b

    Bernhard

    12/04/2018, 12:43 PM
    I basically want to validate composite unique constraints
    j
    • 2
    • 6
  • z

    ziggy42

    12/04/2018, 1:15 PM
    The problem is this I'm using
    D
    m
    p
    • 3
    • 5
  • k

    kartikpatodi

    12/04/2018, 1:31 PM
    is there any support for java 9/10 modules in Kotlin?
    a
    • 2
    • 3
  • h

    heruan

    12/04/2018, 2:18 PM
    Hello, is this channel okay for questions related to IDE plugins?
    d
    a
    • 3
    • 4
  • t

    Tasos Stamadianos

    12/04/2018, 4:18 PM
    where can I ask questions about binary compatibility and JVM/JDK versions?
    g
    f
    i
    • 4
    • 21
  • c

    Casey Kulm

    12/04/2018, 5:19 PM
    When I use the “Create Test” feature in Intellij, it always creates it as a Java file even if I put it in the kotlin source set. I usually end up converting it right away. Is there a way to have it be generated in Kotlin instead.
    a
    • 2
    • 2
  • d

    Davio

    12/04/2018, 6:06 PM
    @Paul Woitaschek maybe you have to generify the function, not just the parameter?
    p
    • 2
    • 1
  • k

    karelpeeters

    12/04/2018, 6:30 PM
    No, but at least that makes it theoretically possible 😏
    h
    d
    • 3
    • 30
  • f

    fitzoh

    12/04/2018, 8:10 PM
    `in`.doSomething()
    ? 😆
    s
    • 2
    • 1
  • d

    dknapp

    12/04/2018, 8:12 PM
    Untitled.kt
    j
    • 2
    • 3
  • d

    Davio

    12/05/2018, 8:38 AM
    Why not
    it
    ?
    ➕ 6
    h
    k
    • 3
    • 6
  • a

    arve

    12/05/2018, 9:46 AM
    Hello friendly Kotliners! I have an interface with a fun that returns some custom related datatype:
    package somePkg
    
    interface MyInterface {
      fun myFun(): MyType
      data class MyType
    }
    I don't want to pollute
    somePkg
    with
    MyType
    , since it's pretty specific to the domain of
    MyInterface
    , and there is other stuff in the same package. Are there any pitfalls to defining a data class inside an interface that I should be aware of? What about putting it inside companion object inside the interface? Is the only difference in the import statement you have to use?
    d
    k
    a
    • 4
    • 14
  • a

    Ayoub

    12/05/2018, 11:59 AM
    Hello can anyone explain to me the highlited line
    g
    • 2
    • 1
  • k

    karelpeeters

    12/05/2018, 2:44 PM
    fun IntRange.clamp(value: Int) = when {
        value <= start -> start
        value >= endInclusive -> endInclusive
        else -> value
    }
    m
    p
    h
    • 4
    • 11
  • t

    Tsvetozar Bonev

    12/05/2018, 3:01 PM
    -.kt
    s
    • 2
    • 1
  • a

    Alan Evans

    12/05/2018, 3:02 PM
    Or.txt
    s
    • 2
    • 4
  • o

    orangy

    12/05/2018, 3:02 PM
    📣 📣 📣 Webinar is live! Join now done, watch the recording!

    https://www.youtube.com/watch?v=FAhR_sqlUy4▾

    👍 11
    k
    r
    d
    • 4
    • 4
  • a

    Andrew Gazelka

    12/05/2018, 4:47 PM
    is it proper to use
    check()
    for private method logic errors?
    k
    • 2
    • 1
  • c

    Casey Brooks

    12/05/2018, 5:25 PM
    Kotlin does not support using properties to override Java getter/setter methods, and likely never will (see this SO comment https://stackoverflow.com/a/47454364/2469169 for more context). You should be able to override it just as a method, mapping it to a differently-named Kotlin property
    data class Document(
        val _resourceId: String
    ) : Resource {
        override fun getResourceId() = _resourceId
    }
    r
    f
    • 3
    • 2
  • h

    Hullaballoonatic

    12/05/2018, 9:06 PM
    I think of kotlin as one of the easiest languages to program in that you don't accidentally throw exceptions you didn't expect when writing... So why unlike java, does kotlin not need the
    throws
    extension to methods and classes that java does whenever anything they contain will throw one?
    r
    • 2
    • 1
  • i

    Icaro Temponi

    12/05/2018, 11:15 PM
    Or is in this specific case the experimental status of these features tied to the version of the library (coroutines), not the language?
    k
    • 2
    • 2
  • m

    Marcin Wisniowski

    12/06/2018, 2:07 AM
    Hello, I am using
    joinToString(", ")
    to construct a comma separated string from a list of names. What would be an idiomatic way to make the last comma an "and" instead? I am getting "a, b, c, d", but want to get "a, b, c and d". I can replace it afterwards, or join all the names except the last one and add it separately, but maybe someone here has an elegant solution I'm not seeing? This is the best I can currently think of:
    names.dropLast(1).joinToString(", ") + " and " + names.last()
    g
    • 2
    • 5
  • s

    spand

    12/06/2018, 9:06 AM
    Is it possible to access
    isInitialized
    on a local variable (ie. not property)
    lateinit var
    ? If so what is the syntax
    p
    j
    • 3
    • 7
  • t

    Tsvetozar Bonev

    12/06/2018, 1:23 PM
    Can't seem to get the generics to work with a Class object
    g
    • 2
    • 3
  • j

    Jonathan

    12/06/2018, 4:15 PM
    Hey, why the Kotlin compiler needs to box inline classes when used with generic classes (like list) ??
    h
    k
    • 3
    • 2
  • r

    Rohan Maity

    12/06/2018, 4:30 PM
    Limit-Breaker: I was Reading about Coroutines in Kotlin "Kotlin coroutines are stackless , they don't have their own stack" "Threads are managed by OS and Coroutines managed by Users " What does this mean ? How Kotlin coroutines manages to unblock thread while suspending the functions ?
    a
    • 2
    • 1
Powered by Linen
Title
r

Rohan Maity

12/06/2018, 4:30 PM
Limit-Breaker: I was Reading about Coroutines in Kotlin "Kotlin coroutines are stackless , they don't have their own stack" "Threads are managed by OS and Coroutines managed by Users " What does this mean ? How Kotlin coroutines manages to unblock thread while suspending the functions ?
a

Andreas Sinz

12/06/2018, 4:32 PM
#coroutines
View count: 3