ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.33.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
<FromGitter> <drum445> db open works perfectly, it just can't reconnect if the db connection drops and the retry time/attempts have been exceeded
<FromGitter> <drum445> I think my `select x from dual` works for now, bit crap but hey ho
<FromGitter> <Blacksmoke16> Right, that makes sense no?
<FromGitter> <drum445> makes perfect sense
<FromGitter> <drum445> ruby's mysql lib had a reconnect=true param, where it would eventually get the connection back
<FromGitter> <drum445> I'm just mimicking that here really
ur5us has joined #crystal-lang
DTZUZU2 has joined #crystal-lang
ur5us has quit [Ping timeout: 256 seconds]
DTZUZU has quit [Ping timeout: 256 seconds]
<FromGitter> <bcardiff> @blal
<FromGitter> <Blacksmoke16> yes?
<FromGitter> <bcardiff> regarding the nightly, we are stuck until there is a new release on shards. we are aware of that :-)
<FromGitter> <Blacksmoke16> πŸ‘ gotcha
<FromGitter> <bcardiff> we wanted to be have a new version but now, but the last week were a bit hectic.
<FromGitter> <bcardiff> meanwhile most of the ecosystem is check and PRs for some frameworks and libs will be sent ones we have nightlies.
<FromGitter> <Blacksmoke16> nice, ill have to check my stuff out in the AM then, didnt realize nightlies werent building
<FromGitter> <bcardiff> Thanks for the headsup. I was surprised no one else complained :-P
<FromGitter> <Blacksmoke16> i know i didnt notice, not something i check on often, i imagine others are in the same boat
<FromGitter> <bcardiff> I'll try to comunicate better or create an issue next time. I've been aware since every night I got the broken nightly build ¬¬
<FromGitter> <Blacksmoke16> i dont suppose some badge or something could be added to readme?
<FromGitter> <Blacksmoke16> to make these things a bit more visible?
<FromGitter> <bcardiff> badge or a public dashboard of activity for other metrics. ⏎ for workflow badges we need this https://ideas.circleci.com/ideas/CCI-I-322 . But maybe there is something to work on that, it triggers some ideas. thanks
<FromGitter> <Blacksmoke16> maybe there is a docker hub approach?
<FromGitter> <Blacksmoke16> :shrug:
_whitelogger has joined #crystal-lang
alexherbo2 has joined #crystal-lang
_whitelogger has joined #crystal-lang
rohitpaulk has joined #crystal-lang
f1refly has quit [Ping timeout: 256 seconds]
_whitelogger has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
ur5us has joined #crystal-lang
Human_G33k has joined #crystal-lang
HumanG33k has quit [Ping timeout: 250 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
_ht has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
ur5us has quit [Ping timeout: 240 seconds]
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 265 seconds]
<FromGitter> <confact> I have two different classes inheriting from same base class. And i have some others inheriting from base class as well. when i try to pass only those two classes i get this error: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e807aad8266bd21295d06b1]
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
dannyAAM has quit [Client Quit]
dannyAAM has joined #crystal-lang
dannyAAM has quit [Remote host closed the connection]
dannyAAM has joined #crystal-lang
dannyAAM has quit [Remote host closed the connection]
dannyAAM has joined #crystal-lang
dannyAAM has quit [Remote host closed the connection]
dannyAAM has joined #crystal-lang
dannyAAM has quit [Remote host closed the connection]
dannyAAM has joined #crystal-lang
dannyAAM has quit [Remote host closed the connection]
dannyAAM has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
alexherbo29 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 250 seconds]
alexherbo29 is now known as alexherbo2
dannyAAM has quit [Remote host closed the connection]
dannyAAM has joined #crystal-lang
alexherbo2 has quit [Read error: Connection reset by peer]
alexherbo2 has joined #crystal-lang
dannyAAM has quit [Remote host closed the connection]
dannyAAM has joined #crystal-lang
dannyAAM has quit [Remote host closed the connection]
dannyAAM has joined #crystal-lang
dannyAAM has quit [Remote host closed the connection]
dannyAAM has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
<oprypin> Stephanie, ok, apparently my amateur attempt to define personalityfunction once per module also failed. i'm getting `I-O-5858F-ileD-escriptor43.o : error LNK2005: "void * `RTTI Type Descriptor'" (??_R0PEAX@8) already defined in _main.o`
<oprypin> wondering if i should pivot towards ensuring it has a different name or maybe it *should* be defined once after all
<Stephanie> it should probably be defined in main as the constant and in non-main modules as external
<Stephanie> see the external_constant method
<Stephanie> basically, the logic would be, check if the current module has it defined, if not, check if we're the main module, if not define it in the main module and add it as an external constant
<oprypin> hold up. it might be a different issue
<oprypin> it never occured to me to actually try to search for `??_R0PEAX@8` in crystal source code. but it's there, wtf
<Stephanie> oh yeah
<Stephanie> of course it is
<Stephanie> sorry
<Stephanie> i thought you found that
<oprypin> Stephanie, so is it a different issue or not
<Stephanie> i was talking about the void_ptr_type_descriptor and void_ptr_throwinfo methods
<Stephanie> it's those two which are the problem
<oprypin> ko thanks
<Stephanie> they need to be modifed to define in the main mod and add externals in the other mods
<Stephanie> i thought you'd linked that file whoops
<Stephanie> i remember all the cursed constants i had to deal with in this code :(
<oprypin> 😱
<oprypin> what, it actually worked
<Stephanie> what did you do?
<oprypin> @main_mod.globals[void_ptr_type_descriptor_name]? || begin < OLD CODE HERE >
<oprypin> external_constant(llvm_context.void_pointer, void_ptr_type_descriptor_name)
<oprypin> @llvm_mod.globals[void_ptr_type_descriptor_name]? || begin
<Stephanie> what if llvm_mod == main_mod?
<oprypin> πŸ€”
<Stephanie> --single-module thats always the case
<oprypin> welp thankfully `external_constant` starts with `@llvm_mod.globals[name]?`
<Stephanie> ah
<Stephanie> nice
<Stephanie> i'd make a comment still
<oprypin> i wonder if it should just be defined unconditionally in main
<Stephanie> it might be neater like that yeah
<Stephanie> if we assume every program uses exceptions
<Stephanie> well
<Stephanie> no yeah
<Stephanie> its fine
<Stephanie> if you weren't targeting msvc you'd use a different triple
<FromGitter> <Blacksmoke16> is there a reason `divisible_by?` isnt defined on `Number`?
<FromGitter> <Blacksmoke16> related, `4.1.divmod(0.1) # => {40.0, 0.09999999999999964}` thats not really correct
<oprypin> Blacksmoke16, this code is exactly equivalent (i.e. will generate the exact same executable) but is more clear:
<oprypin> `4.0999999999999996447286321199499070644378662109375.divmod(0.1)`
<FromGitter> <Blacksmoke16> hm right, its a float so it really isnt exactly 4.1
<oprypin> so then, is 4.1 divisible by 0.1? you tell me
<FromGitter> <Blacksmoke16> ruby has the same output, so i guess the answer is apparently not :p
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
<xyhuvud> I think most definitions of what a divisor is simply define them as integers.
<FromGitter> <drum445> Hi all, I have an array of json strings, I'm trying to turn into an array of objects, how can I get this to run please? https://play.crystal-lang.org/#/r/8se7
<FromGitter> <drum445> Please note that I can't get around the fact it's an array of json objects
<FromGitter> <Blacksmoke16> you're calling `.to_json` on the objects twice
<FromGitter> <Blacksmoke16> once for each obj, then once again on the array
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/8seh
<FromGitter> <drum445> cheers, I was trying to shoe-horn it into existing code, I'll stop being lazy and write it properly. Thanks
<FromGitter> <Blacksmoke16> np
deavmi has joined #crystal-lang
<deavmi> Little question, what langauge structure is being used on the Kemal documentation when they do `route "/"` followed by the `do` keyword: https://kemalcr.com/guide/
<deavmi> Tryna figure it out and can't find it in the docs?
<deavmi> Thanks
<deavmi> Thanks, tried it out, makes sense
DTZUZU2 has quit [Quit: WeeChat 2.7]
<FromGitter> <Blacksmoke16> πŸ‘
DTZUZU has joined #crystal-lang
<deavmi> Looking at kemal's docs, do they have an actual API page or just examples because I wanna see what argument gets passed in when a block is being passed in that accepts an argument
<deavmi> But their site just shows snippets of stuff and doesn't document it all
<FromGitter> <Blacksmoke16> you mean like when the route is like
<FromGitter> <Blacksmoke16> ```get "/foo" do |ctx| ⏎ # what is ctx? ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5e80cca9770a892bfb1b7a8c]
<deavmi> yes
<deavmi> Only found examples of things living inside of it
<deavmi> Not API docs on it tho
<deavmi> THanks
_whitelogger has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
<Stephanie> pkg-config is wonderful and also the spawn of satan
tankf33der has joined #crystal-lang
<tankf33der> o/
<FromGitter> <Blacksmoke16> o/
gangstacat has quit [Quit: Ĝis!]
<deavmi> I'm getting `Error: undefined method 'INET' for Socket::Family.class` when trying to access the INET enum of Family in Socket. ANy advice on how to do that properly, syntax wise.
<deavmi> I've been doing Socket::Family.INET
<FromGitter> <Blacksmoke16> `::INET`
<FromGitter> <Blacksmoke16> assuming its a constant?
<deavmi> Yeah
<deavmi> Ah
<FromGitter> <Blacksmoke16> `Socket::Family::INET`
<deavmi> Ah.
<FromGitter> <Blacksmoke16> or `:inet`
<deavmi> Difference between `.` and `:` in this case then?
<FromGitter> <Blacksmoke16> `.` would be calling a method called `INET`
<deavmi> Ah okay
<FromGitter> <Blacksmoke16> `::` is just how you access a namespace/constant/enum member
<deavmi> I thought it would be along those lines.
<deavmi> And thought :: was a namespace indicator
<deavmi> So I would assume if class B is nested in class A then to get to class B I would do A::B
<FromGitter> <Blacksmoke16> right
<deavmi> ANd then whatever I want to do on B from there onwards
<deavmi> Awesome, thanks
<FromGitter> <Blacksmoke16> right, which could be another type or a constant
<deavmi> ANd because enums are a type of namespacer theselves I must use :: in this case as you have shown
<FromGitter> <Blacksmoke16> well in this case the enum is `Family`
<deavmi> Yes
<deavmi> Hence Socket::Family
<FromGitter> <Blacksmoke16> and enum members are just constants
<deavmi> Got you
<deavmi> I see I see
<deavmi> Thanks
ur5us has joined #crystal-lang
_ht has quit [Quit: _ht]
travis-ci has joined #crystal-lang
<travis-ci> crystal-lang/crystal#c28a11e (master - Merge pull request #8969 from crystal-lang/bug/pass-proc-t-to-proc-nil): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/668481798
travis-ci has left #crystal-lang [#crystal-lang]
<DeBot> https://github.com/crystal-lang/crystal/pull/8969 (Compiler: let Proc(T) pass a restriction of Proc(Nil))
gangstacat has joined #crystal-lang
Human_G33k has quit [Read error: Connection reset by peer]
<FromGitter> <3n-k1> Noob question, how do I downcast?
<FromGitter> <tenebrousedge> like `to_i8` ?
<FromGitter> <3n-k1> I have classes Foo and Bar, Bar inherits from Foo
<FromGitter> <3n-k1> I want to downcast an isntance of Bar to Foo
<FromGitter> <asterite> foo.as(Bar)
<FromGitter> <3n-k1> ah, thank you
<FromGitter> <3n-k1> Am I using hash literals wrong? This code errors with "Unexpected token: =>" ⏎ ⏎ ```vermillionInit {"/" => ->indexview(HTTP::Request)}``` [https://gitter.im/crystal-lang/crystal?at=5e81271eea686a4bbabd0b96]
<FromGitter> <Blacksmoke16> add some ()
<FromGitter> <Blacksmoke16> `vermillionInit({"/" => ->indexview(HTTP::Request)})`
<FromGitter> <Blacksmoke16> also minor, but method names should be `snake_case`
<FromGitter> <3n-k1> ah, thank you :)
<FromGitter> <Blacksmoke16> its a limitation in the type grammar
<FromGitter> <Blacksmoke16> > This is because Crystal parses method_call { as passing a block to the method call, so it's expecting a block and not a tuple or a hash.
<FromGitter> <3n-k1> ahhh that's interesting
<FromGitter> <Blacksmoke16> heres a question, what do you think is the better design?
<FromGitter> <Blacksmoke16> ```code paste, see link``` ⏎ ⏎ In this case, when using the annotation on a class/struct I'm able to give a compile time error that the `Range` constraint cannot be used with `Bool` properties. [https://gitter.im/crystal-lang/crystal?at=5e813247ee51f444372dde04]
<FromGitter> <Blacksmoke16> however, if you were to use it manually like `AVD.validator.validate false, [AVD::Constraints::NotBlank.new]`, I'm not able to provide the same compile time messaging
<FromGitter> <Blacksmoke16> so, should it noop, or result in some violation saying like `"This value should be a valid Time or Number"`?
<FromGitter> <Blacksmoke16> if that given constraint does not support the type of the value
ur5us has quit [Ping timeout: 240 seconds]