Fudge
06/05/2019, 10:42 AMghosalmartin
06/05/2019, 12:37 PMtseisel
06/05/2019, 2:54 PMequals
problem described in the article and functionnal programming (that I don't really understand at the moment 😅) ?xenoterracide
06/05/2019, 4:51 PMjaguililla
06/05/2019, 5:30 PMKotlin-Jobs.com
06/05/2019, 8:12 PMnapperley
06/05/2019, 11:24 PMStefan Beyer
06/06/2019, 11:52 AM// java
package com.example.legacy
public class Thing {
public String get(String s) {
return s;
}
}
// kotlin
package com.example.extensions
import com.example.legacy.Thing
operator fun Thing.get(index: Int) = index
// kotlin
package com.example.business.logic
import com.example.legacy.Thing
fun doStuff(thing: Thing) {
val x = thing[1] // compiler says "String expected, but Int found"
}
At val x = thing[1]
there is a compile error, because the extension in com.example.extensions
is not yet imported. But I cannot conveniently import it...
When I instead write it as a method call (val x = thing.get(1)
) it tells me that it can import it and I can just hit Alt+Enter and the import is added. Then I can change it back to the array access syntax.
is there a shorter and more convenient way to get this import line added?Paul Woitaschek
06/06/2019, 12:56 PMkotlin
interface Greeter {
fun greet()
}
class HappyGreeter : Greeter {
override fun greet() {
println("hello :)")
}
}
class SadGreeter : Greeter {
override fun greet() {
println("hello :(")
}
}
class GreeterDelegate (val greeters : List<Greeter>): Greeter by greeters
pp.amorim
06/06/2019, 3:28 PMmzgreen
06/06/2019, 8:05 PMjkbbwr
06/07/2019, 9:16 AMnecati
06/07/2019, 1:12 PMEric Martori
06/07/2019, 2:40 PM'@JvmName': is not applicable to this declaration
for an extension function in an interface?Krotick
06/07/2019, 3:22 PMtasks
?Alexjok
06/07/2019, 3:36 PMprojectmoon
06/07/2019, 4:04 PM5.times |x| mylist << x
in rubyjanvladimirmostert
06/08/2019, 11:33 AMZemeio
06/08/2019, 6:15 PMSaiedmomen
06/09/2019, 7:55 AMPietro Poluzzi
06/09/2019, 1:05 PMAndrew Gazelka
06/09/2019, 3:35 PMa,b,c,...,z
Let's say I have a complicated algorithm/function sequence which I want to break up into smaller unit testable functions. Each function takes a subset of config values and some calculated values (by previous parts by other functions)... this can get pretty annoying as each time I pass arguments into a function I have to pass in a ton. It would be nice if Java/Kotlin supported something like in TS where I can have an interface for some JSON and any JSON which had the proper fields and types would be allowed... this would allow for just passing in the entire config as an argument (or if I am unit testing passing in a subset of the config if needed). I am almost certain there is not a good solution to this in Kotlin/Java, but do you think there is one? I guess you could pass in a map as a parameter but this would not be compile-time type safe ... additionally, nested functions in Kotlin could be nice but the issue with them is that they are impossible to unit test. Thoughts?Hexa
06/09/2019, 4:04 PMsrc/main/kotlin/samples/HelloWorld.kt:7:18: error: unresolved reference: Person
val person = Person("me")
Rohan Maity
06/09/2019, 6:27 PMKirill Zhukov
06/10/2019, 3:37 AMHexa
06/10/2019, 8:53 AMsequence
vs when to use streams
? i know sequence is for processing large collection of data, but is there any reason why can't I use it to process small amount of data?Mohamed Ibrahim
06/10/2019, 9:29 AMmodel?.let{ some code} ?: run { code in case model is null}
Jacques Smuts
06/10/2019, 10:34 AM!!
operator seems to be a frequent source of issues. Has anyone here ever considered turning !!
into a compiler-error lint rule?xenoterracide
06/10/2019, 4:14 PMjlleitschuh
06/10/2019, 4:37 PMhttp
instead of https
!
I want to thank @Yaroslav Russkih and the entire JetBrains/Kotlin team for being awesome to work with on this security vulnerability. They jumped on it very quickly and began patching all of their repositories swiftly. I believe we've gotten all of them, but if you spot something contact security@jetbrains.com
https://medium.com/@jonathan.leitschuh/want-to-take-over-the-java-ecosystem-all-you-need-is-a-mitm-1fc329d898fb?source=friends_link&sk=3c99970c55a899ad9ef41f126efcde0ejlleitschuh
06/10/2019, 4:37 PMhttp
instead of https
!
I want to thank @Yaroslav Russkih and the entire JetBrains/Kotlin team for being awesome to work with on this security vulnerability. They jumped on it very quickly and began patching all of their repositories swiftly. I believe we've gotten all of them, but if you spot something contact security@jetbrains.com
https://medium.com/@jonathan.leitschuh/want-to-take-over-the-java-ecosystem-all-you-need-is-a-mitm-1fc329d898fb?source=friends_link&sk=3c99970c55a899ad9ef41f126efcde0e