Info

Login

Channels

APIs

Credits

  • cheeser
  • ernimril
  • joed
  • kinabalu
  • lunk
  • ojacobson
  • r0bby
  • ThaDon
  • ricky_clarkson
  • topriddy

« 2019-01-09

2019-01-10

2019-01-11 »

Nick Message Date
DTZUZO [DTZUZO!~DTZUZO@S0106bcd16584b0aa.vs.shawcable.net] has joined #kotlin [12:48]
thana greves: the correct way is to make sure it's initialized in the constructor... class Foo{val i: Int; constructor(){i = 2;}} [01:06]
Metamelvin [Metamelvin!~Metamelvi@2a02:8070:d19a:3200:c2ee:fbff:fe59:d81e] has joined #kotlin [01:08]
Melvin [Melvin!~Metamelvi@x5271799d.dyn.telefonica.de] has joined #kotlin [01:08]
orbyt_ [orbyt_!~orbyt@172.92.5.20] has joined #kotlin [01:14]
Metamelvin [Metamelvin!~Metamelvi@x5271799d.dyn.telefonica.de] has joined #kotlin [01:45]
Melvin [Melvin!~Metamelvi@x59cc87e7.dyn.telefonica.de] has joined #kotlin [01:49]
Metamelvin [Metamelvin!~Metamelvi@x527179ef.dyn.telefonica.de] has joined #kotlin [02:06]
Tazmain [Tazmain!~Tazmain@unaffiliated/tazmain] has joined #kotlin [02:10]
Metamelvin [Metamelvin!~Metamelvi@x527179ef.dyn.telefonica.de] has joined #kotlin [02:11]
Pitel [Pitel!~pitel@fw2o.masterinter.net] has joined #kotlin [02:27]
greves thana: but that only works for 'var' not 'val', right? [02:34]
thana greves: nope [02:34]
thana it's perfectly valid to initalizes `val`s in the constrcutor(s) [02:35]
greves thana: I see an error "val on secondary constructor parameter is not allowed" when i try that [02:37]
thana greves: you may write something like `class Foo(val value: String)` but not `class Foo{ constructor(val value: String) }` [02:38]
thana using the primary constructor you can declare fields of the class but that's not allowed with secondar ctors [02:39]
greves OK, that's what I thought but it seemed you said differently [02:39]
greves So, in a secondary constructor I can only initialize "var" and not "val"? [02:39]
greves I mean, I need: class Foo(..) { constructor (x) { this.x = x } } [02:39]
thana so `class Foo(val value:String)` declares a field and you could do `println(Foo("Hello World").value)` [02:40]
greves When I am extending an android View, I need the default constructor, e.g. LinearLayout(context: Context) [02:40]
thana yet `class Foo(value:String)` only declares a constrcutor which expects a string parameter but `Foo("fds").value` does not exist [02:40]
greves I think I need to pastebin exactly what's happening because it's a bit much to type on IRC, just a sec [02:42]
thana yes please :) [02:42]
thana disclaimer: i'm doing kotlin for a week now - my answers might still be wrong or flawed at least [02:42]
ppareit [ppareit!~ppareit@d5152f254.static.telenet.be] has joined #kotlin [02:44]
greves Any pastebins for Kotlin? [02:44]
greves https://bpaste.net/show/6e40ba93484b [02:45]
thana the people here use hastebin [02:45]
thana so the problem is you NEED a single argument ctor? [02:48]
greves right [02:49]
greves well, it compiles, but it complains about this [02:49]
thana well then you have 2 options i think: either make your val mutable using var an set the value after construction or set some default value [02:50]
thana oh or you can use val with lateinit, yes [02:51]
Ladicek [Ladicek!~lthon@109.164.114.141] has joined #kotlin [02:56]
ppareit [ppareit!~ppareit@d5152f254.static.telenet.be] has joined #kotlin [04:53]
waz [waz!~waz@pdpc/supporter/active/waz] has joined #kotlin [05:13]
PeterSellers [PeterSellers!~hb2xtv2dt@2a02:a03f:53ef:600:aa40:ccb3:cdfe:e1b4] has joined #kotlin [06:02]
PeterSellers parted the channel: "Leaving" [06:03]
lightslategrey [lightslategrey!~lightslat@188.234.12.124] has joined #kotlin [06:17]
t2mkn [t2mkn!~t2mkn@43.226.2.102] has joined #kotlin [06:19]
H-K [H-K!~h_k@bl5-128-147.dsl.telepac.pt] has joined #kotlin [06:32]
cheeser lateinit requires var iirc [08:16]
cheeser greves: can you share your code on a pastebin somewhere? [08:17]
cheeser pastebin [08:17]
cheeser Please paste your code and any errors online. For runnable main-classes, try https://glot.io/new/java . For general code and errors, use for instance https://gist.github.com or https://www.hastebin.com [08:17]
OnkelTem [OnkelTem!~onkeltem@unaffiliated/fantomas] has joined #kotlin [08:25]
OnkelTem Hi all [08:25]
OnkelTem I'm new to Kotlin. Passing some tutorials and got some questions [08:26]
OnkelTem class CreatureAdapter(private val creatures: List<Creature>) : RecyclerView.Adapter<CreatureAdapter.ViewHolder>() { [08:26]
OnkelTem What does private here mean? It looks like a parameter to a constructor [08:26]
kapil____ [kapil____!uid36151@gateway/web/irccloud.com/x-tbxeoymrswljwuxi] has joined #kotlin [08:26]
OnkelTem Is it? [08:26]
cheeser it means it's a private property on that class. [08:26]
thana it's both: declararing a parameter for the constructor as well as declaring a property of that class (because of the val) [08:27]
OnkelTem But is it used by the constror too? I mean is it a parameter? [08:27]
OnkelTem Ah, I see [08:28]
OnkelTem Pretty optimal then :) [08:28]
thana yep very handy [08:28]
cheeser without var/val, it's just a ctor parameter. with either, it becomes a property. private means there is no access to it outside the class. [08:28]
OnkelTem And about what it extends: "RecyclerView.Adapter<CreatureAdapter.ViewHolder>()" - it looks like an invocation. Is it? Is it something returning a class or... ? [08:29]
OnkelTem cheeser: thanks [08:29]
cheeser the () is necessary because it's a class and you have to invoke a ctor on a parent class. [08:29]
OnkelTem cheeser: what if my derived class didn't have the primary constructor? Had I "call" the baseclass's ctor the same way in this case? [08:37]
OnkelTem I mean: "class CreatureAdapter : RecyclerView.Adapter<CreatureAdapter.ViewHolder>() {" [08:37]
cheeser every class has a primary constructor [08:37]
cheeser if you don't write one, the compiler generates a default, no arg constructor [08:38]
greves cheeser: I did I think earlier [08:38]
greves https://bpaste.net/show/6e40ba93484b [08:39]
greves my "Foo" class currently has a lot going on in the primary constructor, but it extends LinearLayout. Probably I should move all of the stuff out of primary constructor and init{}? [08:40]
cheeser you need another constructor for framework to use your type [08:41]
cheeser x will have to be: var x: Something? most likely [08:41]
waz [waz!~waz@pdpc/supporter/active/waz] has joined #kotlin [08:48]
DTZUZO [DTZUZO!~DTZUZO@S0106bcd16584b0aa.vs.shawcable.net] has joined #kotlin [08:50]
greves Ok, got it [08:53]
greves thanks [08:53]
sbalmos [sbalmos!~sbalmos@cpe-174-97-35-162.cinci.res.rr.com] has joined #kotlin [09:32]
thana coroutines and a js target seem to be a problem yet :( [09:45]
moshen [moshen!~moshen@198.199.118.20] has joined #kotlin [10:15]
greggerz [greggerz!~greggerz@unaffiliated/greggerz] has joined #kotlin [10:18]
yawkat [yawkat!~yawkat@159.69.41.126] has joined #kotlin [10:42]
moshen [moshen!~moshen@198.199.118.20] has joined #kotlin [10:47]
thana the coroutines i create dont seem to even get executed... really sad :( [10:49]
thana does anybody here have expirience with co routines on js? [10:50]
cheeser not me [10:51]
thana cheeser: do you know if there is a channel/list/slack/whatever better suited to place kotlin/js related questions? [11:15]
cheeser there's #coroutins on the kotlin slack [11:17]
thana cool! i'll have a look, thanks [11:18]
orbyt_ [orbyt_!~orbyt@172.92.5.20] has joined #kotlin [11:46]
funeral [funeral!~Funeral@169.89-10-117.nextgentel.com] has joined #kotlin [11:55]
edge_eng [edge_eng!~edge_eng@unaffiliated/edge-eng/x-8536881] has joined #kotlin [11:57]
computeiro [computeiro!~computeir@189.15.117.107] has joined #kotlin [11:58]
t2mkn [t2mkn!~t2mkn@43.226.2.102] has joined #kotlin [12:02]
thana too bad. don't get an invite [12:38]
zopsi [zopsi!~zopsi@dir.ac] has joined #kotlin [12:40]
ppareit [ppareit!~ppareit@178-117-89-32.access.telenet.be] has joined #kotlin [12:55]
vikikas [vikikas!~vikas@2a02:1205:34e1:60b0:2862:d4da:c8a2:f5f4] has joined #kotlin [01:08]
orbyt_ [orbyt_!~orbyt@172.92.5.20] has joined #kotlin [01:15]
sbalmos [sbalmos!~sbalmos@cpe-174-97-35-162.cinci.res.rr.com] has joined #kotlin [01:47]
orbyt_ [orbyt_!~orbyt@172.92.5.20] has joined #kotlin [01:53]
ppareit [ppareit!~ppareit@178-117-89-32.access.telenet.be] has joined #kotlin [01:54]
orbyt_ [orbyt_!~orbyt@172.92.5.20] has joined #kotlin [02:11]
waz [waz!~waz@pdpc/supporter/active/waz] has joined #kotlin [02:17]
waz [waz!~waz@pdpc/supporter/active/waz] has joined #kotlin [02:29]
ovalseven8 [ovalseven8!~ovalseven@unaffiliated/ovalseven8] has joined #kotlin [03:36]
ovalseven8 Beginner: Should I start with Gradle or Maven? [03:36]
jdlee i prefer maven [03:40]
jdlee \_(?)_/ [03:40]
jdlee YMMV :P [03:40]
Addax jdlee: but answer the question! He's asking if he should use either maven or gradle, and the clear answer, assuming he wants to build a project, esp with a JVM, is "yes." Both of those are far better than the alternatives like make, cmake, ant, buildr, sbt, etc etc etc [03:43]
jdlee haha [03:44]
jdlee ovalseven8: kinda depends on where you're learning. if you're in Androidland, i'd start with gradle, as that's what the official docs show. if you're on Joe Blow's Blog, do as the Romans do. :) [03:47]
ovalseven8 jdlee, I don't do Android programming [03:48]
jdlee nods [03:49]
Addax do you program in a JVM language? [03:49]
ovalseven8 Addax, I want to start with Kotlin [03:49]
jdlee personally, i'd start with Maven. IMO, the ecosystem (and the tool?) seems to be more mature [03:49]
Addax well, are you targeting the JVM? [03:49]
ovalseven8 Addax, Yeah, Kotlin/Native is still beta also [03:50]
ovalseven8 But out of interest: What's the build tool for Kotlin/Native? [03:50]
Addax probably gradle or maven! [03:50]
jdlee haha [03:51]
ovalseven8 Cool [03:51]
Addax From the website on kotlin/native: https://kotlinlang.org/docs/tutorials/native/gradle-for-kotlin-native.html [03:51]
Addax Addax's title: "Gradle for Kotlin/Native - Kotlin Programming Language" [03:51]
edge_eng [edge_eng!~edge_eng@unaffiliated/edge-eng/x-8536881] has joined #kotlin [04:45]
orbyt_ [orbyt_!~orbyt@172.92.5.20] has joined #kotlin [04:56]
iam730 [iam730!~iam730@c-24-6-215-59.hsd1.ca.comcast.net] has joined #kotlin [05:05]
computeiro [computeiro!~computeir@201.48.95.59] has joined #kotlin [05:17]
orbyt_ [orbyt_!~orbyt@172.92.5.20] has joined #kotlin [06:12]
kerri [kerri!~kerri@april-fools/2014/second/cute.furry] has joined #kotlin [06:53]
orbyt_ [orbyt_!~orbyt@172.92.5.20] has joined #kotlin [06:55]
jcnmark6 [jcnmark6!~jcnmark6@static.242.118.9.176.clients.your-server.de] has joined #kotlin [07:06]
waz [waz!~waz@pdpc/supporter/active/waz] has joined #kotlin [07:42]
orbyt_ [orbyt_!~orbyt@172.92.5.20] has joined #kotlin [08:12]
H-K [H-K!~h_k@bl5-128-147.dsl.telepac.pt] has joined #kotlin [08:19]
H-K [H-K!~h_k@bl5-128-147.dsl.telepac.pt] has joined #kotlin [08:21]
theWhisper_ [theWhisper_!~quassel@unaffiliated/thewhisper/x-7482734] has joined #kotlin [09:02]
orbyt_ [orbyt_!~orbyt@172.92.5.20] has joined #kotlin [09:34]
H-K [H-K!~h_k@bl5-128-147.dsl.telepac.pt] has joined #kotlin [09:35]
t2mkn [t2mkn!~t2mkn@43.226.3.144] has joined #kotlin [09:59]
orbyt_ [orbyt_!~orbyt@172.92.5.20] has joined #kotlin [10:22]
ilikecrunch [ilikecrunch!~ilikecrun@87.249.197.176] has joined #kotlin [10:48]
waz [waz!~waz@pdpc/supporter/active/waz] has joined #kotlin [11:11]
ppareit [ppareit!~ppareit@178-117-89-32.access.telenet.be] has joined #kotlin [11:16]
kapil____ [kapil____!uid36151@gateway/web/irccloud.com/x-izkhutizzgxpasfi] has joined #kotlin [11:21]
DTZUZO [DTZUZO!~DTZUZO@S0106bcd16584b0aa.vs.shawcable.net] has joined #kotlin [11:24]