deavmi_ has quit [Read error: Connection reset by peer]
hightower3 has joined #crystal-lang
<hightower3>
Not sure if this received a comment/suggestion yesterday - if I am reading a string from IO (terminated by \0), what's the best way to define max length?
wmoxam has quit [Ping timeout: 255 seconds]
wmoxam has joined #crystal-lang
elf_fortrez has joined #crystal-lang
ua_ has joined #crystal-lang
ua_ has quit [Quit: Leaving]
ua_ has joined #crystal-lang
ua_ has quit [Read error: Connection reset by peer]
cenan has joined #crystal-lang
ur5us has joined #crystal-lang
<SamantazFox_>
hightower3: <Blacksmoke16> asked "you mean like read x bytes from the IO?"
<hightower3>
I meant like, I want to read a string terminated by \0, but read at most X bytes. If the function reads more than X and it's still not \0, it should stop, or raise, or whatever.
<SamantazFox_>
hightower3: maybe `IO.read_string` is what you need?
<hightower3>
this first function says 'reads exactly bytesize'. I don't know how many bytes there are, I only know that I don't want to read more than max allowed value (e.g. 16 bytes).
<hightower3>
Aha gets seems interesting, I didn't think offhand that it has a limit value
<hightower3>
great, thanks
elf_fortrez has quit [Ping timeout: 246 seconds]
cenan has quit [Quit: Leaving]
<SamantazFox_>
yw :)
ur5us has quit [Ping timeout: 250 seconds]
<SamantazFox_>
`.is_a?()` should work in a macro, right?
<SamantazFox_>
{% for ivar in @type.instance_vars %} // {% if ivar.is_a?(Array) %} // # code // {% end %} // {% end %}
<FromGitter>
<Blacksmoke16> yes, but macros use diff types
<FromGitter>
<Blacksmoke16> `compact!` doesn't change the type of the array
<FromGitter>
<Blacksmoke16> even if in practice it wouldn't have any `nil` values anymore
<SamantazFox_>
arggghhhh
<SamantazFox_>
thanks
<FromGitter>
<RespiteSage> Are there existing issues for adding that documentation? I think we definitely need both guide-based docs and more extensive reference docs.
<FromGitter>
<Blacksmoke16> not that im aware of
<FromGitter>
<RespiteSage> The difficulty from my perspective is that it seems like the people with the most extensive experience with macros (you, Ary, oprypin, maybe watzon) don't have the time/energy to also write up documentation, and the people who might be interested in writing documentation (possible me, for example) don't have the in-depth experience with macros.
<FromGitter>
<Blacksmoke16> currently working on something that may help with that. Could serve as a good resource for backporting stuff into the publicdocs
elf_fortrez has quit [Quit: Client closed]
<FromGitter>
<RespiteSage> Oh, excellent. I look forward to seeing what you've got.
Guest12 has joined #crystal-lang
Guest12 has quit [Client Quit]
dmgk has left #crystal-lang [#crystal-lang]
<FromGitter>
<HertzDevil> the reference docs are also severely lacking in terms of actual formal specifications
<FromGitter>
<christopherzimmerman> 1) 0 is looking awesome, great work anyone who contributed. Finally have a lot more time to work on Crystal related stuff again, seems to be in a really good place.