Show newer

@lupyuen you might want to use the

x, ok := y.(type)
if !ok {
return fmt.Errorf("type assertion failed for: %v", x)
}

style of type assertions. by using the form with two return values you can prevent panics and instead return an error if you have malformed input data.

Remember that Messages are super tiny ... We shall encode Sensor Data in CBOR ... And our Data Source needs to decode the CBOR Payload

lupyuen.github.io/articles/ttn

Show thread

@TikToc @lupyuen I had a similar reaction initially. I can see it being useful for a message dispatch function. I also have a surreal numbers module I plan to write that could make use

@lupyuen Very cool! I am a fan of pattern matching in languages that have it, and I always miss it in ones that don't

@lupyuen -- Why is this being done? It wasn't needed. One could use if-elsif-else structures or dictionaries. What language is Python being converted into?

Sorry, I'm venting here. 😞

Show older
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.