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
<FromGitter> <skinnyjames> would anyone happen to know how to start a new process in it's own process group from a Crystal executable? ⏎ I've tried quite a bit, (including fork/exec) but the child process always shares the same group with the parent.
<FromGitter> <skinnyjames> It seems the only way i understand to reliably do this is ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ It would be nice to figure it out without `fork` though, as far as I can tell it doesn't seem to be guaranteed to be there (https://github.com/crystal-lang/crystal/issues/6421) [https://gitter.im/crystal-lang/crystal?at=63c3672b378d512c1860ebd3]
Sankalp has quit [Ping timeout: 252 seconds]
Sankalp has joined #crystal-lang
Sankalp has quit [Ping timeout: 260 seconds]
Sankalp has joined #crystal-lang
Sankalp has quit [Ping timeout: 268 seconds]
Sankalp has joined #crystal-lang
Sankalp has quit [Ping timeout: 252 seconds]
Sankalp has joined #crystal-lang
jrayhawk has quit [Ping timeout: 268 seconds]
jrayhawk has joined #crystal-lang
Sankalp- has joined #crystal-lang
Sankalp has quit [Ping timeout: 272 seconds]
Sankalp- is now known as Sankalp
_ht has joined #crystal-lang
quazimodo has joined #crystal-lang
yxhuvud has quit [Remote host closed the connection]
yxhuvud has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
quazimodo has quit [Ping timeout: 265 seconds]
alexherbo2 has joined #crystal-lang
<_dave> do ALL `Comparable#clamp` calls deal with `BigInt`, &c.?
<_dave> i'm trying to clamp a `UInt8` and keep getting `OverflowError` problems.
<FromGitter> <Blacksmoke16> can you share the code?
<_dave> one sec, since this is via irc...
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/cr
<_dave> noice. lemme get an mvp out first.
<_dave> hm. playground does not like guard clauses.
<FromGitter> <Blacksmoke16> a gist would work too.
<FromGitter> <Blacksmoke16> playground should work just fine with guard clauses tho...
<_dave> it does weird indenting after `return`, that's the thing.
<_dave> ah yes here we go. at least an MVP. https://play.crystal-lang.org/#/r/eeey
<_dave> --error-trace doesn't help in thhis part and the codebase is a little too jank to do printf debugging.
<_dave> i thought `#clamp` was generic enough to simply use the type that it's called on from the docs so the resulting clamping should be `UInt8` but... even if it is, why is it overflowing?
<FromGitter> <Blacksmoke16> its underflowing due to your randomness
<FromGitter> <Blacksmoke16> e.g. `roll_size` returns `3` and `flux` returns `-5`
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/eef6
<_dave> weird. line 10 in my example is a minimum of 0 since (roll + roll)'s minimum is 2 (then -2). we skip line 11 since the result is not 10. but that should at least go `0.clamp(0, 15)`.
<FromGitter> <z:uxn.one> Good morning
<_dave> or is this more type screwery and the answer is likely "just Int32 brah"?
<_dave> oh. i see the problem now. it's in roll_atmosphere since THAT plus flux can be negative.
<FromGitter> <Blacksmoke16> right, before it gets to the clamp
<_dave> sounds like it is another "just Int32 brah" problem. thanks.
<FromGitter> <Blacksmoke16> but yes, if you dont have a reason to use these smaller int types then id just use int32
<_dave> it just feels 3 more bytes wasteful since none of these values go over 32.
<FromGitter> <Blacksmoke16> premature optimization id say
<_dave> and that would be 18 bytes total considering things. then again THIS irc message is way more bytes so yeah, you're right. premature optimization.
<FromGitter> <Blacksmoke16> LLVM prob can do some magic in its optimizations too
hightower2 has joined #crystal-lang
alexherbo2 has quit [Remote host closed the connection]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 260 seconds]
taupiqueur has quit [Ping timeout: 252 seconds]
notzmv has quit [Ping timeout: 264 seconds]
ur5us has joined #crystal-lang
_ht has quit [Quit: _ht]
notzmv has joined #crystal-lang
<FromGitter> <stellarpower> IS there a way I can parse a date/time in Crystal, without knowing (or caring about) the exact format. I'd like to be lazy, and have something that extracts the longest substring containing a date/time that can be found. (i.e., if it sees date and then time, don't just parse the date). I would accept that this carries some inherent dangers and would happily have the code throw an except, mess up, or not
<FromGitter> ... quite do what I think it will be doing in those cases. Basically something like the unix date utility, or I believe ruby's DateTime::parse didn't need the format string and would make some sensible attempts as guesses first. Cheers
quazimodo has joined #crystal-lang
<FromGitter> <Blacksmoke16> iirc there's a shard for that
<FromGitter> <rjnienaber> https://github.com/wyhaines/ParseDate.cr ?
<FromGitter> <Blacksmoke16> i think so yea