SOFe
02/02/2019, 4:16 PMShawn A
02/02/2019, 11:30 PMstatic
field and I understand that you can use a companion object
along with @JvmStatic
but I don't like the looks of that at all.Shawn
02/02/2019, 11:30 PMval
will also do the trickShawn A
02/02/2019, 11:31 PMMarc Knaup
02/02/2019, 11:35 PM@JvmStatic
🤔Nikky
02/03/2019, 3:22 AMKLogging()
, which holds a val logger
it looks as short as this sometimes: companion object: KLogging()
bjonnh
05/03/2019, 9:10 PMbjonnh
05/03/2019, 9:11 PMRyan Benasutti
05/04/2019, 3:30 AMHullaballoonatic
05/04/2019, 4:32 AMVector.plus(w: Vector)
or Vector.plusAssign(w: Vector)
when I would use e.g. A[i, l..n] += s * U[k, l..n]
. I'm pretty sure if it can't decide if to do either A.set(i, l..n, A.get(i, l..n).plus(s * U.get(k, l..n)))
or A.get(i, l..n).plusAssign(s * U.get(k, l..n))
. The former would get recorded into the matrix (and what I want), and the latter would not. Is it possible to bake a default priority into the language or is that a bad idea? Is there a priority system to annotations that I could use or could be implemented in the language?jimn
05/04/2019, 1:47 PMjw
05/05/2019, 1:12 AMHullaballoonatic
05/05/2019, 3:54 AM..
is rangeTo
as opposed to until
?BearDev
05/06/2019, 6:42 AM@Serializable
@Polymorphic
data class JsonMessage(
@Polymorphic val command: JsonCommand
)
@Serializable
@Polymorphic
open class JsonCommand
@Serializable
@Polymorphic
data class NewL2SnapCommand(
val symbol: String
) : JsonCommand()
@UnstableDefault
fun main() {
val message = JsonMessage(
NewL2SnapCommand(
symbol = "ABC"
)
)
val snapJson = Json.stringify(JsonMessage.serializer(), message)
println(snapJson)
}
This results in
Exception in thread "main" kotlinx.serialization.SerializationException: class jsonApi.NewL2SnapCommand is not registered for polymorphic serialization in the scope of class jsonApi.JsonCommand
The documentation for this is kinda sparse since it's a new feature, so any help would be appreciated.Felix Robles
05/06/2019, 11:18 AMFelix Robles
05/06/2019, 11:22 AMFelix Robles
05/06/2019, 11:23 AMFelix Robles
05/06/2019, 11:24 AMstreetsofboston
05/06/2019, 11:27 AMFelix Robles
05/06/2019, 11:30 AMtschuchort
05/06/2019, 1:10 PMclass Name<K : Name.Kind, E : Name.NamedElement>(val kind: K, val namedElement: E) {
sealed class Kind {
object Simple : Kind()
object Qualified : Kind()
}
sealed class Element {
object Type : Element()
object Package : Element()
object Method : Element()
}
}
fun onlyQualifiedNames(n: Name<Name.Kind.Qualified, *>)
fun onlyMethodNames(n: Name<*, Name.Element.Method>)
fun onlySimplePackageNames(n: Name<Name.Kind.Simple, Name.Element.Package>)
fun anyName(n: Name<*,*>)
What do you think? It feels way over engineered.
If we were only interested in either qualified/simple or type/package/method then I would use sealed classes of course. But here we have a 2-dimensional relationship.user
05/06/2019, 1:53 PMuser
05/06/2019, 2:28 PMChi
05/06/2019, 7:10 PMfor
loop in Kotliniex
05/06/2019, 11:01 PMLeoColman
05/07/2019, 3:04 AMfor
is called, but I find it useful quite often, and I can't really replace it with for (i in x..y)
andraskindler
05/07/2019, 8:10 AMgildor
05/07/2019, 3:05 PMuser
05/07/2019, 7:59 PMuser
05/07/2019, 9:18 PM