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
sevvie has joined #crystal-lang
ur5us has quit [Ping timeout: 250 seconds]
ur5us has joined #crystal-lang
hamoko has joined #crystal-lang
ur5us has quit [Ping timeout: 250 seconds]
deavmi has joined #crystal-lang
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?
<SamantazFox_> https://crystal-lang.org/api/1.1.1/IO.html#read_string(bytesize:Int):String-instance-method
<SamantazFox_> There's also gets, which won't raise: https://crystal-lang.org/api/1.1.1/IO.html#gets(delimiter:Char,limit:Int,chomp=false):String?-instance-method
<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
<SamantazFox_> diff types?
<FromGitter> <Blacksmoke16> `ivar : MetaVar`
<SamantazFox_> Ah!
<SamantazFox_> And same would go for `ivar.type.is_a?`, I guess, right?
<FromGitter> <Blacksmoke16> maybe? or `ivar.type == Array` might work too...
<SamantazFox_> I've tried that, it doesn't work (because it's an `Array(String)`)
<FromGitter> <Blacksmoke16> `ivar.type <= Array`
<SamantazFox_> That works, thanks :)
<SamantazFox_> Though, it's so counter-intuitive xD
<FromGitter> <Blacksmoke16> it's not wrong tho
<SamantazFox_> Idk, I don't know enough crystal to tell
<SamantazFox_> for me, `<=` means "smaller than or equal to"
deavmi has quit [Read error: Connection reset by peer]
deavmi_ has joined #crystal-lang
<FromGitter> <Blacksmoke16> in this case it means https://crystal-lang.org/api/master/Crystal/Macros/TypeNode.html#%3C=(other:TypeNode):BoolLiteral-instance-method
<SamantazFox_> I gotta be honnest: the documentation for the macros is lacking a ton of concepts.
<FromGitter> <Blacksmoke16> pretty much :/
elf_fortrez has joined #crystal-lang
<SamantazFox_> why that doesn't work
<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
maxpowa has quit [Ping timeout: 276 seconds]
willamin has quit [Ping timeout: 276 seconds]
maxpowa_ has joined #crystal-lang
maxpowa_ is now known as maxpowa
willamin has joined #crystal-lang
ur5us has joined #crystal-lang
hightower3 has quit [Ping timeout: 248 seconds]
<FromGitter> <HertzDevil> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=6128109799b7d97528d7caa7]
<FromGitter> <HertzDevil> it's time
<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.
brw has joined #crystal-lang
ur5us has quit [Ping timeout: 240 seconds]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 250 seconds]
ur5us has joined #crystal-lang