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
sagax has quit [Remote host closed the connection]
<FromGitter> <plambert> Can anyone tell me what I'm missing, why this simple code doesn't work?
<FromGitter> <Blacksmoke16> whats the error
<FromGitter> <Blacksmoke16> `no overload matches 'Socket::IPAddress#to_json' with type JSON::Builder`?
<FromGitter> <Blacksmoke16> not every type can be serialized as JSON. This is a case of a type that doesn't have built in support for it
ur5us has joined #crystal-lang
brw has joined #crystal-lang
ur5us has quit [Remote host closed the connection]
ur5us has joined #crystal-lang
ulyssa has quit [Ping timeout: 246 seconds]
ur5us has quit [Ping timeout: 252 seconds]
hightower2 has joined #crystal-lang
notzmv has quit [Ping timeout: 240 seconds]
Chillfox has joined #crystal-lang
Chillfox has quit [Quit: Leaving]
Chillfox has joined #crystal-lang
Volk has joined #crystal-lang
Volk has quit [Changing host]
Volk has joined #crystal-lang
ur5us has joined #crystal-lang
Chillfox has quit [Quit: Leaving]
ur5us_ has joined #crystal-lang
ur5us has quit [Read error: Connection reset by peer]
sagax has joined #crystal-lang
taupiqueur has joined #crystal-lang
pixel has quit [*.net *.split]
dostoyevsky2 has quit [*.net *.split]
xybre has quit [*.net *.split]
avane has quit [*.net *.split]
ur5us_ has quit [Ping timeout: 264 seconds]
notzmv has joined #crystal-lang
avane has joined #crystal-lang
dostoyevsky2 has joined #crystal-lang
pixel has joined #crystal-lang
xybre has joined #crystal-lang
taupiqueur has quit [Ping timeout: 245 seconds]
taupiqueur has joined #crystal-lang
hightower2 has quit [Ping timeout: 250 seconds]
hightower2 has joined #crystal-lang
taupiqueur has quit [Remote host closed the connection]
taupiqueur has joined #crystal-lang
Volk has quit [Quit: See you next time!]
Volk has joined #crystal-lang
<hightower2> Hey so, long ago I heard/remembered that there's a way to kill a fiber, but not exposed to public API. However, looking at the code now, I don't see any method for it. Whats' your advice on how to do it?
<FromGitter> <jrei:matrix.org> This JSON error is due to the `to_json` method pollution on all Crystal objects, even those which cannot be serialized to JSON have it
<FromGitter> <jrei:matrix.org> This is pretty bad, because it pollutes all other objects API, including API docs and IDE completion
hightower2 has quit [Ping timeout: 252 seconds]
<FromGitter> <Blacksmoke16> doesnt that only happen if you `require "json"`?
hightower2 has joined #crystal-lang
<hightower2> sorry got disconnected. if anyone had input on terminating threads from outside, please re-post, thanks
<FromGitter> <oprypin:matrix.org> hightower2, u can just check gitter or matrix
<FromGitter> <oprypin:matrix.org> but yea i see no response to your question
<FromGitter> <asterite> we could probably make `JSON::Serializable` define that `to_json` method. Then we'd need to implement it for all primitive types, but maybe that's fine, I don't know.
<FromGitter> <jwaldrip:matrix.org> I think thats a fair ask, either types have to define their own "to_json" method or they can import JSON::Serializable
<FromGitter> <jwaldrip:matrix.org> same for `from_json` I would expect as well
<FromGitter> <HertzDevil> i'm personally not a fan of the fact that `to_json` and `to_json(value)` and `to_json(JSON::Builder)` all share the same name
<FromGitter> <HertzDevil> are there no active maintainers for crystal-lang-tools/language-crystal
<FromGitter> <HertzDevil> it apparently backs crystal syntax highlighting on the whole github and it has not been updated for 2+ years
<FromGitter> <jrei:matrix.org> Thumbsupped the issue and PR, agreed
taupiqueur has quit [Remote host closed the connection]
taupiqueur has joined #crystal-lang
<f1refly> when using the option parser and calling #stop, is there a way to tell what argument i'm currently at?
<FromGitter> <Blacksmoke16> i didnt know it has a `#stop` 🤔
<f1refly> I'd like to use some arguments after a subcommand without using flags, can i do that without trying to count the parsed arguments myself?
<FromGitter> <Blacksmoke16> ah it's same as `--`
<f1refly> yes
<f1refly> it's pretty nifty, i like optionparser a lot
<FromGitter> <Blacksmoke16> cant just pass that?
<f1refly> it would be a bit awkward tbh
<FromGitter> <Blacksmoke16> `./bin/foo command -- args` is pretty standard way to handle that
<f1refly> args is my main way to interact with my program though and i don't want to type -- after the program alias every time i query something from my dnd character sheet :)
<f1refly> it's okay, maybe optionparser is just the wrongt ool for this job
<f1refly> i'll create my own instead
<FromGitter> <Blacksmoke16> make a bash alias that includes it 😉
<f1refly> that way i couldn't use any flags though
<f1refly> i'd have to hack a bash function but i could just do it properly in my program instead
<FromGitter> <Blacksmoke16> oh wait, going back to your original question, coudn't you just check `ARGV` as i think option parser removes them as they get parsed
<FromGitter> <Blacksmoke16> `ARGV.first?` that is
<straight-shoota> https://crystal-lang.org/api/1.1.1/OptionParser.html#unknown_args(&unknown_args:Array(String),Array(String)-%3E)-instance-method
<FromGitter> <Blacksmoke16> oh well that looks exactly what you'd want
hightower2 has quit [Ping timeout: 264 seconds]
<straight-shoota> The unknown_args handler receives an array of unknown arguments before the stop call as first input, and after the stop call as second input
<straight-shoota> And all unknown args are left in the original array of arguments (such as `ARGV`). The ones that have been handled are removed.
Volk has quit [Remote host closed the connection]
hightower2 has joined #crystal-lang
hightower2 has quit [Ping timeout: 246 seconds]
riza has quit [Quit: server reboot]
ur5us_ has joined #crystal-lang
hightower2 has joined #crystal-lang
riza has joined #crystal-lang
riza has quit [Client Quit]
Volk has joined #crystal-lang
Volk has joined #crystal-lang
Volk has quit [Changing host]
riza has joined #crystal-lang
riza has quit [Quit: D:]
riza has joined #crystal-lang
notzmv has quit [Ping timeout: 252 seconds]
riza has quit [Quit: rebloot]
riza has joined #crystal-lang
riza has quit [Quit: one more time]
riza has joined #crystal-lang
riza has quit [Quit: riza]
riza has joined #crystal-lang
riza has quit [Client Quit]
riza has joined #crystal-lang
ur5us_ has quit [Ping timeout: 250 seconds]
taupiqueur has quit [Ping timeout: 250 seconds]
ulyssa has joined #crystal-lang
Chillfox has joined #crystal-lang