jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | 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
deavmi has quit [Ping timeout: 246 seconds]
deavmi has joined #crystal-lang
<FromGitter> <perfecto25> .
<FromGitter> <perfecto25> hello everyone, im trying to create a multicast listener, need to bind it to specific interface (we have solarflare network cards)
<FromGitter> <perfecto25> cant find any example on how to bind to interface, and then subscrinbe to MC group + port
cerulean has quit [Ping timeout: 260 seconds]
<FromGitter> <perfecto25> something like this, ⏎ ./listener 192.168.30.5 (network interface to bind to) 225.208.114.344 (mc group) 34567 (port) ⏎ received mkt data.. ⏎ received mkt data.. [https://gitter.im/crystal-lang/crystal?at=5f05156f64ef9d04b29b5dbe]
<FromGitter> <perfecto25> not sure how to make it subscribe to group using Socket, ⏎ ` ⏎ require "socket" ⏎ ⏎ server = Socket.udp(Socket::Family::INET) ... [https://gitter.im/crystal-lang/crystal?at=5f0515c17a4e99049ef6cc9a]
cerulean has joined #crystal-lang
<cerulean> how do I make an array of arrays of strings?
<cerulean> @buffer = Array(Array(String))
<cerulean> doesn't work
<FromGitter> <asterite> .new
<FromGitter> <Blacksmoke16> or `[] of Array(String)`
<cerulean> [] of Array(String) is what I ended up with
<FromGitter> <Blacksmoke16> 👍
<cerulean> thx
<cerulean> I just wrote a chat server in Crystal using my custom protocol
<cerulean> the ruby server is still nicer but hey I just started this
<FromGitter> <Blacksmoke16> nice one
<cerulean> thanks
<cerulean> Crystal's performance makes the port worth it and a lot of the ruby code I wrote can be mostly copy and pasted in 8-)
<FromGitter> <Blacksmoke16> \o/
oddp has quit [Ping timeout: 256 seconds]
<cerulean> here's my chat server. it uses my custom protocol documented in the wiki. https://github.com/mixflame/GlobalChat2/blob/master/crystal-gchat-server/src/crystal-gchat-server.cr it's open source under the GPL
<cerulean> it will be updated to add some more features that the ruby server has, but is capable of running my chat (including E2E encrypted PMs)
sagax has quit [Quit: Konversation terminated!]
postmodern has joined #crystal-lang
cerulean has quit [Ping timeout: 256 seconds]
f1refly has quit [Ping timeout: 244 seconds]
f1reflyylmao has joined #crystal-lang
<postmodern> what's the "crystal way" for opening classes annd injecting additional functionality? is there some best practice to safely contain any injected methods so they don't conflict with other stuff?
<FromGitter> <Blacksmoke16> just reopen the type and add what you want. However the crystal way would be to think about it first
<FromGitter> <Blacksmoke16> like if you actually need to do that, and name things to reduce chances of conflicts
cerulean has joined #crystal-lang
<FromGitter> <mixflame> is it supported to distribute crystal programs without crystal? I saw a way to do it by bundling libevent and something else on Mac with homebrew. Is there a way to distribute everything needed to run a Crystal program in a package?
<postmodern> mixflames, https://github.com/crystal-lang/crystal/wiki/Static-Linking you'll need to install the static versions of any external C libraries for --static to static link everything in
sagax has joined #crystal-lang
<FromGitter> <mixflame> wow nice
<FromGitter> <jwaldrip> Is there a way to forward double splat from one macro to another?
<FromGitter> <jwaldrip> nvm, got it
cerulean has quit [Ping timeout: 272 seconds]
alexherbo2 has joined #crystal-lang
oddp has joined #crystal-lang
_whitelogger has joined #crystal-lang
deavmi has quit [Ping timeout: 260 seconds]
deavmi has joined #crystal-lang
postmodern has quit [Quit: Leaving]
alexherbo2 has quit [Ping timeout: 264 seconds]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Read error: Connection reset by peer]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 264 seconds]
alexherbo2 has joined #crystal-lang
<jhass> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=822275 do I read this right? we just landed in debian?
<yxhuvud> o_O
<yxhuvud> "The package is either very new" <- probably the case so not very confusing.
<yxhuvud> I mean it is less than a day old
<jhass> ah, yeah, didn't read too much :D
<jhass> I'm curious and trying to dig out the source package, but cannot it anywhere :/
<jhass> they gotta have some kind of git repo or so
<jhass> but no idea where
<yxhuvud> 0.34 though. So already behind. :D
<jhass> classic debian :D
<yxhuvud> perhaps, but doesn't seem to have the debug package if I read that right so there might be some never version around?
<raz> distro packaging is just eternally broken :<
<raz> i was hoping snap might fix it, but now everyone complains about snap, too
<raz> maybe crystal should just openly embrace asdf and brew? because realistically that's where everyone ends up anyay
<yxhuvud> oh yes. I just wish the different language specific package managers would start to talk to each other and allow cross referencing.
<jhass> Looks fairly legit though tbf, properly installed to /usr/, no wrapper script and made proper use of CRYSTAL_CONFIG
<raz> yeh, but will prob always be outdated. and where do shards go. does it work as non-root? etc.
<raz> actually, shards may be a non-issue (that's just a common headache with ruby gems)
<jhass> shards is a project level dependency manager, so nothing different there
<raz> yup true
<jhass> yeah
<jhass> https://salsa.debian.org/deiv-guest/crystal-lang/-/blob/master/debian/crystal-lang.links ah yeah the good old debian habit of replacing vendored libraries with whatever version they have
<raz> well, but i guess the endboss will remain: debian finally updated to 0.35.1, now how do i compile my 0.34 project?
<jhass> also gonna be some years until you can use MT there, given the bdwgc patches are not released yet
<raz> it's kinda funny how homebrew, that was kind of invented as an afterthought piggyback monstrosity on top of OSX, works way better for me than any legit distro pkg manager ever has
<jhass> I didn't quite figure out how it bootstrap yet
<jhass> oh, pacman works way better for me than homebrew
<raz> but i think even homebrew can't do multiple pkg versions in parallel hmm
<raz> ok, gotta admit i never tried pacman
<jhass> I haven't used it much yet but I feel like apk is basically the same
<jhass> neither helps you much with things like multi-version though
<raz> (got apt, rpm/yum, portage, apk, brew under my belt, and perhaps some others that i forgot about)
<raz> yeh apk is kinda nice, but has that disappearing pkgs problem :(
<jhass> but their package building components are essentially just thing wrappers around some shellscript, so you have a lot of flexibility
<raz> (the version you installed today may not exist tomorrow)
<jhass> that's not a problem of the package manager but of the distribution
<jhass> (and I still don't agree it's a major problem, but fwiw for archlinux there's archives)
<raz> yup, well, depends on tastes and priorities. my holy grail is a repeatable build. no matter if i build today or in 2yrs. but that's a property nobody seems to want anymore
<jhass> it's insanely hard
<jhass> stuff is just too complex these days
<jhass> anways
<jhass> how the hell does this thing bootstrap
<jhass> I don't get it
<raz> i like how your two last remarks click together :p
<jhass> :P
<FromGitter> <kingsleyh> Evening
<FromGitter> <kingsleyh> I'm building a match-3 / RPG style game in Crystal at the moment - here is the very beginning - I'm hoping to blog a bit about my experiences building it also: https://streamable.com/at7rtg
_whitelogger has joined #crystal-lang
<FromGitter> <j8r> Looks nice, even though it reminds me a game I have seen a trillion times.
<FromGitter> <Blacksmoke16> 🍬 🔨
alexherbo2 has quit [Ping timeout: 272 seconds]
<FromGitter> <kingsleyh> yeah I wanted it to feel very familiar but then have the user discover some differences while playing - also I'm bringing in the RPG storyline soon which will add some interesting aspect to the game
<FromGitter> <kingsleyh> This is my first attempt at building a game using Crystal - but I think it's going pretty well so far
<raz> i love it. a game of crystals built in crystal!
<FromGitter> <j8r> @kingsleyh like You Must Build a Boat? https://play.google.com/store/apps/details?id=com.eightyeightgames.ymbab&hl=en_US ⏎ I enjoyed it :)
alexherbo2 has joined #crystal-lang
<FromGitter> <rishavs> @kingsleyh love it. what are you using for the framework? crSFML, something else or just rolling with openGL?
MasterdonX has quit [Quit: ZNC 1.7.5 - https://znc.in]
MasterdonX has joined #crystal-lang
<FromGitter> <kingsleyh> @rishavs yes using crSFML
<FromGitter> <kingsleyh> I'll be releasing it on Steam or somewhere initially and then maybe port it to mobile - and maybe make some more of different genres as well
<FromGitter> <kingsleyh> another view of the game: https://streamable.com/c1prxl
go|dfish has quit [Ping timeout: 246 seconds]
<FromGitter> <rishavs> this is super cool. you are blazing the path for us. Please please do write up some articles/postmortems for us to learn from
kevinsjoberg has joined #crystal-lang
melthelesbian has joined #crystal-lang
issyl0 has joined #crystal-lang
<FromGitter> <kalinon> @kingsleyh i did port entitas to crystal: https://github.com/spoved/entitas.cr
<FromGitter> <kalinon> if you end up needed an entity framework
<FromGitter> <kalinon> needing*
Liothen has joined #crystal-lang
jetpack_joe has joined #crystal-lang
r0bby has joined #crystal-lang
go|dfish has joined #crystal-lang
chachasmooth_ has quit [Quit: Quit]
chachasmooth has joined #crystal-lang
postmodern has joined #crystal-lang
<postmodern> noticed that stdlib is missing TSort? is that intentional?
<FromGitter> <dscottboggs_gitlab> What's TSort?
<FromGitter> <wontruefree> it is for topological sorting
<FromGitter> <wontruefree> I think it is usually used for dependencies and in unix world it is used with compilers and linkers
Human_G33k has joined #crystal-lang
HumanGeek has quit [Ping timeout: 260 seconds]
alexherbo2 has quit [Ping timeout: 264 seconds]
<raz> there's also `tsort` in gnu coreutils. gotta be neckbeard lvl 5 or up to unlock, tho.
<FromGitter> <dscottboggs_gitlab> raz: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f064b783e4a827d19b28ef1]
<raz> man 1 tsort?
<FromGitter> <Blacksmoke16> works for me
<FromGitter> <mixflame> is there a callback for when a crystal program exits or a class is finalized?
<FromGitter> <Blacksmoke16> yes and yes
<FromGitter> <Blacksmoke16> at_exit and finalize
<FromGitter> <mixflame> nice
<FromGitter> <mixflame> thx
<raz> finalize always comes with these scary warning stickers tho
<raz> ("don't make new objects or bad things will happen")
<FromGitter> <mixflame> oh
<FromGitter> <mixflame> neither of those run when I ctrl+c... is there a hook for that as well?
<FromGitter> <Blacksmoke16> at exit should run, but you probably want like Signal::Int.trap
<FromGitter> <mixflame> yeah Signal::Int.trap works
<FromGitter> <mixflame> is this the correct method of using at_exit? ```at_exit do ⏎ nexus_offline ⏎ end```
<FromGitter> <mixflame> ``at_exit do ⏎ nexus_offline ⏎ end``
<FromGitter> <mixflame> dont know how to do multiline code in gitter
<FromGitter> <Blacksmoke16> That would run that method yea