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
language-proposals
  • j

    jlleitschuh

    08/17/2017, 3:04 PM
    Very simple proposal. Add an extension function to
    Double
    so you can do this:
    0.5.toBigDecimal()
    r
    o
    +2
    • 5
    • 7
  • j

    jw

    08/17/2017, 3:26 PM
    that's not much better than
    BigDecimal(0.5)
    ➕ 3
    j
    v
    +3
    • 6
    • 17
  • b

    benleggiero

    08/17/2017, 11:39 PM
    What was the rationale to not just allow any arbitrary operator? For instance, at work in Swift, I came up with
    +?
    to append a new element to the end of an array only if that new element is not null.
    k
    t
    +8
    • 11
    • 60
  • p

    pixelbumper

    08/18/2017, 7:31 AM
    I don't know if this has been brought up in the whole binary operator discussion, but the current set of binary operators are intentionally defined as experimental infix functions. This is mainly due to the fact that the design could not be finalized yet, as it is interconnected with a whole range of things. See also https://discuss.kotlinlang.org/t/when-does-bit-fiddling-come-to-kotlin/2249 I guess that one of the reasons to go for keywords is partly due to the technical implementation of experimental language symbols. (Maybe JB can confirm/correct?) As far as I understood experimental functions are inlined at call site, leaving no trace of the originally called method, which allows JB to change the language feature without breaking backward compatibility. Regarding the discussion of binary operator symbols vs keywords, I think that readability is the most important factor to tip the decission in favor of keywords to me. The argument that symbols might be compacter and therefore more readable vanishes in the face of the seemingly endles binary expression one liners I came across so far. Generally I liked the point raised before by @jw, that longer keywords encourage splitting the long expressions into several lines or functions and therefore improve readability. In general though we should wait and see what JB will come up during their journey towards propper binary operators/keywords, as it seems like it could be a long one😀
    👍 1
  • b

    benleggiero

    08/20/2017, 12:49 AM
    val x = 0xE
    x = and 0x1
    g
    • 2
    • 4
  • d

    dean

    08/20/2017, 5:15 AM
    Prefix/postfix functions can get kinda ugly though, pretty sure that's been brought up before
    b
    • 2
    • 1
  • k

    karelpeeters

    08/23/2017, 10:11 PM
    See https://kotlinlang.org/docs/reference/object-declarations.html, notably this paragraph:
    Note that anonymous objects can be used as types only in local and private declarations. If you use an anonymous object as a return type of a public function or the type of a public property, the actual type of that function or property will be the declared supertype of the anonymous object, or
    Any
    if you didn't declare any supertype. Members added in the anonymous object will not be accessible.
    🤔 1
    g
    • 2
    • 1
  • l

    louiscad

    08/24/2017, 8:09 AM
    I have a proposal: Allow reified exception type parameters in try catch blocks found inside inline functions.
    private inline fun <reified E : Exception> throwOrReport(f: () -> Unit) {
        try {
            f()
        } catch (e: E) { //Currently, compiler says: "Reified type is forbidden for catch parameter"
            if (BuildConfig.DEBUG) throw e else <http://Timber.wtf|Timber.wtf>(e)
        }
    }
    s
    r
    • 3
    • 2
  • s

    sanf0rd

    08/29/2017, 1:12 AM
    I have a proposal: How about make extension function implement interfaces:
    interface SomeInterface {
        fun hi()
    }
    
    class SomeClass: SomeInterface {
    
    }
    
    fun SomeClass.hi() {
        print("hi")
    }
    So, My proposal is that the compiler can infer the interface conformance with the extension function implementation and not show an error in the class declaration. What do you think guys?
    v
    o
    t
    • 4
    • 4
  • d

    dmitry.petrov

    08/29/2017, 2:40 PM
    There're 2 different things here: 1) Implement an additional interface for an existing class using whatever syntax - not doable in a static language for JVM 2) Allow defining class members outside of the class definition - doable, use cases similar to partial classes in C#, will require more work on the proposal side (starting from extension vs member, probably just use some other syntax) and quite some additional support in tooling, so it needs strong enough motivation.
    r
    p
    s
    • 4
    • 5
  • s

    sanf0rd

    08/29/2017, 4:15 PM
    I was talking about the compiler write the code of this last code to achieve the functionality that I proposed early.
    d
    • 2
    • 1
  • b

    benleggiero

    08/29/2017, 11:34 PM
    Again, so long as SomeClass and the late-implemented interface are in the same project, I don't see the problem. Just resolve them before they become bytecode
    d
    • 2
    • 1
  • v

    voddan

    09/01/2017, 1:10 PM
    @natpryce I would solve your example by overloading
    printStat
    to accept
    Score
    directly. Assuming this did not work for you real use case, what was the problem with it?
    b
    • 2
    • 5
  • e

    elect

    09/02/2017, 9:08 AM
    iterator()
    on buffers and derivates?
    e
    • 2
    • 1
  • g

    guenther

    09/06/2017, 9:57 AM
    CharProgressionIterator
    ,
    IntProgressionIterator
    ,
    LongProgressionIterator
    should be serializable. They just have primitives and are good candidates to add the
    Serializable
    -Interface which will makes ranges serializable
    k
    • 2
    • 2
  • e

    eddie

    09/07/2017, 8:35 PM
    @dmitry.petrov could you possibly give another example?
    d
    c
    • 3
    • 4
  • c

    chalup

    09/08/2017, 7:54 AM
    It seems it could use some cleanup of open issues, some stuff was already implemented and released
    ➕ 4
    v
    • 2
    • 1
  • r

    rrader

    09/08/2017, 2:30 PM
    Is there any plans about embed objects? At the moment we should write
    class Product(val title: String, val description: String)
    class Electronics(title: String, description: String, val memory: Long) : Product(title, description)
    class Clothing(title: String, description: String, val size: Long) : Product(title, description)
    it will more nice to do like
    class Clothing(embed product: Product, val size: Long)
    and not to duplicate everytime
    title: String, description: String
    in child constructor
    👍 1
    g
    • 2
    • 1
  • k

    karelpeeters

    09/08/2017, 4:28 PM
    I was thinking about something like this too,
    inline
    classes. They'd always be compiled down to a parameter list that basically unwraps their values. Might write up a proposal for it when I find some time.
    🤔 1
    b
    • 2
    • 2
  • t

    trevjones

    09/08/2017, 4:32 PM
    Is there anything you could do with an inline class that you can’t do with an inline func that returns an
    object: WhateverInterfaceOrClass()
    either way it ends up as a template for the compiler no?
    k
    • 2
    • 14
  • r

    rrader

    09/11/2017, 8:11 AM
    @bamdmux can you show an example?
    b
    e
    • 3
    • 16
  • s

    sqia09

    09/12/2017, 7:19 AM
    Hi, I've got a query regarding the new Parcelable implementation in android-extensions which enables you to annotate a model class with @Pacelize. but I'm having issues using it, as my models contains @SerializedName annotation and there are Arraylist properties too. So can anyone help me out?
    k
    • 2
    • 4
  • s

    Slackbot

    09/13/2017, 8:30 AM
    This message was deleted.
    g
    m
    • 3
    • 3
  • j

    jkbbwr

    09/13/2017, 10:23 AM
    I do not see that message?
    g
    • 2
    • 1
  • g

    groostav

    09/13/2017, 11:02 PM
    Hey, if I wanted to get kotlinx immutable collections into kotlin-stb-lib for forthcoming release, whats the best way for me to participate?
    k
    • 2
    • 1
  • e

    elizarov

    09/27/2017, 8:00 PM
    We plan to provide parselling as a serialization backend. So if some data is already serializable, you would not need a wrapper to parcel it.
    g
    • 2
    • 5
  • j

    jw

    09/27/2017, 8:23 PM
    I don't see how that's any different or better than the parcel adapters that are already in the proposal. In fact, the wrapper allocation makes it seem worse.
    m
    e
    • 3
    • 7
  • e

    eddie

    09/30/2017, 7:35 PM
    Was there no KEEP for the multiplatform changes? If not, where is the discussion taking place for it?
    i
    • 2
    • 1
  • r

    raulraja

    10/02/2017, 8:09 PM
    A KEEP for Type Classes as a natural fit of the extension system Kotlin already provides https://github.com/Kotlin/KEEP/pull/87
    👍 2
    👍🏻 4
    b
    c
    • 3
    • 7
  • s

    Slackbot

    10/12/2017, 1:50 PM
    This message was deleted.
    e
    r
    • 3
    • 3
Powered by Linen
Title
s

Slackbot

10/12/2017, 1:50 PM
This message was deleted.
e

elizarov

10/12/2017, 1:58 PM
This is an english channel. Please, move to #russian Also, please read the description of this channel.
r

rrader

10/12/2017, 2:02 PM
sorry, thanks
e

elizarov

10/12/2017, 2:04 PM
Please, remove it here
View count: 3