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

« 2018-12-06


2018-12-08 »

Nick Message Date
KeyJoo [KeyJoo!~KeyJoo@] has joined #kotlin [12:15]
t2mkn [t2mkn!~t2mkn@] has joined #kotlin [01:02]
Tazmain [Tazmain!~Tazmain@unaffiliated/tazmain] has joined #kotlin [01:30]
pheerai [pheerai!~pheerai@] has joined #kotlin [01:32]
t2mkn [t2mkn!~t2mkn@] has joined #kotlin [02:09]
Masterphi [Masterphi!~Masterphi@unaffiliated/masterphi] has joined #kotlin [02:23]
elfmacs [elfmacs!~elfmacs@] has joined #kotlin [02:48]
vishwin [vishwin!~brioux@wikimedia/O] has joined #kotlin [03:37]
frojnd Hi there. [04:19]
frojnd Just reading kotlin docs and I like the way how you can assign default values inside class headers and all [04:20]
frojnd But I don't understand how to just create a class instance in a way I was able with Java: `Book book = new Book()` So then I was able to assign additinal properties e.e. book.setSomething("bla") How can I create a class instance in Kotlin without any parameteres? I will assign them later one by one [04:21]
frojnd Primay constructor without params and then call this fron secondary? [04:29]
frojnd Even though I don't need secondary actually hm [04:29]
frojnd Halp? [04:45]
H-K [H-K!] has joined #kotlin [04:48]
Bombe Just call the constructors without parameters. [04:58]
Suchorski [Suchorski!~regex@unaffiliated/suchorski] has joined #kotlin [05:09]
rex_victor [rex_victor!] has joined #kotlin [05:18]
frojnd Bombe: please example? [06:22]
Bombe [06:23]
Bombe Bombe's title: "Classes and Inheritance - Kotlin Programming Language" [06:23]
Ladicek [Ladicek!] has joined #kotlin [06:50]
lankanmon [lankanmon!] has joined #kotlin [07:02]
guwop [guwop!] has joined #kotlin [07:07]
waz [waz!~waz@pdpc/supporter/active/waz] has joined #kotlin [07:24]
H-K [H-K!] has joined #kotlin [07:32]
H-K [H-K!] has joined #kotlin [07:34]
t2mkn [t2mkn!~t2mkn@] has joined #kotlin [07:39]
dreamreal frojnd: class Foo() { var something:String? } [07:49]
dreamreal allows val foo = Foo(); foo.something="bar" [07:49]
H-K [H-K!] has joined #kotlin [08:02]
H-K [H-K!] has joined #kotlin [08:03]
mlehmk [mlehmk!~mlehmk@unaffiliated/mlehmk] has joined #kotlin [08:06]
skrzyp parted the channel: "WeeChat 2.2" [08:09]
averell [averell!~averell@unaffiliated/averell] has joined #kotlin [08:12]
Bombe I like to think that the link to the documentation helped him answer all his questions. [08:40]
dreamreal I hope you're right [08:40]
dreamreal but people are stupid [08:40]
Bombe Sometimes I inexplicably have hope. [08:43]
dreamreal that's good, though [08:44]
Bombe Also, I like the word ?inexplicably.? [08:44]
dreamreal keep that [08:44]
dreamreal it's a good word but too many plosives for me. I prefer "spackle" (despite sibilants and plosives) and "eigenvalue" [08:44]
dreamreal (I struggle with plosives and sibilants) [08:45]
Bombe I think most of the words of the English language that I like are adverbs. [08:51]
dreamreal heh [08:51]
yawkat [yawkat!] has joined #kotlin [08:56]
vsazel [vsazel!~vsazel@] has joined #kotlin [09:25]
Ladicek [Ladicek!~lthon@] has joined #kotlin [09:32]
yawkat [yawkat!] has joined #kotlin [10:18]
frojnd dreamreal: your suggestion of creating property without constructor like you suggested `class Foo() { var something:String? }` is wrong. `class Foo() { var something:String? }` What you suggested must have late initialization: so: `class Foo() { lateinit var something: String }` and since lateinit modifier is not allowed on [10:19]
frojnd frojnd's title: "Properties and Fields: Getters, Setters, const, lateinit - Kotlin Programming Language" [10:19]
frojnd nullable types `?` must be ommited. [10:19]
frojnd s/ommited/omitted/ [10:20]
cheeser dude. ease off. he was showing how to do the constructor part. [10:22]
cheeser also, it doesn't *have* to have lateinit [10:22]
cheeser he could just assign it to be null. [10:22]
dreamreal frojnd: the good news is that you can gather your own information, as shown by your corrections. [10:27]
dreamreal frojnd: also, the compiler will nudge you toward the right solution, even given somewhat incomplete flippant answers on IRC [10:28]
yawkat [yawkat!] has joined #kotlin [10:35]
greggerz [greggerz!~greggerz@unaffiliated/greggerz] has joined #kotlin [10:52]
funeral [funeral!] has joined #kotlin [10:57]
TimMc frojnd: Oh that's interesting about lateinit. Kind of makes sense. [11:22]
cheeser TimMc: it's useful if you do a lot do DI or ORM types of things. [11:24]
TimMc Makes sense, a lot of those things seem to want empty constructors. I was glad to see that gson doesn't, when I was looking for JSON de/serializers. [11:39]
dreamreal they often want empty constructors so they can create an instance and populate it with indeterminate datasets [11:40]
TimMc Speaking of which, I was a littly curious if any JSON libraries that support type mapping also support an "extra keys" property. [11:41]
TimMc *little [11:42]
dreamreal what do you mean by "extra keys" [11:42]
TimMc If I map from JSON to an object and then back again, and the JSON had keys that my class doesn't know about, it *might* be nice to 1) not have the mapping fail, and 2) have the unknown keys survive the round-trip. [11:43]
dreamreal the latter won't happen, but the former is possible [11:43]
TimMc So you don't know of any mappers that implement that, then? [11:44]
dreamreal Jackson has an option - I forget the name - to discard JSON keys that don't map to the object type (thus, deserialize with "extra keys") but... round trip isn't really a thing [11:44]
TimMc Luckily I don't actually need it for the project that set me to wondering about this. Just curious. [11:45]
TimMc There's probably a way to hack it up with a custom key handler... [11:45]
dreamreal hack what up [11:45]
dreamreal JsonParser.Feaure.IGNORE_UNDEFINED looks like the feature to allow keys that don't map to the object type in question [11:46]
TimMc That is, I think at least one of these mappers has a way you can attach a custom handler for unknown keys, and you could probably use that to feed the unknown key-value pairs into a map. [11:46]
dreamreal At least one of them, sure, but ... that'd mean forcibly altering your object model to accept that [11:47]
TimMc Yes. And I'm glad I don't currently need it. Mostly an idle curiosity. [11:49]
cheeser there've been requests to add that "overflow bucket" to morphia which i work on. it's a bit of a niche usecase but i can see its utility [11:49]
dreamreal morphia is a little different though [11:50]
dreamreal I can see it being far more applicable in morphia than in jackson or gson [11:50]
cheeser not entirely [11:50]
dreamreal shrugs. Okay. [11:50]
cheeser the same reasons would apply: you have a dataset that tracks more information than your current app cares about. so you expose the interesting dataset via a java api but you still want to track those other bits so that when entities get serialized back out, you don't lose those other values. [11:51]
cheeser or hell, even just customized DTOs within one project. [11:51]
dreamreal sure. Except Jackson sees the object model as the SOR, where Morphia would logically see the DB as the SOR [11:52]
cheeser it actually wouldn't be hard to implement with the new code, actually? hrm.... [11:52]
dreamreal IMO [11:52]
cheeser i disagree on that one. :) [11:52]
TimMc dreamreal: Interesting distinction. [11:52]
dreamreal fair enough, like I said [11:52]
cheeser both morpha and jackson would see the java model as definitive. but that doesn't mean that the inputs contain more data. [11:52]
dreamreal TimMc: clearly there are different opinions on the matter [11:53]
cheeser there's mine and then the wrong ones. :D [11:53]
dreamreal parted the channel: "WeeChat 2.2" [11:53]
TimMc cheeser: I'd disagree on that, but I'd be wrong. ;-) [11:53]
cheeser wow. he ... didn't take that well. [11:53]
cheeser \_(?)_/ [11:53]
TimMc Hmm, I need to tweak my join/part hider, I didn't see that at all. [11:54]
KeyJoo [KeyJoo!~KeyJoo@] has joined #kotlin [11:57]
TimMc Morphia, is this a MongoDB ORM? [11:58]
yawkat yes [11:59]
cheeser yep! [11:59]
TimMc "Unknown keys" starts to make a lot more sense when you start looking at multiple versions of the application running at the same time and sharing a datastore, or with rollbacks, etc. [11:59]
cheeser yeah. or when you have different systems in different languages working on the same data. [12:00]
cheeser e.g., the C# driver and Morpha whose mapping data is sometimes stored in the documents to facilitate deserialization. [12:00]
TimMc ah [12:00]
cheeser and wtf can't I type Morphia? [12:00]
H-K [H-K!] has joined #kotlin [12:32]
dreamreal [dreamreal!~jottinger@unaffiliated/dreamreal] has joined #kotlin [12:50]
H-K [H-K!] has joined #kotlin [12:57]
orbyt_ [orbyt_!~orbyt@] has joined #kotlin [01:07]
vikikas [vikikas!~vikas@2a02:1205:34e1:60b0:2c94:92b2:e21a:7e1] has joined #kotlin [01:24]
ech0s7 [ech0s7!25e4f451@gateway/web/freenode/ip.] has joined #kotlin [01:53]
ech0s7 Hello, I would like to return a List<String> from this function, just changing line 6, is it possible ? [01:54]
ech0s7 I know I could initialize "series" as equal to listA+listB [01:55]
cheeser so what are you actually asking? [01:57]
ech0s7 cheeser: without changing the first 4 lines, and keeping filter{} to filter "B" and map{} to lower case, How can I return a list of just one element: "b" ? [02:00]
cheeser and the problem is that series is a List<List<String>> yeah? [02:01]
ech0s7 yes [02:02]
dreamreal so you want to flatten it [02:02]
ech0s7 dreamreal: how ? [02:03]
dreamreal ech0s7: return listOf(listA, listB).flatten().filter { it == "B" }.map { it.toLowerCase() } [02:04]
dreamreal flatten() converts List<List<String>> to List<String>, then you'd filter and map [02:05]
cheeser e.g. [02:05]
ech0s7 Thanks, I didn't know about flatten() [02:06]
cheeser i'd forgotten about it. i was gonna suggest flatmap :) [02:07]
ech0s7 this transformations are nice to read, but probably the same thing can be rewritten in a more performant way [02:07]
cheeser faptimization [02:07]
cheeser cheeser, faptimization is the process of optimizing code without measuring for performance problems first [02:07]
ech0s7 What do you mean by measuring for performance problems first ? [02:09]
cheeser you're worried about it being slow. but how do you know it's slow? did you measure it? [02:10]
dreamreal don't worry about optimization until after you have it working, and then worry about optimzation only if you've measured that it's too slow to meet your SLA [02:10]
cheeser i.e., you're fixing a possible problem without confirming that it's an actual problem. [02:10]
cheeser "i'm pretty sure I have liver cancer. i'm just gonna pop this guy out then." [02:10]
ech0s7 make sense, but the same thing can be rewritten without using two loops [02:11]
ech0s7 or probably more [02:11]
ech0s7 is not a problem [02:11]
cheeser it can be written any number of ways. [02:11]
dreamreal "aditya's trying to solve a problem he doesn't know exists yet, with a solution that can't fit anything" [02:11]
cheeser dreamreal: i believe that's likely true ;) [02:11]
ech0s7 ) [02:11]
H-K [H-K!] has joined #kotlin [02:28]
H-K [H-K!] has joined #kotlin [02:58]
rohdef [rohdef!] has joined #kotlin [03:24]
iam730 [iam730!] has joined #kotlin [03:49]
waz [waz!~waz@pdpc/supporter/active/waz] has joined #kotlin [03:54]
DTZUZO [DTZUZO!] has joined #kotlin [04:31]
DTZUZO [DTZUZO!] has joined #kotlin [05:02]
jdlee [jdlee!~quassel@unaffiliated/littlezoper] has joined #kotlin [05:04]
wreed [wreed!~wreed@] has joined #kotlin [05:12]
DTZUZO [DTZUZO!~DTZUZO@] has joined #kotlin [06:18]
kapil____ [kapil____!uid36151@gateway/web/] has joined #kotlin [07:05]
dade` [dade`!~dade`@nectarine/admin/dade] has joined #kotlin [07:21]
Amadiro [Amadiro!] has joined #kotlin [07:21]
rager [rager!] has joined #kotlin [07:21]
nghtshd [nghtshd!nghtshd@2601:ca:4000:43b3:6254:15a6:538d:7f2c] has joined #kotlin [07:23]
wreed [wreed!~wreed@] has joined #kotlin [07:38]
Masterphi [Masterphi!~Masterphi@unaffiliated/masterphi] has joined #kotlin [08:35]
orbyt_ [orbyt_!~orbyt@] has joined #kotlin [08:42]
H-K [H-K!] has joined #kotlin [09:43]
t2mkn [t2mkn!~t2mkn@] has joined #kotlin [10:02]
iam730 [iam730!~iam730@] has joined #kotlin [10:03]
djhworld [djhworld!~djhworld@] has joined #kotlin [11:37]