ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
avane_ has quit [Ping timeout: 240 seconds]
avane has joined #crystal-lang
avane has quit [Client Quit]
avane has joined #crystal-lang
ur5us has quit [Ping timeout: 240 seconds]
ur5us has joined #crystal-lang
tleaf has joined #crystal-lang
ur5us has quit [Ping timeout: 250 seconds]
_whitelogger has joined #crystal-lang
riza has joined #crystal-lang
jhass has joined #crystal-lang
straight-shoota has joined #crystal-lang
dom96 has quit [*.net *.split]
jrayhawk has quit [*.net *.split]
jrayhawk_ has joined #crystal-lang
otoburb has joined #crystal-lang
dom96 has joined #crystal-lang
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 250 seconds]
tleaf has quit [Quit: nyaa~]
ur5us has joined #crystal-lang
sorcus has quit [Ping timeout: 240 seconds]
nopc0de has joined #crystal-lang
hightower3 has joined #crystal-lang
yxhuvud has quit [Remote host closed the connection]
yxhuvud has joined #crystal-lang
notzmv has quit [Ping timeout: 240 seconds]
nopcOde has joined #crystal-lang
nopc0de has quit [Ping timeout: 244 seconds]
ur5us has quit [Ping timeout: 252 seconds]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 244 seconds]
notzmv has joined #crystal-lang
Peter0x44 has joined #crystal-lang
<hightower3> hmm, so I have a case where I need to write <header><body> into an IO. Length of (serialized) body must be specified in the header. But obviously I don't know the length of body until I serialize it, and it seems I need a temporary variable to store the serialized content, then update its length in the header, then write out both.
<hightower3> Is there some clever trick maybe that I could use to avoid having to serialize to a temporary variable?
<hightower3> well, I guess I could calculate the length in advance, without serializing it... that would be doable, although not very elegant unless I wrote a macro that produces the calc method automatically
Peter0x44 has quit [Ping timeout: 252 seconds]
Peter0x44 has joined #crystal-lang
<raz> hightower3: is the IO seekable?
<hightower3> no
<raz> then you're out of luck i'm afraid :) (the only alternatives are to know the size beforehand or fixed framing)
<hightower3> right, ok great, thanks for confirming
notzmv has quit [Ping timeout: 252 seconds]
notzmv has joined #crystal-lang
nopc0de_ has joined #crystal-lang
nopcOde has quit [Ping timeout: 244 seconds]
<riza> is there a crystal shard wrapping libusb?
<riza> or hidapi
sorcus has joined #crystal-lang
<SamantazFox_> Mmmh, why does the formatter arbitrarily idents by 4 spaces on a wrapped if condition?
<SamantazFox_> https://bpa.st/SKAA
<straight-shoota> It's a common style to indent wrapped expressions that way to visually separate them from the block body indent
<SamantazFox_> the problem is that now, my closing parenthesis is at the level of the code below the `if`, not the `if` itself...
<FromGitter> <Blacksmoke16> prob a bug
<straight-shoota> I think that's intended
<straight-shoota> the closing parenthesis has the same indent as the condition of the if
<straight-shoota> s/of/after/
<SamantazFox_> tbh, that's not ideal
<SamantazFox_> makes code harder to read and confusing
<SamantazFox_> (So is the removal of blank lines, btw)
<straight-shoota> how is it harder to read? Or what would be easier?
<straight-shoota> Blank lines should only be removed when non-essential. Can you show an example where it hinders readability?
ur5us has joined #crystal-lang
<FromGitter> <beta-ziliani> `export LLVM_CONFIG=<path/to/your/llvm-config>` should do the trick
Guest70931 has joined #crystal-lang
mookie has quit [Ping timeout: 256 seconds]
<riza> straight-shoota: I think that's a subjective analysis, but code readability in general is subjective. It's common in many languages to seperate functions into groups and to seperate the groups by 3 or 5 blank lines to indicate that the functions are logically grouped.
<raz> crystal has keywords for grouping. class and module
<FromGitter> <syeopite:matrix.org> Why is the `:nodoc:` directive ignored in the generated documentation? ⏎ https://github.com/syeopite/lens/blob/9b60abce/src/helpers/overloads.cr#L2https://syeopite.github.io/lens/api/master/YAML.html
<FromGitter> <Blacksmoke16> It's probably defined benefit the original namespace
<FromGitter> <Blacksmoke16> Before*
<SamantazFox_> straight-shoota: here, for instance => https://github.com/iv-org/invidious/blob/master/src/invidious/users.cr#L291-L294
<SamantazFox_> I'd likely put a newline after the `if`
<FromGitter> <Blacksmoke16> :shrug: is what it is
<SamantazFox_> I'd appreciate some flexibility :P
<SamantazFox_> I like when code is spaced, in chunks. It's visually easier to navigate than, uh, this: https://github.com/iv-org/invidious/blob/master/src/invidious/comments.cr#L188-L213
<raz> that's probably the only thing that golang every got right
<raz> maybe a 3rd party formatter could exist with more flexibility. but i think there's value in having a canonical style that every CTO can use to choke out the endless vim vs emacs debates
<SamantazFox_> https://bpa.st/XTAQ
<SamantazFox_> I mean...
watzon1 has joined #crystal-lang