ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.2 | 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
ssvb has joined #crystal-lang
<FromGitter> <j8r> for those that need to compile their crystal application statically, a Docker image is now live ! https://store.docker.com/community/images/jrei/crystal-alpine
<FromGitter> <j8r> @faustinoaq you may need interested :-)
<FromGitter> <Sija> @styler1972 checkout https://github.com/kemalcr/kemal-basic-auth
DTZUZO has quit [Ping timeout: 264 seconds]
DTZUZO has joined #crystal-lang
<FromGitter> <styler1972> yeah i gave that a shot but ended up rolling my own, its simple enough
<FromGitter> <styler1972> im a huge fan of intellij, but rubymine doesnt have a crystal plugin yet.. whats the next best IDE?
<FromGitter> <styler1972> was thinking about vim
<FromGitter> <j8r> It's not an IDE, but an editor. Try rather Atom or VSCode
That_Guy_Anon1 has joined #crystal-lang
That_Guy_Anon has quit [Ping timeout: 245 seconds]
<FromGitter> <faustinoaq> @j8r Very nice, Thank you! 😄
<FromGitter> <girng> :D
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DTZUZO has quit [Ping timeout: 268 seconds]
DTZUZO has joined #crystal-lang
<FromGitter> <bararchy> @Sija I use sublime and lately uses VScode
<FromGitter> <bararchy> @styler1972
qard has joined #crystal-lang
qard has quit [Client Quit]
DTZUZO has quit [Ping timeout: 264 seconds]
DTZUZO has joined #crystal-lang
duane has quit [Ping timeout: 264 seconds]
duane has joined #crystal-lang
guilleiguaran has quit [Quit: Connection closed for inactivity]
That_Guy_Anon1 has quit [Quit: Leaving]
alex`` has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.1]
<FromGitter> <evandrojr> Hi! How can I list the methods of an object, please?
<crystal-gh> [crystal] sdogruyol pushed 1 new commit to master: https://git.io/vpefW
<crystal-gh> crystal/master a327907 Benoit de Chezelles: Semantic: Allow macro overload on named args (#5808)...
<crystal-gh> [crystal] sdogruyol pushed 1 new commit to master: https://git.io/vpef8
<crystal-gh> crystal/master 96bcc34 Chris Hobbs: Rename and rework File::Stat as File::Info (#5584)...
<FromGitter> <bew> Can I first ask why you want to do that? @evandrojr
<travis-ci> crystal-lang/crystal#96bcc34 (master - Rename and rework File::Stat as File::Info (#5584)): The build was broken. https://travis-ci.org/crystal-lang/crystal/builds/366430984
<DeBot> https://github.com/crystal-lang/crystal/pull/5584 (Rename and rework File::Stat as File::Info)
<travis-ci> crystal-lang/crystal#a327907 (master - Semantic: Allow macro overload on named args (#5808)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/366430814
<DeBot> https://github.com/crystal-lang/crystal/pull/5808 (Semantic: Allow macro overload on named args)
<travis-ci> crystal-lang/crystal#96bcc34 (master - Rename and rework File::Stat as File::Info (#5584)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/366430984
<DeBot> https://github.com/crystal-lang/crystal/pull/5584 (Rename and rework File::Stat as File::Info)
<crystal-gh> [crystal] sdogruyol closed pull request #5577: Adds `Process.chroot` (master...chroot) https://git.io/vNs4S
<FromGitter> <girng> 2:53 am here
<FromGitter> <girng> im still up :D
<FromGitter> <girng> i duplicate my energy with a macro
<FromGitter> <girng> :D
<FromGitter> <sdogruyol> wow
<FromGitter> <sdogruyol> that's some great energy
<FromGitter> <girng> thank you @sdogruyol . glad to see you running crystal in production. i am hopign to run my game server in production soon
<FromGitter> <sdogruyol> just deployed a new Crystal service at my new company
<FromGitter> <r00ster91> What about a Predefined Constants section in https://crystal-lang.org/docs/syntax_and_semantics/constants.html ? Should I make a PR?
<FromGitter> <girng> @sdogruyol nice, what is it for? kemal website?
<FromGitter> <sdogruyol> a heavy load microservice ported from Ruby
<FromGitter> <sdogruyol> getting at around 60-70 rps
<FromGitter> <girng> i like your beard
<oprypin> r00ster91, API docs cover it
<oprypin> I think they're pretty strictly separated
<oprypin> maybe it would be nice to cover parts of standard library in the text docs but at the moment this is not the case\
<FromGitter> <girng> @sdogruyol i never knew ruby before, but im reading your crystalforrubyists.com site and it helps me still lol
<FromGitter> <sdogruyol> that's great to heart 🎉
<FromGitter> <girng> feels like a crystal cheat sheet :D
<FromGitter> <girng> i bookmarked it
<FromGitter> <r00ster91> oh ok
<travis-ci> crystal-lang/crystal#913cd8d (master - Adds `Process.chroot` (#5577)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/366446840
<FromGitter> <girng> off to bed, gn all ty for help once again
<crystal-gh> [crystal] r00ster91 opened pull request #5946: Fix link in openssl.cr (master...patch-12) https://git.io/vpeTx
<FromGitter> <Wulfklaue> Hope you do not mind @sdogruyol if i make some advertisement on Reddit? https://www.reddit.com/r/programming/comments/8c6ujs/going_from_735ms_on_ruby_to_15ms_on_crystal/
<FromGitter> <sdogruyol> oh boy, I don't mind but reddit... @Wulfklaue
<FromGitter> <evandrojr> @bew I need it so I can inspect a class https://github.com/evandrojr/awesome_print.cr
<FromGitter> <Wulfklaue> Don't worry, its also going on news.ycombinator.com 😄
<oprypin> :s
<FromGitter> <sdogruyol> ohg od
<oprypin> wulfklaue, throwing us under the bus
<FromGitter> <sdogruyol> I better put everything in DND mode :D
<oprypin> nvm, wrong idiom
<FromGitter> <Wulfklaue> Yes 😄 ... Well, interesting news needs to be published. That is how a language grows and gets attention.
<FromGitter> <Wulfklaue> Voila ... https://news.ycombinator.com/item?id=16836831 is also online. Free publicity never hurts ( much ). 😄
alex`` has joined #crystal-lang
<FromGitter> <bararchy> @sdogruyol damn your super merge power gonna make Crystal 25 a big release
<oprypin> i compiled latest crystal on llvm 5.0 and when i try to build my app i get this `crystal/src/openssl/lib_ssl.cr:218: undefined reference to `SSL_library_init'`
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
<FromGitter> <oprypin> ```testing```
<wuehlmaus> seems to be an issue, make docs does not work on my Apple anymore while at my arch linux it works
<wuehlmaus> git version i am talking.
<RX14> oprypin, could you print the LIBRESSL_VERSION and OPENSSL_VERSIOn constants?
<oprypin> dont you have the same problem on arch?
<oprypin> undefined constant, or i don't know where to get them from
<oprypin> LibCrypto
<RX14> you have to require openssl
<RX14> and then LibCrypto::LIBRESSL_VERSIOn
<RX14> N*
<oprypin> `require "openssl"; pp LibCrypto::OPENSSL_VERSION` still undefined
<RX14> what?
<oprypin> oh. well i'm on the "working" version
<RX14> I meant on the broken version
<oprypin> it doesn't get to that point, just same error
<oprypin> aha
<RX14> fuck
<RX14> 0x1010008F
<oprypin> 1 search result, really? https://www.google.com/search?q=0x1010008F
<RX14> so yeah
<RX14> I found the problem
alex`` has quit [Ping timeout: 268 seconds]
hightower3 has joined #crystal-lang
hightower2 has quit [Ping timeout: 240 seconds]
guilleiguaran has joined #crystal-lang
DTZUZO has quit [Read error: Connection reset by peer]
<FromGitter> <Sija> @elorest just out of curiousity, what did you used for backend in before-mentioned screen featured in Nikola Motors NZT? Amber?
alex`` has joined #crystal-lang
That_Guy_Anon has joined #crystal-lang
sz0 has joined #crystal-lang
guilleiguaran has quit [Quit: Connection closed for inactivity]
<RX14> thinking of streaming working on crystal, anyone interested?
<That_Guy_Anon> i'd be watching whenever i ahve time
<That_Guy_Anon> just letting it run besides me working :D
<oprypin> RX14, streaming what?
<RX14> programming
<oprypin> oh i thought crystal code that implements streaming
<RX14> lol
<FromGitter> <bew> Are you going to talk too? :)
<RX14> yeah
<oprypin> that's cool. i might watch 20 minutes later
<FromGitter> <bew> Do you know Livecoding.tv ?
<RX14> no
<FromGitter> <bew> (changed name: https://www.liveedu.tv)
<FromGitter> <bew> Iirc it was a code streaming plateform, but nvm it seems to have changed..
<FromGitter> <bew> RX14 it works :)
<RX14> nice
<FromGitter> <bew> (need an account to chat, making one now)
<RX14> ok cool
<Vexatos> I'd like to watch but my internet connection isn't good enough right now, heh
<RX14> rip
<RX14> 3mbps I have it set at
<FromGitter> <bararchy> RX14 you on now?
<RX14> yep
woodruffw has quit [Ping timeout: 256 seconds]
woodruffw has joined #crystal-lang
woodruffw has joined #crystal-lang
<oprypin> lul first thing i see is win10 wallpaper
<RX14> lol
<crystal-gh> [crystal] RX14 opened pull request #5947: Implement blocking ::sleep for win32 (master...feature/windows-sleep) https://git.io/vpeCK
<andrewzah> Hello all, I have an issue with crystal-db & micrate on crystal 0.24.2: https://github.com/crystal-lang/crystal-db/issues/83
qard has joined #crystal-lang
qard has quit [Client Quit]
qard has joined #crystal-lang
qard has quit [Client Quit]
qard has joined #crystal-lang
<crystal-gh> [crystal] RX14 opened pull request #5948: Improve NotImplementedError message (master...feature/not-implemented-error-message) https://git.io/vpelm
<crystal-gh> [crystal] RX14 opened pull request #5949: Fix linking to openssl (master...bugfix/openssl-linking) https://git.io/vpelD
qard has quit [Quit: qard]
<FromGitter> <bararchy> RX14 I had to drop, you're doing well, it was interesting, I subsribed to your channel to get notification when you are up next
<RX14> cool
<FromGitter> <bararchy> maybe give us an heads up :)
<RX14> np
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter> <Sija> @RX14 thx for streaming, that was fun watching you at action :)
<RX14> no problem
<RX14> hopefully next time there will be more... action
<FromGitter> <Sija> and bon appetit
<RX14> thanks
<FromGitter> <vlazar> @RX14 thank you, interesting idea
<FromGitter> <Sija> and btw, I love your wallpaper, any chances you share it?
<FromGitter> <Sija> good luck with crowdfunding!
<FromGitter> <bew> was fun to watch someone coding/working like this ^^ maybe I'll try doing that one day too
<RX14> how was the technical side?
<RX14> video/sound quality?
<RX14> @Sija working on finding that
<FromGitter> <bew> pretty good, no problem on my side (I was just late because my internet sucks, and sometimes stops every few secs)
<RX14> yeah I put it on quite high settings
<RX14> the bandwidth was about 2/8mbps
<RX14> which is quite a lot for some people
<RX14> 2.8*
<FromGitter> <bew> what program did you use on your side to stream?
<RX14> OBS
<FromGitter> <bew> ty
<RX14> even has a gif
<FromGitter> <Sija> same here, i’ve heard you loud and clear, video quality was good too, nuffin’ to complain
<RX14> nice
<RX14> over summer I should be able to put the VM on my desktop
<RX14> and use my laptop for encoding and coding
<RX14> which might help
<RX14> might set threads down on crystal to stop dropped frames when compiling too
<RX14> or just use nice
<RX14> anyway
<RX14> food
<FromGitter> <girng> says stream down
<FromGitter> <bew> it's finished for today
<FromGitter> <bew> he needs to eat :)
<FromGitter> <Sija> @RX14 nice, thx!
<Vexatos> didn't even save the video :I
<FromGitter> <girng> ook i follow him n wait for next stream
<FromGitter> <j8r> contrary to what we may think, @RX14 is a mortal who needs to eat, so far :-)
<RX14> I'm not sure my voice could handle streaming all day every weekday :)
<FromGitter> <bararchy> RX14 it could be cool if you save the video afterwards somehow
Yxhuvud has quit [Read error: Connection reset by peer]
<RX14> @bararchy twitch has a feature for that, but I forgot to turn it on
<RX14> @bararchy enabled :)
Yxhuvud has joined #crystal-lang
<FromGitter> <girng> macro is compile time
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vpeRG
<crystal-gh> crystal/master 19360bc Chris Hobbs: Fix linking to openssl (#5949)
<FromGitter> <bew> hey I'm doing an experiment with streaming too (probably won't code, just want to test things, can someone check that it works?) https://www.twitch.tv/beww78
<FromGitter> <girng> works
<FromGitter> <girng> but i can't type in chat i press enter nothing shows up
<FromGitter> <girng> that is good quality
<oprypin> bew, gotta go to input devices tho
<RX14> @bew my mic is actually too loud by default
<RX14> you need to put it at 46% to be sane
<FromGitter> <bew> ahah I know mine has a sound reduction, in the way that it removes other sounds but not my voice
<RX14> mmm
<FromGitter> <bew> maybe it's too efficient ?
<RX14> mine doesn't
<FromGitter> <bew> but in discord and other I don't have this problem
<RX14> interesting
<RX14> discord has some auto boost though
<RX14> it normalizes your mic a bit
<RX14> i think
<FromGitter> <bew> ah that would explain it
<RX14> i use a hyperx cloud
<RX14> very good headset
<RX14> basically indestructible, has almost audiophile audio quality which is rare in gaming headsets
<RX14> and the mic is nice
<RX14> and super comfortable
<FromGitter> <bew> looks good! I use corsair void rgb
<RX14> wow thats more expensive than my hyperx cloud lol
<FromGitter> <bew> really ? I remember having it at low price (not too high)
<RX14> it says £80 on amazon
<FromGitter> <bew> yeah it was < 100€
<FromGitter> <bew> by 'high' I though you were talking about 200-300 ^^
<RX14> nah
<RX14> i got my hyperx cloud for £55
<RX14> it usually goes for about £70 though
<RX14> honestly I don't recommend anything but the cloud lineup unless you go >€200
alex`` has quit [Quit: WeeChat 2.1]
<RX14> it's remarkable for the pricepoint
<FromGitter> <bew> good to know, I've bookmarked it if I need sth else one day
<RX14> cool
<RX14> hyperx should hire me as a salesman :)
<FromGitter> <bew> 😂 you could sell me anything, I don't know much in this field (but I always do lots of researches before throwing my money at anything)
<Vexatos> I'd have a thing or two to say about headphones, not headsets though
<RX14> Vexatos, didt you get clouds?
<RX14> or no because you never need the mic lol
<Vexatos> I did.
<RX14> Vexatos, did you return them?
<travis-ci> crystal-lang/crystal#19360bc (master - Fix linking to openssl (#5949)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/366589135
<DeBot> https://github.com/crystal-lang/crystal/pull/5949 (Fix linking to openssl)
<Vexatos> I did not, I'm very happy with them
<RX14> well
<RX14> i've sold clouds to 2 people then
<RX14> and got another to bookmarke them :)
<Vexatos> You also made me buy SM E10 in-ears
<RX14> lol
<RX14> for your sister though, and she liked them
<Vexatos> yup.
<FromGitter> <girng> i have JVC HARX500 Full-Size Headphones
<dom96> hrm, I've been hunting for some headphones
<dom96> I wonder if HyperX would work for me :)
<RX14> dom96, headphones or headset?
<FromGitter> <girng> black color, got em for 30.00 off amaazon. but they don't have microphone
<dom96> I don't really have much use for a mic
<dom96> might do in the future though
<RX14> hyperx clouds are bit too bulky to use outside too, if that bothers you
<RX14> I typically use iems outside
<RX14> dom96, if you can afford these they're probably the best at their price point for audio: https://eu.audio-technica.com/headphones/over-ear/ATH-M50x?sort=p.price&order=ASC
<RX14> and then if you need a mic you can use a modmic - or laptop or something
<dom96> The main things I look for are: comfort and noise cancellation.
<RX14> oh, i see
<dom96> Don't care about taking them outside
<dom96> So far I only ever bought the cheapest headphones I could find
<RX14> I don't worry about noise cancelling so it's harder for me to give recommendations
<dom96> My ears feel like they will fall off after 10 minutes of wear :)
<RX14> and yeah, cheap headphones aren't a good idea
<FromGitter> <girng> what is your budget. if looking for true noise cancellaton gonna be expensive..
<RX14> dom96, you work in a noisy environment?
<dom96> Not really, but I am living in uni accommodation right now
<dom96> Also, I am pretty sensitive to noise when I'm trying to concentrate (or sleep)
<RX14> so am I, but the noisiest thing is the server I keep in my room :)
<RX14> and I live on top of a nightclub
<Vexatos> did someone say noise cancellation
<Vexatos> or do you mean noise isolation
<RX14> Vexatos, go propagandize then
<Vexatos> I've got the HyperX Cloud II at home after RX14's recommendation, they're pretty good, but if you want to listen to music outside you'll likely want something a bit more compact and better-sounding
<Vexatos> soo, what do you want them for
<RX14> Vexatos, read the backlog?
<Vexatos> I did
<RX14> "Don't care about taking them outside"
<Vexatos> Hm
<Vexatos> Well then I'd also say HyperX Cloud
<Vexatos> or Cloud II
<RX14> but no noise cancelling
<Vexatos> nope
<RX14> cloud are isolating
<Vexatos> noise cancelling headsets are basically impossible to find
<Vexatos> noise-cancelling headphones are not very useful indoors
<Vexatos> they won't stop the noise of people talking
<RX14> honestly it depends what kind of noise dom96 is dealing with
<Vexatos> Active noise cancelling is only good for low-frequency noise, like plane or car or bus motors
<Vexatos> it does lower the volume of high-frequency noise as well, just not nearly as well
<dom96> yeah, I am probably more concerned about high-frequency
<Vexatos> You cannot cancel out those
<Vexatos> for that you'll need to go noise isolation, and that is impossible to be good at below €300
<dom96> yeah, so isolating is my best bet
<dom96> D:
<Vexatos> so either you spend money or I'd, once again, recommend the HyperX Cloud II as being "good enough in most cases"
<dom96> For that price I'd need to try it before purchasing
<RX14> dom96, honestly just put on music and you won't hear the noise :)
<Vexatos> especially if you are using the leather cups
<RX14> doesn't even have to be that loud for your brain to tune it out
<FromGitter> <bew> When I started studying in a very noisy environment the solution I found was to listen to (a bit loud) music, always the same (so that I can put the music in a background process of my brain and not focus on it)
<Vexatos> (it comes with two sets of cups)
<dom96> Yeah, I might try the HyperX anyway
<Vexatos> mic is detachable
<RX14> dom96, you can always return it
<RX14> amazon were very good at that
<RX14> well
<RX14> they did send me the wrong product
<Vexatos> but they are fairly big so you can't really use them outside, and they're really lacking if you care about sound quality
<Vexatos> they are "good enough" for most though
<Vexatos> and really damn cheap
<dom96> also, you live above a nightclub? That must be fun lol
<RX14> the clouds are fine for sound
<Vexatos> best you can find for under €100 for sure
<RX14> dom96, been in there once
<dom96> How do you sleep at night?
<RX14> i can sleep through a talking alarm clock 10cm from my face announcing the time every hour of the night
<RX14> my dad in literally another room couldn't sleep from it - i'm just a heavy sleeper
<RX14> but yeah hyperx cloud 1/2 are going to last you forever and have probably the best audio quality you're going to get for under 100 eur
<RX14> and the leatherette cups are great at sound isolation
<RX14> they're closed back too
<RX14> and they're super comfortable
<RX14> unless your ears are massive
<dom96> hehe
* dom96 adds to his Amazon wishlist
<RX14> the difference between cloud 1 and cloud 2 is basically the jack type
<FromGitter> <girng> when i create a macro, is it a global namespace?
<RX14> and if you use the cloud 2, don't use the soundcard box that comes with it
<RX14> @girng macro visibility is always like using `self.`
<Vexatos> The Cloud I has two TRS jacks, the Cloud II has a single TRRS jack
<dom96> According to Amazon Cloud 2's are 1.1kg :O
<dom96> That seems wrong
<FromGitter> <bew> @girng if you're in the global namespace, yes
<RX14> i assume thats the package
<RX14> dom96, it comes with a big box
<RX14> carry bag
<RX14> well the cloud 1 does anyway
<dom96> I see
<RX14> the cloud 1 has like everything you'd ever need
<RX14> even an airplane adapter lol
<RX14> also like 3 metres of extension cord
<Vexatos> All headphones still come with airplane TS adapters
<RX14> so you can go dancing around you room
<RX14> Vexatos, no they dont
<RX14> not here
<FromGitter> <girng> for example, if i defined `macro everything_mapping(a)`. now, can i use `everything_mapping`anyone in my code, or just under certain classes? i used it under two classes so far and they work. but i am not sure if other macros icreate will work inside `handle_connection` methods, for example
<RX14> @girng where did you define it?
<Vexatos> the Cloud II does not have that extension cord, the most of the length comes from aforementioned soundcard dongle you shouldn't use
<RX14> if it's at the top-level you can use it everywhere
<FromGitter> <girng> before MasterServer.new() (so, top level?)
<FromGitter> <girng> ok
<RX14> if you do `module/class/struct Foo; macro x; end; end` you use `Foo.x`
<FromGitter> <girng> awesome :D , global macro :D
<RX14> if it's top-level you can just call it anywhere
<RX14> Vexatos, hence cloud 1 is way better :)
<RX14> i regularly use the full cord length for dancing around alone :P
<FromGitter> <girng> thx for help brb dfood
<Vexatos> I don't think I wanted to know that
<RX14> pff
<RX14> no fun
<Vexatos> Wait
<Vexatos> I already knew that
greengriminal has joined #crystal-lang
<dom96> What's wrong with the soundcard dongle?
<Vexatos> it's worse than your on-board one
<Vexatos> Almost guaranteed
<RX14> dom96, it's meant to emulate surround
<RX14> it's a placebo
<RX14> it downmixes 7.1 to stereo in the dongle
<RX14> but don't bother because a sound engineer will definitely do a better job of that than you
<RX14> they can tweat the original miz balance for each specific number of channels by hand
<RX14> in games maybe it helps if the game is programmed badly
<RX14> but other than that just use your onboard sound
<FromGitter> <girng> rx14 do u have any background in VR headsets?
<RX14> nope
<RX14> i'm a student
<RX14> I don't actually play many games
<FromGitter> <girng> ic, just curious
<RX14> VR is expensive
qard has joined #crystal-lang
qard has quit [Ping timeout: 268 seconds]
greengriminal has quit [Quit: Leaving]
<FromGitter> <elorest> > @elorest just out of curiousity, what did you used for backend in before-mentioned screen featured in Nikola Motors NZT? Amber? ⏎ ⏎ @Sija I did use amber has I specifically built some of the features with my use case in mind. However, kemal would have worked fine too. Or even pure crystal.
<FromGitter> <Sija> sure, I just wondered did additional overhead was still acceptable in your use case
<RX14> abusing generics: https://carc.in/#/r/3vff
<RX14> abusing generics now without useless classes: https://carc.in/#/r/3vfk
<FromGitter> <Sija> that’s one sweet abuse you’ve done there
<RX14> i'm pretty proud of it
<Vexatos> Why is that code special?
<FromGitter> <girng> what is generics
<Vexatos> I don't see anything particularly abusive in there
<RX14> Vexatos, it uses a splatted generic
<Vexatos> All in all, it looks rather... generic to me :3
<RX14> most people dont use generics at all Vexatos
<Vexatos> In crystal?
<RX14> this is arbitrarily sized generic lists
<Vexatos> or in general
<FromGitter> <j8r> @girng read all of this https://crystal-lang.org/docs/ and you will be good :)
<Vexatos> Because I sure use them a lot
<RX14> Vexatos, most people don't write generic classes
<RX14> ofc they use them in code
<RX14> generic classes are pretty rare
<RX14> and splatted generic classes are even more rare
<RX14> because taking an arbitrarily sized list of generic params is abuse Vexatos
<Vexatos> Am I reading this wrong, or aren't you just iterating over a list gathered from generic varargs
<FromGitter> <girng> @j8r howu like my bookmarks? :D
<RX14> Vexatos, yes
<Vexatos> even java can do that sanely
<RX14> no it cant
<RX14> not without reflection
<FromGitter> <j8r> @girng I mean, in the docs there are already explanations about what generics are
<RX14> not without runtime errors
<RX14> Vexatos, in java you'd have to define a AEvent, BEvent and CEvent in a class hierarchy
<RX14> and put the base of that in a superclass of A, B, C
<RX14> and then raise in that methos
<RX14> here you get 100% safety, no runtime errors at all
<RX14> I'd love to be proven wrong
<Vexatos> well yes but all three could just be a Callable<?>
<RX14> but I don't think I will
<Vexatos> which is stdlib
<Vexatos> and even a functional interface
<RX14> so?
<RX14> doesnt help
<RX14> you also can't have a Callable<A, B>
<RX14> Vexatos, class B takes two entirely seperate call types
<FromGitter> <girng> @j8r ok le tme give u example, one scond
<RX14> AEvent and BEvent are not in a type hierarchy
<FromGitter> <j8r> devdocs search on the API + on the guide, sweet!
<FromGitter> <girng> @j8r look at generic example here, from docs: https://play.crystal-lang.org/#/r/3vg1 ⏎ ⏎ now, look at my example (same thing): https://play.crystal-lang.org/#/r/3vg0 ⏎ ⏎ i like my approach better, as the type is defined in the class, not line with a generic. [https://gitter.im/crystal-lang/crystal?at=5ad28ab76d7e07082bf5b726]
<FromGitter> <girng> what's the difference between those?
<Vexatos> RX14, I mean, in the end, everything in Java inherits Object
<Vexatos> if you mean that
<RX14> oh yeah
<RX14> there is that
<RX14> still not type safe Vexatos
<RX14> how would you call `.call` on an object
<FromGitter> <j8r> @girng if you have multiple types, like`String` and `Int`
<FromGitter> <girng> i can do the pipe operator then right, to allow different ones?
<FromGitter> <j8r> I give you an example
<Vexatos> RX14, with the way java generics work, that's right I guess
<Vexatos> you can only make it type safe if you pass the class along with the object
<FromGitter> <j8r> https://carc.in/#/r/3vgt
<FromGitter> <j8r> dumb example
<FromGitter> <j8r> sometimes it can be also done with macros
<RX14> Now here's something extra: https://carc.in/#/r/3vh9
<FromGitter> <girng> @j8r i see, that's pretty cool
<FromGitter> <girng> not sure if i ever need to use generics for my game server but at least i understand it more now
<FromGitter> <Sija> @RX14 that’s pretty damn close to `Hash(_, Object)`!
<RX14> it's hash(Class, Object) semantics
<RX14> it's Hash(Class, Object) semantics
<RX14> It should really be a module
<RX14> called ComponentCOntainer
<RX14> because really it's a component system
<RX14> s/module/class
<RX14> @Sija technically Hash(Class, Reference)
<FromGitter> <Sija> yep, I'll call you abuse wizard from now on!
<FromGitter> <girng> what am i?
<FromGitter> <Sija> grinch? ;)
pabs has quit [Ping timeout: 256 seconds]
<FromGitter> <girng> :(
<FromGitter> <Sija> it should be part of Crystal long time ago if u ask me
<RX14> meh
<FromGitter> <Sija> does your example plays well with GC?
<RX14> should do
<RX14> as in yes
<FromGitter> <Sija> @girng Sorry if I hurt your feelings, it just came to my mind looking at your avatar & nickname combination ;)
<FromGitter> <girng> @Sija no prob sir lol it's fine=]
<FromGitter> <Sija> `{% raise … unless T < Reference %}` could even be moved to `def put(extension : Value)` overload cleaning impl. a bit
<FromGitter> <bew> 👍
<FromGitter> <girng> wlcome back @bew
<RX14> @Sija oh yeah...
<RX14> @Sija i assume you mean extension : Reference
<RX14> not Value
<FromGitter> <Sija> nah, i meant `Value`, since the `Reference` is what you want?
<RX14> ...
DTZUZO has joined #crystal-lang
<FromGitter> <Sija> https://carc.in/#/r/3vhh
<RX14> if we want references we want to restrict to references
<RX14> nope
<RX14> simpler than that
<RX14> we don't use T
<RX14> in the forall T
<RX14> so we just do : Reference
<RX14> and remove the forall
<FromGitter> <Sija> ahh
<FromGitter> <Sija> you’re right
<RX14> well
<RX14> we arrived there together :)
<FromGitter> <Sija> mhh, nuffin’ like night hacking with fellow crystallers :)
<RX14> and works: https://carc.in/#/r/3vho