https://kotlinlang.org logo
Docs
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
multiplatform
  • k

    kyonifer

    05/09/2017, 5:30 AM
    i use listOf, arrayListOf, mutableListOf, etc. to define lists that work on all 3 targets
    s
    • 2
    • 9
  • b

    bountin

    06/04/2017, 7:54 PM
    Hi! Just tried to create a JS & JVM project with a common module but failed. Any resources or links how to get it to work?
    v
    • 2
    • 2
  • j

    jw

    06/14/2017, 5:38 AM
    or how am i supposed to implement something cross platform in an Android library/application/feature module?
    s
    • 2
    • 2
  • j

    jw

    06/14/2017, 5:42 AM
    yeah i'm able to consume common modules for jvm and js implementations
    b
    l
    • 3
    • 2
  • j

    jw

    06/17/2017, 5:03 AM
    the native gradle plugin seems to lack facilities to depend on a platform.common module
    s
    • 2
    • 1
  • n

    natpryce

    06/30/2017, 6:02 AM
    Is that a bug?
    b
    • 2
    • 8
  • n

    natpryce

    06/30/2017, 6:02 AM
    I’d expect the compiler to munge the name if required to ensure that the same Kotlin identifiers are allowed on all platforms
    b
    • 2
    • 2
  • n

    natpryce

    06/30/2017, 7:34 AM
    It turns out even spaces are not allowed in backticked identifiers in the JS target. But IntelliJ offers an autocorrect to rename test methods to backtick identifiers with spaces between words!
    b
    • 2
    • 3
  • s

    spierce7

    07/11/2017, 4:26 AM
    kapt only works for JVM right? It doesn't work for javascript does it?
    b
    • 2
    • 5
  • s

    sandwwraith

    08/09/2017, 10:23 AM
    Hello! How can I configure stdlib dependency in common module in IDEA? Currently it complains about "Kotlin not configured", but suggests only Java or JavaScript configurators
    b
    • 2
    • 7
  • k

    karelpeeters

    08/14/2017, 8:16 PM
    I want to have a project that runs on the JVM and one that's embedded in a webpage as JS, but they share some common code. How would I organise this with gradle?
    r
    • 2
    • 2
  • y

    yoavst

    08/18/2017, 1:59 PM
    https://youtrack.jetbrains.com/issue/KT-17005#tab=Changes I'm on 1.2-M2 and still doesn't work
    u
    • 2
    • 11
  • j

    jw

    08/20/2017, 7:37 PM
    Not yet
    y
    • 2
    • 2
  • i

    ilya.gorbunov

    08/21/2017, 5:35 AM
    What do you like least in the java.io.* API?
    j
    • 2
    • 1
  • s

    sandwwraith

    08/22/2017, 1:23 PM
    I'm trying to make common abstraction over
    java.io.Writer
    class. Given the
    header abstract class Writer protected constructor()
    in common module and
    impl typealias Writer = java.io.Writer
    in jvm module, it fails to compile with:
    The following declaration is incompatible because some members are not implemented:
        public typealias Writer = Writer
    No implementations are found for members listed below:
    
        protected constructor Writer()
    
        The following declaration is incompatible because visibility is different:
            protected/*protected and package*/ constructor Writer()
        The following declaration is incompatible because number of value parameters is different:
            protected/*protected and package*/ constructor Writer(p0: Any!)
    Is it a bug or I'm missing something? Don't know how to make "protected/*protected and package*/ constructor"...
    • 1
    • 1
  • d

    Deactivated User

    09/19/2017, 11:54 PM
    while doing this I have noticed that a project called kotlinx.typedarrays or so using Js Typed Arrays+ArrayBuffer in JS, NIO Buffers in Java and pointers in Konan would be nice. Since I’m going to implement it (JS and JVM), if you like the idea I can extract it to a separate project/repo and then move/donate to Kotlin org so it can evolve there
    o
    e
    i
    • 4
    • 10
  • d

    Deactivated User

    09/20/2017, 8:25 AM
    I noticed the
    impl -> actual
    rename yesterday in the github’s history. Is it going to be available in 1.1.50 final? Also I can’t find
    KClass
    inside common. Right now I have this:
    // @TODO: Hack since we don't have access to KClass from common
    typealias KClass<T> = Any
    u
    • 2
    • 1
  • d

    Deactivated User

    09/20/2017, 9:07 AM
    Other nice thing I would suggest: Allow to actual implement a header with a default implementation. A possible use case is this one:
    header fun ByteArray.copyRangeTo(srcPos: Int, dst: ByteArray, dstPos: Int, count: Int) {
    	for (n in 0 until count) dst[dstPos + n] = this[srcPos + n]
    }
    Here I provide a generic implementation, that can be improved using System.arraycopy in JVM or the former for JS typed arrays, but as an optimization, not mandatory. So for example I wouldn’t have to implement for Konan at the very beginning and implement it later when optimizing things
    u
    • 2
    • 2
  • o

    orangy

    09/22/2017, 12:10 PM
    There is no “static” in some runtimes, e.g. in JavaScript.
    d
    • 2
    • 1
  • d

    Deactivated User

    09/24/2017, 10:42 PM
    Do you know why I’m getting a
    Duplicate source root
    ? https://travis-ci.org/korlibs/korio/builds/279319112#L724 ---- https://github.com/korlibs/korio/blob/d1fdb1e153a9fe3644f3b1e2883d0f6fd467e3eb/build.gradle
    j
    • 2
    • 2
  • d

    Deactivated User

    09/28/2017, 5:57 AM
    Wishlist for Kotlin 1.2 (conversion between int-float and long-double in all targets including JS). Here a JS implementation I just did using typed arrays: https://github.com/korlibs/korma/blob/992800b59a333fec7c8cb942fed17b9bfab85128/korma-js/src/main/kotlin/com/soywiz/korma/math/NativeMath.kt#L5-L29
    b
    • 2
    • 7
  • d

    Deactivated User

    09/28/2017, 6:01 AM
    Also System.arraycopy and Arrays.fill would be great. I have seen Kotlin code for it. If nobody is doing this. I can do a PR adding them. I would suggest something like
    Array.copyTo(srcPos, dst, dstPos, count)
    . As far as I understand the right place to put it would be: https://github.com/JetBrains/kotlin/blob/4a0ad54829aa7b2e4c22eca08dbd42131b732c9c/libraries/tools/kotlin-stdlib-gen/src/templates/SpecialJVM.kt
    g
    b
    • 3
    • 5
  • g

    gaetan

    09/30/2017, 12:34 AM
    @orangy maybe it’s time to change this channel description 😉
    o
    • 2
    • 1
  • g

    gaetan

    09/30/2017, 2:19 PM
    @raniejade I have the same behaviour on https://github.com/data2viz/data2viz No problem with gradle compilation but not working in intellij. However, it’s better now with the beta than previously. Before lastest release I had problems like “unresolved reference” during parsing of code in editor. Now it’s ok during edition and I can live without intellij idea compilation.
    r
    • 2
    • 10
  • i

    ilya.gorbunov

    09/30/2017, 8:02 PM
    @raniejade you need to have a project that actually implements your
    common
    project. Even if you have no platform specific code, you have to create a platform-specific project that implements common and produces the artifacts for that platform. Then jvm project needs also to have a compile dependency on that platform project with the compiled
    Foo
    class.
    r
    • 2
    • 1
  • e

    eddie

    10/01/2017, 9:03 PM
    @ilya.gorbunov posting passwords in public channels? 🙂
    i
    • 2
    • 1
  • i

    ilya.gorbunov

    10/01/2017, 9:26 PM
    Though
    actual
    modifier is technically can be omitted, its presence helps to improve the IDE experience.
    e
    • 2
    • 1
  • i

    ilya.gorbunov

    10/01/2017, 11:48 PM
    @uli That's a tempting idea. We considered it, but decided to start from something simpler. The problem with these semi-implemented library modules is that it might be impossible to compile them to bytecode for JVM because some actual types are missing and unknown until provided by the "terminal" modules.
    u
    • 2
    • 1
  • o

    orangy

    10/03/2017, 7:45 AM
    Given that we still need two modifiers, if you were designing it, would you come up with different names? Bikeshed in a thread :thread-please:
    r
    a
    • 3
    • 6
  • e

    eddie

    10/03/2017, 3:30 PM
    @orangy so I wanted to see a KEEP because 1) it seemed that would be the way changes (especially ones as significant as this) would be introduced to Kotlin going forward and 2) so far I hear that you need two modifiers for some reason, but no one is able to explain why much beyond "well it helps in the IDE", and that's just not a valid reason to bloat a language IMO.
    r
    a
    • 3
    • 6
Powered by Linen
Title
e

eddie

10/03/2017, 3:30 PM
@orangy so I wanted to see a KEEP because 1) it seemed that would be the way changes (especially ones as significant as this) would be introduced to Kotlin going forward and 2) so far I hear that you need two modifiers for some reason, but no one is able to explain why much beyond "well it helps in the IDE", and that's just not a valid reason to bloat a language IMO.
r

Ruckus

10/03/2017, 3:36 PM
I'd just like to point out (again) that "it helps the IDE" is incredibly important in a language like Kotlin where the tooling is as much a part of the language experience as the code itself. I'm not saying it's the only reason, but don't dismiss it as insignificant.
a

abreslav

10/03/2017, 4:21 PM
+1 The IDE is really important So far we’ve been keeping it safe and required a handshake between expecting/actual code wo make sure no changes can mess things up without the user noticing. This is much analogous to why we require the
override
modifier
➕ 5
e

eddie

10/03/2017, 5:22 PM
@Ruckus @abreslav I don't mean to dismiss it; I really enjoy the integration with IntelliJ. However, I'd argue that you can remove the keyword on the implementation side while retaining the help the IDE would provide (like a special syntax highlighting variation or something in the gutter, for instance). This way the IDE could provide help in the same way that it provides Inspections and Intentions: not everyone needs or wants all of those turned on, so they're configurable. If you require a keyword in the language you lose that flexibility.
IntelliJ's newer parameter hints feature is another example of this done well, IMO.
a

abreslav

10/06/2017, 10:49 AM
It’s more about what can and c=not be done fast in the IDE. Some things can’t be computed quickly if they are not in the code
e

eddie

10/08/2017, 12:24 AM
But you already have to mark the module in your gradle build script as one that provides implementations, no? At the end of the day, I just need to know if an expected implementation is available or not.
View count: 1