ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.34.0 | 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
zorp_ has quit [Ping timeout: 256 seconds]
cloaked1 has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
gangstacat has quit [Remote host closed the connection]
DTZUZU has quit [Quit: WeeChat 2.8]
gangstacat has joined #crystal-lang
chachasmooth has quit [Ping timeout: 256 seconds]
chachasmooth has joined #crystal-lang
yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
yxhuvud has joined #crystal-lang
chachasmooth has quit [Ping timeout: 246 seconds]
chachasmooth has joined #crystal-lang
_whitelogger has joined #crystal-lang
alexherbo2 has joined #crystal-lang
_whitelogger has joined #crystal-lang
_ht has joined #crystal-lang
renich has joined #crystal-lang
<FromGitter> <confact> I have made my privacy-focused analytics open-source, it is based on Lucky, coded in Crystal so it might interest you guys: https://github.com/kindmetrics/kindmetrics
<raz> confact: looks sweet at a glance but a demo app would be nice (perhaps free app on heroku?)
<FromGitter> <confact> raz: you can see a demo at https://kindmetrics.io :)
<FromGitter> <confact> my idea is to have it open source but pay for hosting it.
<raz> ohhh!
<raz> you should link that in the readme!
<FromGitter> <confact> raz: that will be fixed asap for sure!
<raz> i like it! looks neat. nice and simple
renich has quit [Quit: renich]
<raz> one small suggestion: when i hit the kindmetrics logo (top left) from the demo, it takes me to the login form
<raz> might be nicer to go back to the homepage instead, since at that point i'm unlikely to have an account already ;)
<FromGitter> <confact> raz, yea. Good feedback. I will try to figure a good way there. When logged in, you might not want to get to the homepage :)
<raz> true, it's a bit of a special case (only for the demo/new visitor flow). not a biggie, just something i noticed
<FromGitter> <confact> raz: yea, it would be good to have that. Thanks!
<FromGitter> <alex-lairan> @confact I am building a commercial project with Lucky too :) ⏎ ⏎ I think I will use kindmetrics <3 ⏎ ⏎ Crystal power ! [https://gitter.im/crystal-lang/crystal?at=5edb59574c9b0f060d49c774]
<jhass> oprypin: (bridge bot) ^ superfluous link for some reason
_ht has quit [Remote host closed the connection]
ht_ has joined #crystal-lang
ht_ is now known as _ht
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
deavmi has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
zorp_ has joined #crystal-lang
sorcus has quit [Quit: WeeChat 2.8]
sorcus has joined #crystal-lang
<FromGitter> <confact> @alex-lairan would love that, and hearing your feedback :)
<FromGitter> <evvo> Hello!
<FromGitter> <evvo> Does someone knows if I can overwrite a specific property setter in a constructor ? ⏎ For example ⏎ ⏎ ```class User ⏎ def initialize(@name, @username) ⏎ end ⏎ end``` ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5edb98efa91f120a6ce8b570]
<FromGitter> <asterite> just use name, then @name = ...
<FromGitter> <evvo> Yes, but I will have to write that in the initializer method
<FromGitter> <Blacksmoke16> so?
<FromGitter> <evvo> If possible, I wanted to be able to overload the "initializer's setter": ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5edba3c9a3a1b13679cf351b]
<FromGitter> <evvo> I will not have control over `TheUser` class
<FromGitter> <Blacksmoke16> `TheUser.new "1".to_i` :P
<FromGitter> <evvo> In that case, yeah :D
<FromGitter> <Blacksmoke16> yea idt this would work, cant even use a setter to set an ivar iirc
<FromGitter> <Blacksmoke16> since its indirect initialization
<FromGitter> <evvo> Yes, possible - I thought that if `initialize` is some sort of macro that generates such setters, maybe I would be able to overload it with my own setter
<FromGitter> <Blacksmoke16> naw`, initialize is just a normal method that gets called within the class method `.new`
<FromGitter> <Blacksmoke16> i.e. its like
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5edba5929da05a060a560ff4]
<FromGitter> <evvo> Yes, I was looking at that self.new in the documentation
darkstardev13 has joined #crystal-lang
duane has joined #crystal-lang
gangstacat has quit [Quit: Ĝis!]
duane has quit [Ping timeout: 260 seconds]
<oprypin> how can i find out whether a binary was built in release mode or not? if it helps, the binary in question is crystal compiler itself
<yxhuvud> (. use it to compile the compiler and time the result .)
<yxhuvud> I realize that is probably not the answer you wanted :D
<FromGitter> <Blacksmoke16> im assuming *after* its built? obs you could do `flag? :release` while its building tho
<jhass> oprypin: we totally should print this in crystal -v! wanna make a PR?
<jhass> if you have something you can compare to where you know, I guess filesize might be pretty telling
<oprypin> 🤔 good idea thanks
<oprypin> i dont want a PR 😬
<jhass> aww
<oprypin> ok no, that's not very telling https://bpa.st/J35A
<jhass> mmh, interesting
<oprypin> or maybe it is enough of a difference? i'd expect crystal.exe to be the release one, if any one is
<oprypin> the reason is i just forgot and it takes so long to build release from non-release 😅
<jhass> I mean I would expect it to grow a bit due to loop unrolling and inlining
<oprypin> jhass, but there's also code elimination
<jhass> yeah, but I suspect for the compiler that isn't happening too much
<jhass> it pretty much always needs all the code it has
<jhass> anyways, I consider my theory proven wrong, it's not as telling as I though
<oprypin> no i mean elimination of duplicate code across modules / obj files
<oprypin> since release is single-module
<jhass> ah, mhh
<oprypin> ( i dont really know that myself, but i think i read something like that in some recently bumped issue)
<jhass> gotta like your naming strategy btw :D
<oprypin> ...
<oprypin> look it kinda makes sense from the context of https://github.com/crystal-lang/crystal/wiki/Porting-to-Windows#using-windows-crystal-to-build-crystal but then it kinda got out of control
<jhass> (I usually have tmp.cr, test.cr and foo.cr in the same folder at the end of the day fwiw)
<oprypin> :D
<jhass> sometimes they get company by a test.c or the like
<oprypin> ok so who is HankAnderson? they just appeared out of nowhere and already having such deep knowledge. could it be someone from before? the name is not real btw, that's the name of a game character (also seen on the avatar)
<jhass> Maybe Julien? :D
<jhass> Nah, the writing style doesn't match
<yxhuvud> Hmm, where?
<jhass> the more interesting thing is that their GH profile exists since 2017 but was entirely silent of (public) activity until now
<oprypin> yxhuvud, both in github issues and forums
<yxhuvud> Can't recall havn't seen him but then I don't read the forum very often. *does*
<FromGitter> <wrq> Okay, so I've been looking into the case of HankAnderson, it's someone from the Rust community who clearly appreciates their anonymity
<FromGitter> <wrq> He's linked to Mike Perham's blog a number of times, the only personal data I've seen, though I am only looking at his forum posts. I don't think it's Mike though, the writing is different.
<jhass> how did you link to rust?
<FromGitter> <wrq> posts in this topic indicate at least passing familiarity in rust
<oprypin> woops i shouldnt initiate doxxing 😬
<jhass> Idk, that just shows they know rust
<jhass> we just want to send presents! *cougs*
<FromGitter> <wrq> not every rustling knows about perf profiling and overflow checks. Clearly, they're a well-versed programmer coming from somewhere.
<FromGitter> <wrq> Not meaning to doxx, I just am also curious.
<jhass> I almost suspected IEatReturnValues at first because they appeard just days after we banned, but their waaay to friendly
<jhass> and yeah, also way more skilled
<FromGitter> <Blacksmoke16> maybe the AI from the game has become sentient
<FromGitter> <wrq> I'm not very familiar with either the Crystal community nor the Rust community, afraid I can't be of much help. It just IS very curious that someone with that kind of know-how would prefer anonymity. Perhaps they don't want their workplace to know they'd like to work with different technologies or something
<jhass> or maybe they're just female, honestly ;)
<FromGitter> <wrq> ah, I feel exposed for having not considered that
<FromGitter> <wrq> entirely possible
<FromGitter> <wrq> Hank Anderson the character doesn't seem a character a female user would mask behind, to be fair
<jhass> can be, I know nothing about the game
<FromGitter> <wrq> I just skimmed a thing about it. grizzled detective experiences change of heart sorta guy.
<oprypin> i had watched a playthrough 😅
gangstacat has joined #crystal-lang
DTZUZU has joined #crystal-lang
<FromGitter> <oprypin> @naqvis @asterite thanks for your replies to https://gitter.im/crystal-lang/crystal?at=5ed5113bd137513704328c58 . i have found a way. ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ and indeed i see that `$1` expands to `$~.not_nil![1]`. and indeed it doesn't really answer anything for me (#9439) [https://gitter.im/crystal-lang/crystal?at=5edbda3bdaf4cf366ee6c4e0]
<DeBot> https://github.com/crystal-lang/crystal/issues/9439 ($? $~ don't seem to work on Windows)
<FromGitter> <watzon> What's the best way to check if two arrays have any common items?
<FromGitter> <watzon> I can think of a couple ways, but I'm wondering if there's a built in Enumerable or Iterable method that I'm missing
<FromGitter> <Blacksmoke16> `includes? && includes?`
<FromGitter> <Blacksmoke16> could union them and see if its in there
<FromGitter> <watzon> Well I'm comparing 2 arrays. I could do `arr1.any? { |v| arr2.includes?(v) }`.
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/Array.html#&(other:Array(U))forallU-instance-method
<FromGitter> <watzon> Just wondering if there's a better way
<FromGitter> <Blacksmoke16> this one
<FromGitter> <Blacksmoke16> have to benchmark it i guess
<FromGitter> <watzon> That's what I was looking for
<oprypin> it's a good method
<FromGitter> <watzon> My guess is that it would be slower because it's allocating a new array
<FromGitter> <watzon> But idk
<oprypin> watzon, yea how is O(N) slower than O(N^2)
<jhass> through magic! 🎊
<FromGitter> <watzon> Well maybe not slower, but would it not be less efficient memory wise?
<FromGitter> <evvo> @watzon , if there are too many elements, maybe you could keep track the common ones in a separate structure ?
<FromGitter> <watzon> It's actually a really small array, so I'm not terribly worried. Just asking more for curiosity
<FromGitter> <Blacksmoke16> two includes? might be fine as well then
<FromGitter> <Blacksmoke16> esp if you do the one that is more likely to *not* have the value first
<FromGitter> <watzon> Ahhh good point
zorp_ has quit [Ping timeout: 246 seconds]
<FromGitter> <watzon> How would you go about taking an existing regex, and adding a `^` to the beginning of it?
<FromGitter> <watzon> I want to accept a Regex, but make sure it always applies to the beginning of the string it's matching
<oprypin> watzon, `regex = /^#{regex}/`
<jhass> /\A#{regex}/
<FromGitter> <watzon> You can do that? Just interpolate a regex into another one?
<jhass> yup
<oprypin> yes \A is usually preferable unless you know you dont need that
<FromGitter> <watzon> Yeah true
<oprypin> >> regex = /foo|bar/; /^#{regex}/
<jhass> also careful with passing user input into the pattern compiler
<DeBot> oprypin: # => /^(?-imsx:foo|bar)/ - https://carc.in/#/r/981l
<jhass> or worse user controlled pattern to run on user controlled input
<FromGitter> <watzon> In this case it's not really user input, just developer input
_ht has quit [Remote host closed the connection]
<jhass> there's https://crystal-lang.org/api/0.34.0/String.html#starts_with?(re:Regex)-instance-method btw
<jhass> avoids allocating another regex
HumanGeek has joined #crystal-lang
Human_G33k has quit [Ping timeout: 265 seconds]
zorp_ has joined #crystal-lang
csaba has quit [Ping timeout: 256 seconds]
csaba has joined #crystal-lang
<oprypin> how can i list all Exception-derived types?
<FromGitter> <Blacksmoke16> Exception.all_subclasses?
<FromGitter> <Blacksmoke16> in a macro
<oprypin> thx
<oprypin> how can i check if an instance of a class responds_to without creating such an instance?
<FromGitter> <Blacksmoke16> compile time an option?
<oprypin> ye
<FromGitter> <Blacksmoke16> `.has_method?` might work
<FromGitter> <Blacksmoke16> not sure if it would include parent stuff tho
<oprypin> i need parent stuff
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/982h
<FromGitter> <Blacksmoke16> seems like that would work yea
<oprypin> thanks
darkstardev13 has quit [Remote host closed the connection]
<oprypin> also did this to be sure. `{% for c in Exception.all_subclasses %}p! {{c}}.allocate.responds_to?(:finalize);{% end %}`
<FromGitter> <Blacksmoke16> same result?
<oprypin> yea. no finalizes :)
<oprypin> alas, the search needs to continue
<FromGitter> <Blacksmoke16> could have did `{{pp Exception.all_subclasses.any? &.has_method?("finalize")}}` 😉
<oprypin> i wouldnt trust it enough