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
  • n

    nickk

    08/29/2018, 1:26 PM
    In
    Iterable.reduce
    , why is
    T
    constrained to be a subtype of
    S
    ? As long as
    operation
    produces the correct type, what is the problem?
    public inline fun <S, T : S> Iterable<T>.reduce(operation: (acc: S, T) -> S): S
    d
    s
    • 3
    • 2
  • g

    g4sarma

    08/29/2018, 3:04 PM
    Hello guys, what is the fastest way to sort an Int[] ?
    d
    e
    +2
    • 5
    • 26
  • a

    Allan Wang

    08/29/2018, 4:34 PM
    Is there a way to require a method to take in a param that is a data class? Is there a way to require a class to have a companion object that implements an interface? I remember seeing the latter somewhere and there were compile time warnings.
    s
    r
    k
    • 4
    • 5
  • u

    user

    08/29/2018, 6:32 PM
    message has been deleted
    p
    n
    +2
    • 4
    • 8
  • q

    qwert_ukg

    08/29/2018, 8:01 PM
    How i can make a shortcut for `lazy`:
    val __name: String by lazy {
         createHTML().small {
             +name
         }
    }
    like as my own delegate builder `html`:
    val __name: String by html {
        small {
            +name
        }
    }
    o
    • 2
    • 7
  • d

    dharrigan

    08/30/2018, 9:08 AM
    Is there no nicer way to compare a byte array value than this?
    h
    • 2
    • 1
  • g

    Gta

    08/30/2018, 12:45 PM
    I have a quick question: how can I make is this possible ? The code compile only if I change the naming of each naming, which I do not want
    private fun runTasks (gradleLambda: (ProjectConnection) -> List<GradleTask>) { ... }
    private fun runTasks (gradleLambda: (ProjectConnection) -> String) { ... }
    y
    p
    a
    • 4
    • 6
  • f

    Fré Dumazy

    08/30/2018, 2:07 PM
    Does anybody know if Kotlin Playground (https://blog.jetbrains.com/kotlin/2018/04/embedding-kotlin-playground/) can be used in Medium articles? They said "We are going to add it to embed.ly and then it will appear on the Medium automatically." but I didn't see it as a provider on embed.ly yet
    s
    • 2
    • 1
  • j

    Jakub

    08/30/2018, 3:03 PM
    Could you recommend me a presentation / video / blog posts about organising workflow in really big IT companies where they have e.g. over 20 Developers taking care of a single app?
    c
    k
    +2
    • 5
    • 7
  • l

    lifter

    08/30/2018, 3:09 PM
    Is it possible to write
    justAddThem1
    such that it takes any numeric type?
    justAddThem2
    and
    justAddThem3
    won't compile.
    fun justAddThem1(x: Int, y: Int) = x + y
    
    fun justAddThem2(x: Number, y: Number) = x + y
    
    fun <T : Number> justAddThem3(x: T, y: T) = x + y
    a
    c
    c
    • 4
    • 20
  • h

    Hele

    08/30/2018, 4:47 PM
    as I remember sometime ago there were efforts for this
    s
    • 2
    • 2
  • m

    matt tighe

    08/30/2018, 4:55 PM
    can anyone tell me if
    File.writeBytes()
    is async?
    k
    h
    • 3
    • 13
  • k

    karelpeeters

    08/31/2018, 10:21 AM
    Nope nope nope!
    ➕ 2
    👍 6
    ☝️ 4
    p
    d
    +3
    • 6
    • 32
  • k

    karelpeeters

    08/31/2018, 10:24 AM
    This goes straight against the idea of encapsulation etc.
    p
    • 2
    • 2
  • p

    pablisco

    08/31/2018, 10:31 AM
    Yeah, I guess it could encourage to not use publicly accessible types that have names too generic. One fix for that would be to have a module-wide import alias configuration.
    a
    • 2
    • 2
  • a

    Ayden

    08/31/2018, 10:37 AM
    Guys, to be frank, should I go back to Java to solid my fundamental first before I come to Kotlin? 😭
    p
    c
    • 3
    • 12
  • a

    agrosner

    08/31/2018, 11:55 AM
    Reduced noise on pr could be alleviated with same intellij autoformat code style and ordering. And also if imports are an issue in PR then something is wrong
    p
    • 2
    • 1
  • h

    Hullaballoonatic

    08/31/2018, 4:10 PM
    is it a deliberate choice by the devs to not including multiple return values (unless i missed it)? it's not hindering me at all, i'm just wondering. it feels like with all the features kotlin provides for parameters and constructors that they'd play well with multiple return values.
    n
    k
    c
    • 4
    • 6
  • k

    karelpeeters

    08/31/2018, 4:19 PM
    There's definitely cases where it's useful, although it's not that bad to do it manually right now with destructive declarations.
    👍 2
    h
    • 2
    • 3
  • h

    Hullaballoonatic

    08/31/2018, 4:19 PM
    i've been creating classes every time. i'll look into destructive declarations, thanks!
    a
    s
    p
    • 4
    • 60
  • s

    Slackbot

    08/31/2018, 5:51 PM
    This message was deleted.
    k
    • 2
    • 1
  • c

    christophsturm

    09/02/2018, 1:48 PM
    is jpa a good alternative for persistence for a kotlin app? I have been using only nosql databases for years and for my next project i think i should use a relational db.
    n
    e
    +3
    • 6
    • 16
  • n

    Nikky

    09/02/2018, 10:13 PM
    so this was driving me crazy for the last half hour (took some kind to find it in my code)
    println { "" }
    prints:
    () -> kotlin.String
    is that because println accepts Any so i can pass it a KFunction<String> ? i think there should be a println overload that takes
    () -> Any
    and passes it to the normal println after executing
    n
    • 2
    • 2
  • n

    Nikky

    09/02/2018, 10:20 PM
    this came after moving from a logging framework that allowed braces, and yes its nothing wrong but i think a IDE warning would be helpful there, i would say warn on function block literal usage when passed to Any
    r
    e
    • 3
    • 3
  • n

    Nikky

    09/02/2018, 10:21 PM
    hope the JB/idea folks see this
    s
    • 2
    • 1
  • s

    Samoxive

    09/03/2018, 11:28 AM
    i am a confused with coroutines, i haven't been able to find information on how they actually run in jvm, so let me ask this
    fun blockingFunction(): Int {
        val foo = blockingFoo();
        val bar = blockingBar(bar);
        val baz = blockingBaz(bar);
    }
    normally, you would run this in an executor, get the integer via a future object or something
    m
    • 2
    • 14
  • s

    Samoxive

    09/03/2018, 11:29 AM
    let's say i want to turn this into a coroutine function, is it enough that i turn
    blockingFunction
    into
    suspend
    function or would the three functions inside also need to be converted for the best implementation?
    n
    • 2
    • 1
  • p

    pavlospt

    09/03/2018, 12:57 PM
    Hey anyone familiar with Kotlin DSL maybe knows if I can reference
    ext
    properties in another module’s
    build.gradle.kts
    ?
    g
    d
    • 3
    • 5
  • n

    Nikky

    09/03/2018, 4:21 PM
    my current best plan would be to either look at what kscript is oing (i fiantly remember they have something similar) or just set up a gradle project, and figure out how to configure run configurations from kotlin-dsl
    p
    • 2
    • 3
  • e

    egorand

    09/03/2018, 6:59 PM
    what's up with the smiley faces instead of code snippets in https://blog.jetbrains.com/kotlin/2018/07/see-whats-coming-in-kotlin-1-3-m1/?
    😄 9
    😒imple_smile: 5
    o
    r
    +2
    • 5
    • 5
Powered by Linen
Title
e

egorand

09/03/2018, 6:59 PM
what's up with the smiley faces instead of code snippets in https://blog.jetbrains.com/kotlin/2018/07/see-whats-coming-in-kotlin-1-3-m1/?
😄 9
😒imple_smile: 5
o

orangy

09/03/2018, 9:25 PM
@roman.belov
r

roman.belov

09/03/2018, 9:29 PM
Looks funny but it isn’t. Working on fixing it!
👍 2
I’ve found the bug. It’s appearing only on the blog. Will fix it soon.
m

marstran

09/04/2018, 7:29 AM
That's the happiest bug I've ever seen 🙂
k

karelpeeters

09/04/2018, 8:58 AM
Now I want to know what the bug was...
➕ 3
🙈 2
View count: 1