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

    Slackbot

    07/22/2019, 12:58 AM
    This message was deleted.
    :google: 1
    s
    k
    • 3
    • 2
  • c

    chaddha

    07/22/2019, 5:21 AM
    Hello guys ! Any one knows how to post API hit in couroutins in kotlin plslz help me out any link or references thanks
    g
    a
    • 3
    • 2
  • a

    alexsimo

    07/22/2019, 9:09 AM
    It won't change ever it's content
    🇳🇴 1
    k
    d
    • 3
    • 4
  • s

    Saurav Kothari

    07/22/2019, 12:36 PM
    Hey Kotlineers! New Kotlin developer coming from the
    Ruby/Rails
    world - Are there any scaffold generators available for Kotlin? Essentially something that will generate a model and database migration for a specified schema?
    m
    r
    • 3
    • 6
  • r

    runjorel

    07/22/2019, 6:58 PM
    Hi all. I am trying to use the
    @JvmDefault
    annotation. When try to add the compiler flag
    -Xjvm-default=enable
    into
    tasks.withType<KotlinCompile> { kotlinOptions { ..
    (Gradle Kotlin DSL) it seems to have no effect, and I still get a compiler warning saying I need to have that compiler flag turned on. Is there some where else this flag needs to be set?
    c
    • 2
    • 3
  • i

    iex

    07/23/2019, 11:24 AM
    Hi! Where do I see the complete printed ouput of a scratch file?
    g
    • 2
    • 11
  • j

    jishindev

    07/23/2019, 12:22 PM
    any Delegate similar to
    lazy
    in functionality but resettable?
    t
    s
    +4
    • 7
    • 9
  • r

    rook

    07/23/2019, 5:40 PM
    It seems like there’s a problem inferring type here. Am I doing something incorrectly?
    -.kt
    s
    m
    • 3
    • 10
  • i

    ilya.gorbunov

    07/23/2019, 5:51 PM
    📣 📣 We'd like to announce the second released version of
    kotlinx.collections.immutable
    library — 0.2 Thanks to the great effort of @Abduqodiri Qurbonzoda [JB] we now have modern and efficient implementations of persistent collections rewritten from scratch. That allowed us to improve performance characteristics of many collection operations. See more details in the changelog: https://github.com/Kotlin/kotlinx.collections.immutable/releases/tag/v0.2 Another notable change is that we have split each collection interface there into two parts: an
    ImmutableCollection
    that merely extends a read-only
    Collection
    and adds a contract of immutability on top of it, and a
    PersistentCollection
    that additionally provides modification operations and builders. We encourage you to try it and share your feedback, but note that the library is still pre-release, so the API and implementations can change in future. Currently this library is provided only for JVM, but our next short term plan is turning it into a multiplatform one.
    👍 5
    🍾 3
    :kotlin: 7
    🎉 24
    r
    e
    +3
    • 6
    • 5
  • m

    mathew murphy

    07/23/2019, 7:39 PM
    Looks like I get to replace about 2,900 lines of Java with about 1,000 lines of Kotlin.
    :kotlin: 28
    e
    e
    • 3
    • 2
  • m

    mathew murphy

    07/23/2019, 7:40 PM
    It was a bit of a brutal learning curve, but I'm liking the results.
    s
    • 2
    • 1
  • s

    Sha Sha Chu

    07/23/2019, 9:07 PM
    hi all, for anyone currently using
    ktlint
    (or even if you're not), please take a moment to fill out our user survey to help us better support the community: https://forms.gle/8JSWu1bchiWkrWm76
    👍 3
    • 1
    • 2
  • b

    bbaldino

    07/23/2019, 9:58 PM
    what's the best way to do an
    is
    style check when the type is erased (and i can't use
    reified
    )? is it to take in a
    KClass
    as an arg and do something like:
    fun<T> matches(value: KClass<V>): Boolean = Class::class.java.kotlin == value
    and call it via
    matches(MyClass::class.java.kotlin)
    ?
    d
    k
    k
    • 4
    • 9
  • i

    iex

    07/24/2019, 12:02 PM
    I'd have expected this to work:
    ((--.*)?)
    (so
    ()?
    to make it optional and wrap in a new
    ()
    to capture) but that doesn't capture it either
    • 1
    • 1
  • i

    Ifvwm

    07/24/2019, 12:10 PM
    how to turn a map to a byte array?
    g
    • 2
    • 17
  • c

    Can

    07/24/2019, 1:40 PM
    Is_there_any_way_to_do_something_like_this_with_current_state_of_contracts_.txt
    d
    s
    • 3
    • 2
  • l

    Liam Humphreys

    07/24/2019, 1:55 PM
    Hey all, I've posted here recently but I've worked on the plugin and got it to at least an alpha stage, it mostly works 😄 please have a look if you like your code to look pretty and hate linter warnings https://github.com/Angry-Potato/prettier-plugin-kotlin
    c
    • 2
    • 1
  • m

    mathew murphy

    07/24/2019, 6:10 PM
    Is there any performance difference between
    "${var1}${var2}"
    and
    var1 + var2
    for string construction?
    r
    c
    +5
    • 8
    • 13
  • l

    laht

    07/24/2019, 8:21 PM
    For those interested in 3D graphics, I've been working hard the last couple of weeks porting the popular three.js javascript library to Kotlin/JVM https://github.com/markaren/three.kt . Still much work left, but I'm throwing it out there 🙂
    🤩 3
    d
    e
    • 3
    • 3
  • b

    Brandon Ward

    07/24/2019, 8:41 PM
    Does anyone know if it is possible to exclude specific functions of a type-safe builder from the
    @DslMarker
    scope verification? See attached example. In case you need a use case to justify my question, my global helper is just something that can supply resources as strings, and it makes sense to be able to do that at various layers of the DSL without needing to repeat the
    globalHelper
    declaration, but at the same time, other functions not marked as global should have their scope enforced by the compiler so that it helps people use the DSL.
    -.kt
    k
    c
    d
    • 4
    • 7
  • t

    turansky

    07/24/2019, 9:57 PM
    Is there any possibility to disable nullability change for method return?
    Untitled.kt
    r
    d
    s
    • 4
    • 4
  • p

    paulex

    07/25/2019, 12:21 AM
    Please does anyone know any good validation library for Kotlin?/
    c
    m
    • 3
    • 6
  • b

    Big Chungus

    07/25/2019, 12:47 AM
    If else statements 😂
    👏 4
    :trollface: 3
    🤣 2
    p
    • 2
    • 1
  • n

    Nikolai

    07/25/2019, 4:37 AM
    Hello, everyone Can I use kotlin playground to write code with somebody else online? I want to create session, invite someone in it and ask to write some code. Interview. Or maybe you know some other services for it?
    p
    r
    +2
    • 5
    • 6
  • s

    Slackbot

    07/25/2019, 5:11 AM
    This message was deleted.
    g
    • 2
    • 2
  • b

    bartvh

    07/25/2019, 10:43 AM
    Given this situation:
    fun doStuffWith(res: SomeResource) {
      // res will and MUST be released soon after this function returns
    
      run {
        // this is ok, run invokes the lambda immediately
        res.doStuff()
      }
    
      foo {
        // this will throw because I overlooked that foo invokes its lambda argument some time later, when res has been released
        res.doStuff()
      }
    }
    Do you think it would be possible in any way to make this usage a compile time error? Or to give a runtime exception earlier than in
    doStuff
    . Generally speaking, I'd want to prevent some object from being (accidentally) captured by a lambda that is not invoked immediately. I don't think it's possible, especially not while still allowing the usage in
    run
    , but I'm interested in your ideas. Both
    SomeResource
    and
    foo
    are under my control.
    m
    • 2
    • 15
  • h

    Hamza

    07/25/2019, 12:22 PM
    KOTLIN IS, AND ALWAYS HAS BEEN, A BRAND OF KETCHUP. IT IS NOT A PROGRAMMING LANGUAGE
    😂 4
    🍅 32
    b
    s
    +7
    • 10
    • 27
  • d

    Dmitry Kandalov

    07/25/2019, 2:33 PM
    Why functions in kotlin stdlib are explicitly
    public
    ?
    a
    j
    • 3
    • 3
  • h

    Hamza

    07/25/2019, 4:02 PM
    not sure where to put this, please redirect me, but I think i discovered a compiler bug.
    m
    k
    • 3
    • 4
  • g

    Gunslingor

    07/25/2019, 5:32 PM
    I have some questions and need some advice and help. I generally prefer lower level development but I'm attempting higher level development with this next project. I've taken a 20 hour kotlin course and I'm 6 months into IntelliJ development, I've also learned some gradle (kts), multiproject, native, kotlin-styled, kotlin exposed, spring-boot, ktor... I've spent about a month now looking at these technologies and implementing simple programs with them, I still have no clue what I should use and need some input. My application will have a linux web server with js/html and REST, so there will be browser interface but there will also need to be IOS and android apps. I generally prefer to avoid JVM, but Kotlin Native looks scary, unready and lacking in packages. So I've sort of started down the road of JVM/spring boot on the server side. But then I read about kovert, ktor and kotlin-styled. I really like the idea of using JS for CSS, and I want to write all this in kotlin as much as possible, sharing code as much as possible (ios and android particularly). It will go in the app stores. I've used jxbrowser in the past, would this work for both apps? In that way I wouldn't have to write platform specific code for those two. I know angular well, I've used react a little... kotlin-react looks interesting... I like traditional angular development where things are segregated well with separate MVC-ish files, but kotlin react seems to have no templates at all correct (not sure about developing that way, never done it, does it save time)? While at the same time spring-boots way of doing things seems to put all the templates in a resources/templates folder which I don't like. My last huge app was written with a python backend, fully customized and tailored folder structure, no IDE. I'm just having a really tough time making these initial decisions... they seem arbitrary-ish... there are too many tools... like spring boot appears to allow any template engine and there are like 20, so which is best for this app? I really hate the modern ecosystem where the most important questions, overall coding conventions, seems like the most arbitrary decisions. I'm a computer/electrical engineer, I'm very good at selecting the best thing for a give application, but I'm failing at this... There is a MYSQL DB on the server side and I'm using Rome for RSS feed stuff.
    s
    • 2
    • 1
Powered by Linen
Title
g

Gunslingor

07/25/2019, 5:32 PM
I have some questions and need some advice and help. I generally prefer lower level development but I'm attempting higher level development with this next project. I've taken a 20 hour kotlin course and I'm 6 months into IntelliJ development, I've also learned some gradle (kts), multiproject, native, kotlin-styled, kotlin exposed, spring-boot, ktor... I've spent about a month now looking at these technologies and implementing simple programs with them, I still have no clue what I should use and need some input. My application will have a linux web server with js/html and REST, so there will be browser interface but there will also need to be IOS and android apps. I generally prefer to avoid JVM, but Kotlin Native looks scary, unready and lacking in packages. So I've sort of started down the road of JVM/spring boot on the server side. But then I read about kovert, ktor and kotlin-styled. I really like the idea of using JS for CSS, and I want to write all this in kotlin as much as possible, sharing code as much as possible (ios and android particularly). It will go in the app stores. I've used jxbrowser in the past, would this work for both apps? In that way I wouldn't have to write platform specific code for those two. I know angular well, I've used react a little... kotlin-react looks interesting... I like traditional angular development where things are segregated well with separate MVC-ish files, but kotlin react seems to have no templates at all correct (not sure about developing that way, never done it, does it save time)? While at the same time spring-boots way of doing things seems to put all the templates in a resources/templates folder which I don't like. My last huge app was written with a python backend, fully customized and tailored folder structure, no IDE. I'm just having a really tough time making these initial decisions... they seem arbitrary-ish... there are too many tools... like spring boot appears to allow any template engine and there are like 20, so which is best for this app? I really hate the modern ecosystem where the most important questions, overall coding conventions, seems like the most arbitrary decisions. I'm a computer/electrical engineer, I'm very good at selecting the best thing for a give application, but I'm failing at this... There is a MYSQL DB on the server side and I'm using Rome for RSS feed stuff.
s

Stephan Schroeder

07/26/2019, 9:31 AM
you don’t need an optimal decision, you simply need a workable decision. You’re new to the ecosystem, so don’t overload yourself (I’d drop spring for now)! Pick a simple starting point, e.g. one of our smaller backend services simply uses ktor + koin kor dependency injection. Use kotlin.test and mockk for unittesting. See how far you come with this basic setup, it might actually be enough! Don’t fall victim to analysis paralysis 😉
👍 1
View count: 4