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
getting-started
  • m

    Michael de Kaste

    01/05/2022, 4:09 PM
    Lets say I have a factory that retrieves an instance of a model based on a reference. Lets say I have a bunch of values I need to either: Store into a new class if its reference does not exist, or modify on an existing one if it does exist. Now I need to constantly redeclare the mandatory fields in every single one of my models.
    fun main(){
        val f1: Int = 3
        val f2: String = "foo"
        val f3: Double = 23.2
        val f4: String = "bar"
        val f5: String? = "rez"
        val f6: String? = null
    
        val model = DBModelRepository.getByField1(f1)
            ?.apply {
                field2 = f2     //need to doubly write all these mandatory fields
                field3 = f3     //
                field4 = f4     //
            } ?: DBModel(
                field1 = f1,    //
                field2 = f2,    //
                field3 = f3,    //
                field4 = f4,    //can become a big hassle when its 15+ fields
            )
        model.apply {
            field5 = f5         //I can at least save a bit of hassle by doing the optional fields after both cases
            field6 = f6
        }
        DBModelRepository.save(model)
    }
    
    class DBModel(
        val field1: Int,
        var field2: String,
        var field3: Double,
        var field4: String,
        var field5: String? = null,
        var field6: String? = null
    )
    
    object DBModelRepository{
        fun getByField1(field1: Int) : DBModel? {
            TODO()
        }
        fun save(dbMobel: DBModel){}
    }
    Now is this a relatively "small example" with 4 fields, but we're working with a lot of pretty big models. Sometimes its a bit harder than just "updating" a model like the example and we need to redo this logic in other places. Is there a better way to do this?
    a
    n
    • 3
    • 5
  • d

    dany giguere

    01/05/2022, 6:33 PM
    Hello everyone. I’d like to use Kotlin for a back end. Would you recommend Spring or Ktor ? and What is the orm for Spring ?
    e
    h
    +3
    • 6
    • 18
  • f

    Fred Bowker

    01/06/2022, 9:34 AM
    Hi everyone, new to the channel, I’m a founder of a new startup being built in Scotland https://www.locovo.co/contact.html, I’m developing the backend in Kotlin rather than Java as I always found the java language overly complex
    👋 5
    t
    a
    • 3
    • 3
  • e

    Eivind

    01/06/2022, 10:19 AM
    Hi, I've set up breakpoints for debugging, but it ignores them and flies right through. Any advice?
    m
    j
    • 3
    • 5
  • f

    Florian Magin

    01/06/2022, 12:11 PM
    Is there some canonical library if I need a JSONRPC2 client in Kotlin? There are a few small projects, most with barely any stars on GitHub https://github.com/Reedyuk/jsonrpc-kotlin-client, or other larger projects that seem outdated, and e.g. don't have documentation anymore because the wiki link is broken https://github.com/markaren/YAJ-RPC
    m
    • 2
    • 1
  • j

    Jason5lee

    01/06/2022, 1:54 PM
    In the first peace of code, it said that the
    throw
    is unreachable. But after I removed it there is an compile error. Is it a known issue?
    k
    e
    y
    • 4
    • 11
  • j

    Jasin Colegrove

    01/06/2022, 5:22 PM
    sorry, in the above code, block is non-null, but when I use
    addparagraph("") it requires the {}
    is there a way around that?
    y
    • 2
    • 2
  • w

    Waqas Tahir

    01/06/2022, 8:49 PM
    Hi I need to convert a function with java pattern class to kotlin regex class but my functions not returning the same output (
    matchesList
    ) Code With Pattern Class
    val matcher = pattern.matcher(string)
    val matchesList = mutableListOf<String>()
    while (matcher.find()) {
        matchesList.add(matcher.group(0))
        if (!isGlobal) {
            var i : Int = 1
            val iEnd : Int = matcher.groupCount()
            while (i <= iEnd) {
                matchesList.add(matcher.group(i))
                i++
            }
        }
    }
    return matchesList
    Code With Regex Class (not working)
    var result : MatchResult? = regex.matchEntire(string) ?: return mutableListOf()
    val matchesList = mutableListOf<String>()
    while(result!=null){
        result.groups[0]?.value?.let { matchesList.add(it) }
        if(!isGlobal){
            var i = 1
            while(i <= result.groups.size){
                result.groups[i]?.value?.let { matchesList.add(it) }
                i++
            }
        }
        result = result.next()
    }
    return matchesList
    e
    • 2
    • 9
  • j

    Jan Gerritsen

    01/07/2022, 2:22 PM
    Hi, I am trying to compose my domain model for my new project and use value classes at some places. I have run into the problem that annotations from the value class attributes are lost at runtime.
    class Test(
    
        @field:Valid
    	val inlinedMember: InlinedMember,
    
    	@field:Valid
    	val normalMember: NormalMember,
    )
    
    @JvmInline
    value class InlinedMember constructor(
    	@field:NotBlank
    	val subAttr: String
    )
    
    class NormalMember constructor(
    	@field:NotBlank
    	val subAttr: String
    )
    After I compile this code and run it, the property inlinedMember of the class Test is replaces with the type String and the annotation @field:NotBlank is lost, resulting in the validator not validating this constrain. Has anyone an idea how to keep the information (without copying it) or what else to do? The goal is to use the same value class (e.g. email, bithdate, username,..) at several places and only define the constrains once. This is a spring boot project, using jackson to parse and validate the JSON data on the REST controller
    👋 2
    • 1
    • 1
  • s

    Shalom Halbert

    01/07/2022, 5:53 PM
    Is there a way to make reading Kotlin docs more reader-friendly? For example, it would be nice if there would faster way to find a function or property than either scrolling down or using find (i.e. CMD+F). I’ve always like the Android Docs approach where you can choose between the “On this page” section on the right, and “Summary” section. Screenshot source: https://developer.android.com/reference/android/content/SharedPreferences
    👍 1
    a
    • 2
    • 2
  • f

    frank

    01/07/2022, 6:35 PM
    I'm developing with MongoDB and I'm creating a common class for the connection to DB. I was having trouble implementing getCollection() generic method but I succeeded. I'm looking for advice or alternatives to my approach. GetCollection() Method:
    inline fun <reified T> getCollection(collection: String): MongoCollection<T> {
      return database.getCollection(collection, T::class.java)
    }
    Full Code:
    open class Connection<T> {
      constructor(){
        startMongoDB()
      }
    
      val client by lazy { KMongo.createClient()  }
      val database by lazy { getDB() }
    
      fun getDB(): MongoDatabase {
        return client.getDatabase(DB_NAME)
      }
    
      inline fun <reified T> getCollection(collection: String): MongoCollection<T> {
        return database.getCollection(collection, T::class.java)
      }
    
      private fun startMongoDB() {
        client
        database
      }
    }
    k
    s
    • 3
    • 4
  • j

    Jasin Colegrove

    01/07/2022, 7:02 PM
    I have this code
    val pdfDoc = PdfDocument(PdfWriter(fileName))
    but the implementation for PdfDocument is
    public PdfDocument(PdfWriter writer) {
            this(writer, new DocumentProperties());
        }
    what is pdfDoc assigned to with no return value?
    k
    r
    +4
    • 7
    • 15
  • k

    Kirill Grouchnikov

    01/07/2022, 9:49 PM
    Is there a Kotlin-specific way to load a Kotlin class based on its fully qualified name and then call its default constructor?
    Class.forName
    +
    Class.getConstructor
    +
    Constructor.newInstance
    , but maybe something that starts with
    KClass
    ?
    p
    e
    • 3
    • 2
  • j

    Jan

    01/08/2022, 12:39 PM
    When doing a method inference, can I somehow fix this?
    a
    l
    • 3
    • 4
  • c

    Colton Idle

    01/08/2022, 1:17 PM
    I'm using kotlin 1.6.10. I thought it enforced exhaustive whens? I get this warning, but no error "Non exhaustive 'when' statements on enum will be prohibited in 1.7, add 'BLAH' branch or"
    d
    • 2
    • 1
  • k

    Kenneth

    01/10/2022, 3:03 PM
    Is there a simpler form of
    (x != null && y == null) || (x == null && y != null)
    ?
    r
    k
    +4
    • 7
    • 16
  • m

    Mattia Tommasone

    01/10/2022, 10:05 PM
    question, not sure about the right chan to post it so trying here: is there any data available about adoption for different kotlin versions? I’m thinking about removing 1.3.* support from a library i’m maintaining in order to simplify the code, but i’m not sure if it will cause issues to many users
    🤔 1
    j
    • 2
    • 1
  • n

    Nikola Milovic

    01/11/2022, 1:19 PM
    Hello everyone I have a data class
    import kotlinx.serialization.Serializable
    
    @Serializable
    data class MessageModel (val senderId : String, val channelId : String, val id : String, val contents : String, val date : Long)
    And when I do this inside my (this is a multiplatform project) web app
    console.log(message.date::class.simpleName )
    The result is
    Double
    !! What is happening here? It's causing me runtime errors, as I need a long. This MessageModel I receive from my backend and the value of the date is epoch milis, and the value is
    1641905913211
    this is interpreted as double. But if I don't use the value of
    message.date
    and instead just directly input
    1641905913211
    it works, meaning the value isn't the issue, but for some reason when serializing it becomes a double? Not sure where to ask this, is this Multiplatform issue, Kotlin general issue?
    const val kotlin = "1.6.10"
        const val kotlinxSerialization = "1.3.2"
    e
    • 2
    • 5
  • j

    James Hendry

    01/11/2022, 3:13 PM
    Hi everyone, I hope this is an appropriate place to ask about the use of kotlin gradle (build.gradle.kts). Im having trouble moving from groovy to kotlin. I've put my original build.gradle and attempt at the new one https://gist.github.com/tyhdefu/0cdf5428be7699a8bb7ef7fa97e278b7
    j
    v
    • 3
    • 6
  • a

    Ayfri

    01/11/2022, 6:51 PM
    Is there a way to simplify this code or at least make it more beautiful ?
    val List<Int>.minmaxDifference get() = maxOf { it } - minOf { it }
    // chestRoom is a set, blockX/Y/Z are Int
    // CHEST_ROOM_MIN_SIZE & MAX_SIZE are const val Int
    
    if (chestRoom.map { it.blockX }.minmaxDifference in CHEST_ROOM_MIN_SIZE..CHEST_ROOM_MAX_SIZE) return false
    if (chestRoom.map { it.blockY }.minmaxDifference in CHEST_ROOM_MIN_SIZE..CHEST_ROOM_MAX_SIZE) return false
    if (chestRoom.map { it.blockZ }.minmaxDifference in CHEST_ROOM_MIN_SIZE..CHEST_ROOM_MAX_SIZE) return false
    e
    r
    b
    • 4
    • 6
  • i

    igor.wojda

    01/12/2022, 8:46 AM
    Hello I have extracted Kotlin class from
    jar
    file (from Android library
    aar
    ), decompiled it and I see that this Kotlin class is missing Kotlin metadata (class is not annotated with
    @Metadata
    annotation). What could be the reason? The issue is that library user cannot use Kotlin related constructs like named arguments, so I wonder is there a setting or compiler flag to always add Kotlin metadata? 🤔 expected result in compiled class:
    @Metadata(mv = {1, 6, 0}, k = 1, xi = 48, d1 = {"\000$\n\002\030\00"}..."})
    public final class MyClass {
       ...
    }
    • 1
    • 1
  • j

    Jason5lee

    01/12/2022, 10:13 AM
    I want to delegate the interface implementation to an instance constructed using 
    this
    .
    class ImplByInterface2(val a: Interface2): Interface1 {...}
    
    class MyClass : Interface1, Interace2 {
        // Delegate Interface1 implementation to this
        private val impl: Interface1 = ImplByInterface2(this)
    
    }
    I found it not easy to use
    by
    . Is there any convenient way? Both language feature and IDE trick are welcomed. Edit: makes it clearer.
    j
    m
    • 3
    • 10
  • j

    Jasin Colegrove

    01/12/2022, 1:36 PM
    https://lambda.show/blog/introduction-to-monads Can someone explain to me the voodoo of how in step 2 the monad knows to return success or failure while the return type is neither of those, but the base class??
    m
    k
    • 3
    • 3
  • g

    glenkpeterson

    01/12/2022, 6:27 PM
    in `MemJogLib.kt`:
    object MemJogLib {
    
        var testingOnlyChangeForTesting = false
    
        val BUILD_ROOT: String = File(".").canonicalPath
    
        private val MJL_BOOKS_DIR: String? = System.getenv("MJL_BOOKS_DIR")
    
        @JvmStatic
        fun getMjlBookDir(): String =
            if (testingOnlyChangeForTesting) {
                "$BUILD_ROOT/target/test-classes"
            } else {
                MJL_BOOKS_DIR!! // <= NullPointerException HERE
            }
    At the start of all tests, I make sure I call initialized:
    private val initialized: Boolean by lazy {
            testingOnlyChangeForTesting = true
    With
    testingOnlyChangeForTesting = true
    , the second branch of the
    if
    statement shouldn't even be called! When I run my tests from Maven at command line on my desktop, everything works perfectly. Using command-line Maven on the build server, I get:
    java.lang.ExceptionInInitializerError
    	at com.goalqpc.memJogLib.TestGlobals$initialized$2.invoke(TestGlobals.kt:145)
    	at com.goalqpc.memJogLib.TestGlobals$initialized$2.invoke(TestGlobals.kt:144)
    	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
    	at com.goalqpc.memJogLib.TestGlobals.getInitialized(TestGlobals.kt:144)
    	at com.goalqpc.memJogLib.TestGlobals.testDbInMemory(TestGlobals.kt:220)
    	at com.goalqpc.memJogLib.servlet.MjlServletHandlerTest.before(MjlServletHandlerTest.kt:44)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
    	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
    	at org.junit.internal.runners.statements.RunBefores.invokeMethod(RunBefores.java:33)
    	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
    	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
    	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:242)
    	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:137)
    	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
    
    Caused by: java.lang.NullPointerException
    	at com.goalqpc.memJogLib.MemJogLib.getMjlBookDir(MemJogLib.kt:66)
    	at com.goalqpc.memJogLib.MemJogLib.<clinit>(MemJogLib.kt:72)
    	... 39 more
    i
    i
    • 3
    • 3
  • i

    Itish Srivastava

    01/13/2022, 1:53 AM
    Greetings everyone, my name is Itish and I am new to Kotlin Language, I was reading the Guidelines and Code Of Conduct for Kotlin Slack on the GitHub Repo. • There a channel has been mentioned, by the name, #kontributors Contributing to Kotlin. Unfortunately, I am unable to navigate to the channel...does the channel no longer exists? I will be thankful if someone could show me the way...😅
    ✅ 1
    😄 2
    • 1
    • 1
  • e

    Ernest N. Wilcox Jr.

    01/13/2022, 3:16 PM
    Hello everyone. My full name is Ernest N. Wilcox Jr. but I answer to Ernie. This is my first message, and I hope I'm not misusing it by introducing myself. Moderators, if this is too much, feel free to remove it - and please let me know. I will not be offended. I am a senior citizen, and I am attempting to learn the Kotlin programming language thanks to the generosity of the JetBrains Academy and HyperSkill-dot-org. I started using computers with the Commodore Vic 20, the Commodore64, then finally an IBM-clone PC powered by an Intel-8088 CPU, 64KB RAM, and a 100 MB MFM Hard Drive in the early 1990s. Around that time I made a hobby of learning a bit about Assembly language so I could build small .com utilities to add commands that did not exist in MS-DOS 3.1. I liked Assembly because the commands were direct and simple, not mysterious and unintelligible. I also attempted to learn a bit about GW-Basic, but most commands were too complicated. For example, there were hundreds of switches that could be used with the print command. It was used to print to the console, a file, or the printer (even if there was not one present - then the output simply got lost in the ether :)). Later, when I moved to Windows 95, I I attempted to learn Q-Basic. That language may have been better than GW-Basic, but documentation/language-specifications were nearly nonexistent. The only sources of information available to learners were hard-copy books that could be purchased from local book stores, and the good quality/most useful manuscripts were very expensive, so I lost interest. Now that I have retired (after raising my family), I once again have returned to attempting to learn a bit about computer programming. I have studied C, C++, C#, F#, Java, and now Kotlin. I also took a stab at Pascale for a while, but I could not find any online courses that I could afford. The reason I have finally settled on trying to learn Kotlin is I want to be able to build apps that can run on the Windows or Linux desktops as well as on my Android phone. I don't know what projects I want to build yet, but I am sure I will come up with a few by the time I learn enough. Back when that IBM-compatible PC suffered a head-crash, I was not able to find another HD - the MFM drives were no longer being built or sold. The technology was obsolete by then, so I embarked on learning to build my own PC. I purchased a copy of "Upgrading and Repairing PCs", and off I went. I discovered that it was not all that hard to do. Since that first 'home-brew' PC, I have built all the desktop PCs I have ever owned. I have purchased laptops because I have not been able to find any laptop cases usable for home-brew construction that are cost-effective enough to make such a project worth-while. My current desktop is a budget-gaming PC, although I am not a gamer. I just wanted to get better performance. The machine has an AMD Ryzen-5 Picasso CPU, 32 GB RAM (the mainboard supports up to 64 GB), an MSi X470 Gaming Plus MAX motherboard, a Gigabyte NVIDIA Ge-Force GT 1030 graphics adapter with 2 GB video RAM, a Samsung SSD 970 EVO Plus 1TB M.2 drive, and a Seagate 2TB hard drive. I got a new case with 4 RGB fans and a tempered-glass left-side door. The case is designed for good air-flow and has filtered input/output air vents, so the system maintains a CPU temperature range between 30 and 40 degrees Celsius most of the time. I dual-boot Windows 10 with KDE Neon GNU/Linux. I tried Windows 11 for a while, but mouse support is a bit flakey, so I clean installed Windows 10 again and I'll wait until Microsoft releases the next significant Windows 11 upgrade - probably this coming fall/winter (2022). I may find myself switching over to GNU/Linux entirely at some point, but for now I am happy dual-booting. Politically, I'm pretty much a liberal because I believe in the old adage "What's good for the Goose is good for the Gander." - in other words, if I have a right, everyone else should have that right too, and vice-versa. I believe that everyone is entitled to their opinion, but I also believe that opinions should be stated as such, and NOT be confused with facts. If you state something as a fact, cite the source of your supporting information. If you state an opinion, make it clear that you are doing so by prefacing it with a phase similar in meaning to "I believe . . . ". That's it. This is pretty much me. I look forward to future conversations although I'll try to be a bit less talkative. Ernie
    👋 9
    ✅ 4
    e
    • 2
    • 3
  • c

    Coffee Guy

    01/13/2022, 3:25 PM
    Hi everyone \o I was currently getting started with Kotlin and I wanted to ask. How is a project structured? What is the standard way of structuring a Kotlin project? I don't.. use JetBrains IDEs as a daily driver (Although I am excitedly waiting for Fleet to launch!) and trying out Kotlin has been a bit of a pain for me personally. Opening the "getting started" webpage immediately starts pushing IntelliJ IDEA which I don't want to use 😛
    e
    m
    • 3
    • 5
  • c

    Coffee Guy

    01/13/2022, 4:20 PM
    Can this maybe be implemented? Or are there other solutions which may be easier to implement?
    :thread-please: 1
    e
    • 2
    • 3
  • r

    Ryan Zidago

    01/13/2022, 4:58 PM
    Hi all, I'm learning Kotlin + Ktor + Graphql by following this tutorial. However, when I run the server and visit http://localhost:8080/graphql I do not see the graphql playground 🤔 Here's what I did so far: • created the project using the project builder on ktor.io • added the kgraphql_version in gradle.properties • updated the build.gradle.kts with the line mentioned in the tutorial • in the tutorial
    src/Application.kt
    is mentioned but my automatically generated
    Application.kt
    file is under
    src/main/kotlin/com.ryanzidago/Application.kt
    🤔 Here's the content of my
    Application.kt
    package com.ryanzidago
    
    import io.ktor.server.engine.*
    import io.ktor.server.netty.*
    import com.ryanzidago.plugins.*
    
    import io.ktor.application.Application
    import io.ktor.application.install
    import com.apurebase.kgraphql.GraphQL
    
    fun main() {
        embeddedServer(Netty, port = 8080, host = "0.0.0.0") {
            configureRouting()
        }.start(wait = true)
    }
    fun Application.module(testing: Boolean = false) {
        install(GraphQL) {
            playground = true
            schema {
                query("hello") {
                    resolver { -> "World" }
                }
            }
        }
    }
    Intellij tells me that there is a problem with the
    install
    (Not enough information to infer type variable B) and
    playground
    (Variable expected) but I cannot figure out what is wrong 🤔 When I type
    gradle --version
    in my project root I get the following output:
    ariviv 
    ❯ gradle --version
    
    ------------------------------------------------------------
    Gradle 7.3.3
    ------------------------------------------------------------
    
    Build time:   2021-12-22 12:37:54 UTC
    Revision:     6f556c80f945dc54b50e0be633da6c62dbe8dc71
    
    Kotlin:       1.5.31
    Groovy:       3.0.9
    Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
    JVM:          17.0.1 (Oracle Corporation 17.0.1+12-39)
    OS:           Linux 5.4.0-94-generic amd64
    Any tips?
    d
    v
    • 3
    • 21
  • c

    CRamsan

    01/14/2022, 5:08 PM
    Hello team. I am working on some papers for school and I wanted to get some clarification on this portion of the Kotlin Language Specification:
    Kotlin Language Specification is still in progress and has experimental stability level, meaning no compatibility should be expected between even incremental releases, any functionality can be added, removed or changed without warning.
    https://kotlinlang.org/spec/introduction.html#compatibility What does this refer to when talking about being in experimental stability? Is this referring to the document itself or the Kotlin language?
    m
    a
    • 3
    • 2
Powered by Linen
Title
c

CRamsan

01/14/2022, 5:08 PM
Hello team. I am working on some papers for school and I wanted to get some clarification on this portion of the Kotlin Language Specification:
Kotlin Language Specification is still in progress and has experimental stability level, meaning no compatibility should be expected between even incremental releases, any functionality can be added, removed or changed without warning.
https://kotlinlang.org/spec/introduction.html#compatibility What does this refer to when talking about being in experimental stability? Is this referring to the document itself or the Kotlin language?
m

Marat Akhin

01/15/2022, 9:58 AM
Hi mate, the sentence you mentioned relates to the specification itself. It attempts to document the way Kotlin works to the best of our abilities, but it may still be incomplete, obsolete or even incorrect in some places, therefore, we do not (currently) provide any guarantees. Sowwy 😒eal:
a

Alexey Belkov [JB]

01/17/2022, 9:41 AM
Just to be clear, the Kotlin JVM language/compiler itself is stable since version 1.0, see https://kotlinlang.org/docs/components-stability.html
View count: 4