ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.31.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
coderobe has quit [Ping timeout: 245 seconds]
coderobe has joined #crystal-lang
alexherbo29 has quit [Ping timeout: 276 seconds]
dwdv has quit [Ping timeout: 240 seconds]
absolutejam2 has joined #crystal-lang
<FromGitter> <ImAHopelessDev_gitlab> Nice @Blacksmoke16 !
absolutejam2 has quit [Ping timeout: 264 seconds]
Nekka has quit [Read error: Connection reset by peer]
dwdv has joined #crystal-lang
Nekka has joined #crystal-lang
<FromGitter> <ImAHopelessDev_gitlab> `raise "This item is already in the sell buffer." if client.sell_buffer.includes itemid?` ROFL NICE FAIL
<FromGitter> <ImAHopelessDev_gitlab> can't believe i didn't catch that sooner lol 😆
<FromGitter> <bararchy> @ImAHopelessDev_gitlab What are you using to talk with the backend BTW? is the game online or just "pinging" for data every now and then ?
<FromGitter> <ImAHopelessDev_gitlab> @bararchy just a simple timer in Godot (client), pings every 5 seconds
<FromGitter> <ImAHopelessDev_gitlab> online yeah. Crystal juiced 100%
<FromGitter> <bararchy> Online as in Multi-player online sync action or people can interact but it's not real-time ?
<FromGitter> <ImAHopelessDev_gitlab> 100% online, just like Diablo 2 / Path of Exile
<FromGitter> <ImAHopelessDev_gitlab> "multi-player online sync action". yes, this one lol.
<FromGitter> <ImAHopelessDev_gitlab> I can't stop coding, what has crystal done 😆
_whitelogger has joined #crystal-lang
alexherbo29 has joined #crystal-lang
<FromGitter> <xmonader> Hi I want to know to the correct way of calculating the memory usage of creating lots of class/struct objects
<FromGitter> <xmonader> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5db56c9e9825bd6bacd8dbfb]
hightower3 has joined #crystal-lang
HumanGeek has quit [Quit: Leaving]
alexherbo29 has quit [Quit: The Lounge - https://thelounge.chat]
<FromGitter> <kingsleyh> in crystal 0.31.1 - do specs run differently - my specs seem to be running totally differently
<FromGitter> <bararchy> yes
<FromGitter> <bararchy> :)
<FromGitter> <bararchy> Big changes in specs
<FromGitter> <j8r> since 0.31.0
<FromGitter> <j8r> they don't run sequentially
<FromGitter> <kingsleyh> can I make them run sequentially?
<FromGitter> <kingsleyh> I had them grouped up and they printed to the console when each group was running - but now none of this works
<FromGitter> <kingsleyh> it prints out all the groupings - then runs all the specs
<FromGitter> <kingsleyh> and some are failing now - which I guess must be related to the changes
<FromGitter> <j8r> no
<FromGitter> <Blacksmoke16> @xmonader try like `GC.stats.total_bytes`
<FromGitter> <Blacksmoke16> Dunno if there's a better way or not tho
absolutejam2 has joined #crystal-lang
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/0.31.1/Benchmark.html#memory(&block)-instance-method also maybe helpful
absolutejam2 has quit [Ping timeout: 250 seconds]
absolutejam2 has joined #crystal-lang
alexherbo2 has joined #crystal-lang
<hightower3> Hey Blacksmoke16 , maybe you have an idea regarding your paste https://play.crystal-lang.org/#/r/7vta . You remember we were discussing that there is also AnyEvent(RealEvent, args), which should trigger whenever any other event is triggered. I converted structs to classes, and I can now do this. AnyEvent is defined as AnyEvent < Event, event_type : Event.class, event : Event. However, it needs to be triggered from emit() itself, and
<hightower3> I don't
<hightower3> don't understand how to emit it from there
<hightower3> ah wait
<hightower3> yeah, not really sure how to call it
<FromGitter> <Blacksmoke16> wouldnt you just do like `emit obj, type` within `.emit`?
<FromGitter> <Blacksmoke16> er `emit type, obj`
<hightower3> Ah I see somehow when I do emit AnyEvent, type, args, the args is a Tuple(Event) instead of Event, not matching the function
<FromGitter> <Blacksmoke16> you'd want to do it from the other emit
alexherbo2 is now known as alex```
<FromGitter> <bararchy> btw, something I still don't understand, Does Mutex.synchronize stops the world, or just insures that specific Fiber will do the blocked actions at a time
<FromGitter> <bararchy> ?
<FromGitter> <xmonader> @Blacksmoke16 I got ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5db5a40de886fb5aa205a5eb]
<FromGitter> <Blacksmoke16> makes sense
<FromGitter> <Blacksmoke16> are probably making so many obs its overflowing the return value of total_bytes
<hightower3> Blacksmoke16 figured it! Just needed to focus a little bit and read the overloads :)
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5db5ac149c3982150994580a]
<FromGitter> <Blacksmoke16> any idea why this returns invalid JSON response?
<FromGitter> <Blacksmoke16> but works fine in curl/postman
<FromGitter> <tenebrousedge> @Blacksmoke16 that example returns 200 OK for me
<FromGitter> <Blacksmoke16> right, but look at the JSON body
<FromGitter> <Blacksmoke16> its using `(` instead of `[` so from_json fails
<FromGitter> <Blacksmoke16> but i think i just had to specify `Accept` Header 😐
ht__ has joined #crystal-lang
absolutejam2 has quit [Ping timeout: 276 seconds]
<FromGitter> <ImAHopelessDev_gitlab> douglas crockford will be proud
<FromGitter> <ImAHopelessDev_gitlab> Good morning
<FromGitter> <asterite> Bar Hofesh: the latter
absolutejam2 has joined #crystal-lang
absolutejam2 has quit [Ping timeout: 276 seconds]
absolutejam2 has joined #crystal-lang
absolutejam2 has quit [Ping timeout: 268 seconds]
absolutejam2 has joined #crystal-lang
absolutejam2 has quit [Ping timeout: 265 seconds]
early has quit [Ping timeout: 246 seconds]
early has joined #crystal-lang
<hightower3> Hey if I have a char like space, and integer saying how many (like 8), how do I produce a string of 8 spaces?
<FromGitter> <tenebrousedge> `char.to_s * 8`
<hightower3> aah of course, I was trying the other way around with 8*, and failing
<hightower3> thanks
absolutejam2 has joined #crystal-lang
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5db5d235f26ea4729d06e9fd]
<FromGitter> <Blacksmoke16> :thinking:
<FromGitter> <Blacksmoke16> old crystal version cached in snap for some reason ^
<hightower3> Can I create a block which has the ability to re-call itself with some different arguments (but of same type)?
<FromGitter> <Blacksmoke16> isnt that what a proc is
<FromGitter> <tenebrousedge> it'd be a recursive proc, but yes
<hightower3> yeah, great, that'll be nice
<FromGitter> <tenebrousedge> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5db5d5d77477946badde341c]
<hightower3> btw Blacksmoke16, tenebrousedge: https://github.com/crystallabs/crysterm
<FromGitter> <tenebrousedge> :plus1:
<FromGitter> <asterite> you can, you have to use uninitialized
<FromGitter> <asterite> f = uninitialized Proc(Int32, Int32); f = ->(x : Int32) { f x }
<FromGitter> <lbarasti> Folks, I'm doing this, I'll be live coding a concurrent, terminal-based, URL status checker in Crystal in ~1 hour. Tell your friends :D ⏎ https://www.twitch.tv/lbarasti/
<FromGitter> <asterite> nice!
<hightower3> cool!
<hightower3> If functions in ruby/js/etc. accept dicts with all sorts of arguments, what's the best bet to port this to Crystal? To make the options classes with properties, so that each option can have the right type and default value, or?
<FromGitter> <tenebrousedge> Crystal methods accept named arguments. see `Time#shift`
<FromGitter> <tenebrousedge> https://crystal-lang.org/api/0.31.1/Time.html#shift(*,years:Int=0,months:Int=0,weeks:Int=0,days:Int=0,hours:Int=0,minutes:Int=0,seconds:Int=0,nanoseconds:Int=0)-instance-method
<FromGitter> <tenebrousedge> all of those are named, optional, typed (Int), and default to zero
<FromGitter> <tenebrousedge> see also `**args`
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
<FromGitter> <ImAHopelessDev_gitlab> how to prevent arthmitic overflow exception, but let the number just max out at it's max value instead
<FromGitter> <ImAHopelessDev_gitlab> is that possible?
dannyAAM has joined #crystal-lang
<FromGitter> <tenebrousedge> you'd probably have to catch the exception
<FromGitter> <ImAHopelessDev_gitlab> i bet 1 if lineer would do it
<FromGitter> <tenebrousedge> the safe mathematical operators wrap
<hightower3> tenebrousedge yes, yes, of course they do, I just mean the flexibility of that is limited
<hightower3> especially when like, the value of some option is another dict.. like pos = { left: 0, right: 0 } etc.
<FromGitter> <ImAHopelessDev_gitlab> `2147483647` is a special number, please don't hurt me, i tried an unsigned int, but db.mapping wasn't happy about that
<FromGitter> <tenebrousedge> you can have `{ left: 0, right: 0}` as a default value
<FromGitter> <tenebrousedge> what's the limitation?
<hightower3> I mean when I need to pass this around, and when I don't have all members listed at once. And especially if they're not of the same type, like { blink: true, blink_rate: 0.5 } etc.
<FromGitter> <tenebrousedge> it sounds like you maybe want to pass around a struct
<FromGitter> <ilanpillemer> how much faster is something that is built and then the binary is run, vs something that is just run. slightly, or very?
absolutejam2 has quit [Ping timeout: 268 seconds]
<FromGitter> <bararchy> @ilanpillemer very
<FromGitter> <tenebrousedge> especially with `release` flag
<FromGitter> <bararchy> ^ yeha
<FromGitter> <ilanpillemer> that explains it then
<FromGitter> <ilanpillemer> I solved a puzzle just by building and running it. If I justy ran it igt was too slow.
<FromGitter> <absolutejam_twitter> Did you look at the Crystal data classes shard hightower6?
<FromGitter> <absolutejam_twitter> Wtf I pressed 3 haha
<FromGitter> <absolutejam_twitter> Mobile keypads
<FromGitter> <ImAHopelessDev_gitlab> https://play.crystal-lang.org/#/r/7wck/edit O_o NiceEEEEE
<FromGitter> <ImAHopelessDev_gitlab> me likey
<FromGitter> <bararchy> If anyone wanna read and maybe learn from my pain regarding MT: https://forum.crystal-lang.org/t/mt-and-mutex/1297
<FromGitter> <ImAHopelessDev_gitlab> happy to see more game dev code
<FromGitter> <bararchy> yeha
<FromGitter> <ImAHopelessDev_gitlab> I get channels confused with... channels like in a lobby chat room.. My mind explodes whenever I see `Channel` in code lol
<FromGitter> <bararchy> XD
<FromGitter> <bararchy> Channels I like, it's simple. ⏎ The new Mutex and access to shared objects is what's killing me
<FromGitter> <ImAHopelessDev_gitlab> https://i.gyazo.com/6d1b6ef6536f14e71fbd3cac6d608faa.png BEGONE
alex``` has quit [Quit: The Lounge - https://thelounge.chat]
<FromGitter> <bararchy> are you....are you programming in notepad??
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/7wcw i feel like this should work
<FromGitter> <ImAHopelessDev_gitlab> @bararchy yah. check my topic on forum haha i'm liking it.
<FromGitter> <Blacksmoke16> https://github.com/veelenga/awesome-crystal/issues/412#issuecomment-546724163 if you have a shard in `awesome-crystal` make sure you're not on the naughty list 😉
<FromGitter> <ImAHopelessDev_gitlab> > Looks like I hit the mention limit ⏎ 😆
<FromGitter> <bararchy> oh wow, I forgot about https://github.com/bararchy/mos_game
<FromGitter> <bararchy> one of my firs projects in Crystal
<FromGitter> <bararchy> how time fly when you have fun
<FromGitter> <bararchy> ;)
<FromGitter> <ImAHopelessDev_gitlab> noice
<FromGitter> <bararchy> hehehe
<FromGitter> <bararchy> it was fun, but it took too much time, and I was pretty sure to only one that will install crystal just to play this thing is me
<FromGitter> <ImAHopelessDev_gitlab> i like the prologues
<FromGitter> <ImAHopelessDev_gitlab> very descriptive :)
absolutejam2 has joined #crystal-lang
alexherbo2 has joined #crystal-lang
alexherbo2 is now known as alex```
<FromGitter> <bararchy> Thanks :)
<FromGitter> <yorci> hey, how is going guys
<FromGitter> <yorci> there is any hls server solution in crystal for make things faster ?
<FromGitter> <bararchy> HLS?
<FromGitter> <bararchy> as in High Load Servers ?
<FromGitter> <absolutejam_gitlab> the author of Tailwind has a youtube series on it and it's amazeballs
<FromGitter> <Daniel-Worrall> Http live streaming?
<FromGitter> <yorci> yes live streaming
<FromGitter> <absolutejam_gitlab> @Blacksmoke16 Is it worth adding some kind of popularity score to awesome-crystal?
<FromGitter> <absolutejam_gitlab> eg. stars?
<FromGitter> <Blacksmoke16> prob would run into same issue as the badges
<FromGitter> <Blacksmoke16> would be a bunch of requests
<FromGitter> <Blacksmoke16> but if all those in that comment get removed it'll prob be much more doable
ht__ has quit [Quit: ht__]
<FromGitter> <ImAHopelessDev_gitlab> i'm re-logging and creating games so many times in development, that i finally just wrote a script that basically just sends the commands and auto creates a game for me. don't have to click on the ui elements, enter lobby, select char, click create game button, type in game name, etc. man, this is so much better. you'd think someone who knows the netcode of their *own* server would have done
<FromGitter> ... this already 😆 ... this gonna boost my workflow TENFOLD, am hyped
<FromGitter> <Blacksmoke16> So an e2e test
<FromGitter> <ImAHopelessDev_gitlab> had to google that, TIL
<FromGitter> <ImAHopelessDev_gitlab> Damn that's nice definition, that's so me
A124 has joined #crystal-lang
A124 has quit [Client Quit]
sagax has quit [Read error: Connection reset by peer]
<FromGitter> <tenebrousedge> automated testing is pretty necessary. I don't often write tests first, but once I get the basic functionality nailed down, they're pretty necessary for keeping things working
dwdv has quit [Quit: quit]
teardown has quit [Ping timeout: 268 seconds]