#I wrote an article about Gleam!

1 messages ยท Page 1 of 1 (latest)

compact smelt
atomic notch
#

Neat! Are you planning to release it as a package?

violet anvil
#

Nice article! I think you can use rust syntax highlighting to get pretty decent Gleam highlighting too

compact smelt
compact smelt
atomic notch
#

Oooh part 2 sounds exciting

compact smelt
#

that will probably come along once the package is done ๐Ÿ˜Ž

stark wolf
#

this is super cool, thanks for sharing! are you using / planning to use mug? or FFI out to erlang?

compact smelt
#

just using mug for now, may ffi out to erlang if needed (todo: learn erlang)

gilded crescent
#

you could use this syntax too:

  <<
    packet.size:32-little,
    packet.id:32-little,
    packet.typ:32-little,
    packet.body:bits,
    0,
    0,
  >>
#

and depending on your usecase, it may be nice to have custom error types, or at least some info about the incorrect value in the error message, like n -> Error("type must be 3, 2, or 0 but was: " <> int.to_string(n))

#

something along the lines of:

pub type ParsingError {
  InvalidPadding(actual: BitArray)
  InvalidType(actual: Int)
  InvalidPacketFormat(actual: BitArray)
  InvalidPacketSize(actual: Int)
}
#

anyway, really good article, i really struggled quite a bit with this stuff when i got started ๐Ÿ™‚

compact smelt
#

ah, thatโ€™s a good point, I didnโ€™t think to match like that! iโ€™ll change that.

re: errors yea there will certainly be error types when the package comes around (soon!)

compact smelt
gilded crescent
#

uh, you imported a package just to type duration.seconds(5) |> duration.blur_to(duration.MilliSecond) instead of 5000? ๐Ÿ˜„

compact smelt
#

okay if we're being honest here it's very late and my brain is giving out, will polish it with fresh eyes tomorrow lmaoo

#

i am not known for polishing things before putting them in github

gilded crescent
#

heh, no worries

#

6am here too, so my politenessfilter is a bit worn out

compact smelt
#

yeesh!

gilded crescent
#

but i finally got my property testing working, so i'm happy ๐Ÿ™‚

#

gonna get some sleep and then think about how on earth i can protect against all those int overflows...

compact smelt
#

godspeed