xenoterracide
06/10/2019, 4:43 PMAndrew Gazelka
06/11/2019, 12:06 AMbrett.wooldridge
06/11/2019, 6:03 AMPaul Woitaschek
06/11/2019, 8:52 AMexec
on a script? I have some CI scripts where I use fastlane but whenver I need to write stuff in ruby it kind of breaks my headmzgreen
06/11/2019, 12:34 PMUByte
?mzgreen
06/11/2019, 1:40 PMval foo = 0x1u
it's treated as Int
.
Is there a way to make it something else without providing a type? For example:
val foo: UByte = 0x1u
when(foo) {
0x1u -> {} // doesn't work because 0x1u is treated as an Int
}
I can do 0x1.toUByte()
but it's ugly. Is there maybe something like 0x1ub
suffix or sth like that?efemoney
06/11/2019, 1:42 PMuse-experimental
compiler argument either does not work as advertised (has a bug) or is not configured properly. Whats the correct way to configure the use-experimental
compiler argument with gradle (kotlin dsl) such that I do not get warnings for using experimental APIs in my code?
Right now I have this
subprojects {
// ...
project.tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf(
"-Xuse-experimental=kotlin.Experimental,kotlinx.coroutines.ExperimentalCoroutinesApi,kotlinx.serialization.ImplicitReflectionSerializer"
)
}
}
}
in my root build gradle file but I still get warnings like in the attached image (both Flow
and fun dispatcher.invoke( ... )
are experimental APIs)Nikky
06/11/2019, 4:50 PMPaul N
06/11/2019, 8:03 PMval baseURL = "http://$domainName/endpoint"
and then a function like this
fun someMore(domainName : String, somethingElse : String) {
val x = "$baseURL$somethingElse
}
then x should equal http://mydomainname/endpoint/mysomethingElse if I pass in mydomainname and mysomethingelse to the function ?Rohan Maity
06/11/2019, 10:12 PMval variable = 90
and in the decompiled bytecode it produced int variable = true;
. I don't understand this ?elect
06/12/2019, 9:22 AMJonathan Mew
06/12/2019, 11:16 AMFlorian
06/12/2019, 12:21 PMchansek
06/12/2019, 1:56 PMShawn
06/12/2019, 2:00 PMxenoterracide
06/12/2019, 5:59 PMval monitor = useCase.findMonitor(dto.monitorSn)?.also {
useCase.connect(transform(dto))
}
if ( monitor == null ) {
log.error("monitor {} not found", dto.monitorSn )
}
is there a nicer way to do the monitor == null as sort of an orElse { ... }
dMusicb
06/13/2019, 1:27 AMrrader
06/13/2019, 6:48 AMDavid
06/13/2019, 9:37 AMbod
06/13/2019, 11:30 AM<img src="/doc-files/session-state.png">
worked - but it doesn't seem to work with Kotlin. Ideas?Guilherme Titschkoski
06/13/2019, 12:47 PMwhere T : new()
?Nezteb
06/13/2019, 5:12 PMValV
06/13/2019, 6:13 PMxenoterracide
06/13/2019, 7:28 PMdeserialize<PatientDto>(message.payload)
where the called method then gets the class
internal fun <DTO : Any> deserialize( ba: ByteArray, clazz: KClass<DTO> ): DTO {
return mapper.readValue(ba, clazz.java)
}
pretty sure it’s in gradle’s kotlin DSL somewhere… how do I replicate that calling signature?william
06/13/2019, 9:25 PMonComplete: () -> Unit = {}
would it be best to put this no-op function in a companion object somewhere or does kotlin automatically do any optimizations ?Nick Tiller
06/13/2019, 10:14 PMdata class Foo(val width: Float, val height: Float, val x: Float, val y: Float)
data class Bar(val width: Float, val height: Float, val x: Float, val y: Float)
To construct them, I have to write something like
when(clss)
is Foo -> constructFoo()
is Bar -> constructBar()
with each of those construct methods doing the exact same thing (setting the same variable names & types). Is there a structure or something in Kotlin that I can use to make this cleaner?william
06/13/2019, 11:20 PMHullaballoonatic
06/14/2019, 12:24 AMNumber
not operable in the JVM? Why did Sun design it that way and why does JB not fix it in Kotlin? Everything (afaik) that inherits from Number
is operable, so why wouldn't the operators be refactored to be included there?Antanas A.
06/14/2019, 6:49 AMinline fun <T> T.takeUnless
would work lazily and short circuit code execution if condition is true, kind of lazy evaluation of previous expression
. What's your thoughts? Is it possible at all?xenoterracide
06/14/2019, 4:24 PMxenoterracide
06/14/2019, 4:24 PMkarelpeeters
06/14/2019, 6:25 PMxenoterracide
06/14/2019, 6:32 PMConsumer
rather than a kotlin functionkarelpeeters
06/16/2019, 7:57 AM