jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.28.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
DTZUZO has quit [Ping timeout: 255 seconds]
wmoxam_ has quit [Ping timeout: 245 seconds]
moei has quit [Ping timeout: 252 seconds]
_whitelogger has joined #crystal-lang
<FromGitter> <jwoertink> I'm running a SQL query that returns `DB::ExecResult`. Anyone know how to get the results from that thing? It seems to be a `record`, but I'm not seeing how to get the actual data back from that
<FromGitter> <jwoertink> it's returning this thing https://github.com/crystal-lang/crystal-db/blob/master/src/db.cr#L80
hightower3 has joined #crystal-lang
waheedi has quit [Quit: waheedi]
<FromGitter> <jwoertink> nevermind, went a different route
<FromGitter> <asterite> I guess `result.rows_affected`, `result.last_insert_id` and so on
<FromGitter> <redcodefinal> Hey all, was wondering if anyone had an idea how to fix this issue with C Bindings? I'm trying to bind sunvox's library to crystal, and I'm running into an issue where it can't seem to find `sv_load_dll`, although it is defined. I used crystal_lib to make the binding. https://forum.crystal-lang.org/t/c-bindings-help-trying-to-port-sunvox-library
<FromGitter> <redcodefinal> These are the bindings -> https://github.com/redcodefinal/sunshine/blob/master/src/sunshine.cr
<FromGitter> <redcodefinal> Compiling with clang llvm works just fine as well.
alexherbo28 has joined #crystal-lang
lucasb has quit [Quit: Connection closed for inactivity]
alexherbo2 has quit [Ping timeout: 248 seconds]
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 245 seconds]
waheedi has joined #crystal-lang
<jeremycw> Is it possible to return a nilable class var as non-nilable?
<jeremycw> I've got something along the lines of: def self.foo; raise "Error" unless @@foo; return @@foo; end
<FromGitter> <bew> sure, if you're sure it won't be nil, do `@some_var.not_nil!` (if it's actually nil an error will be raised)
<jeremycw> make
<jeremycw> ah, great. that worked, thanks.
rohitpaulk has joined #crystal-lang
waheedi has quit [Quit: waheedi]
rohitpaulk has quit [Ping timeout: 246 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
hightower3 has quit [Ping timeout: 250 seconds]
<FromGitter> <Blacksmoke16> `def self.foo; (f = @@foo) ? f : raise "Error"; end` that might work as well
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/6va6 @jeremycw
jeremycw has quit [Ping timeout: 246 seconds]
<FromGitter> <Blacksmoke16> if you care about what happens if it *is* nil, then this is nice as you can do that
<FromGitter> <Blacksmoke16> otherwise `.not_nil!` is fine if you just want to tell the compiler something you know wont be nil, wont be nil
devil_tux has quit [Quit: Lost terminal]
moei has quit [Quit: Leaving...]
dkowis has quit [Quit: lol]
dkowis has joined #crystal-lang
straight-shoota has quit [Ping timeout: 246 seconds]
<FromGitter> <dscottboggs_gitlab> @Blacksmoke16 why not `def self.foo; @@foo || raise "some message"; end`?
<FromGitter> <bew> both works, but there is the case where `@@foo` is `false`, which should not raise (which raise with your implementations)
<FromGitter> <dscottboggs_gitlab> true, but only in the case where @@foo could be boolean
<FromGitter> <bew> yes
<FromGitter> <Blacksmoke16> ah true :/
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/6vaf
<FromGitter> <Blacksmoke16> easy fix, but yea
<FromGitter> <dscottboggs_gitlab> I still don't get why you're using the ternary over `||`
<FromGitter> <Blacksmoke16> shh :)
<FromGitter> <dscottboggs_gitlab> heh. sry
<FromGitter> <Blacksmoke16> because it allows for the truthy part of it to know f is not nilable
<FromGitter> <Blacksmoke16> same idea as like `if val = @@val`
<FromGitter> <dscottboggs_gitlab> oh i see
<FromGitter> <dscottboggs_gitlab> I don't think that would matter in this case? Because `nil || raise` is not nil
<FromGitter> <Blacksmoke16> yea prob not, depends on specific use case
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <watzon> Just for fun I just used `Cadmium` to analyze the full text of Harry Potter and the Philosopher's Stone
<FromGitter> <watzon> I am nerding the f*ck out right now lol
<FromGitter> <dscottboggs_gitlab> hell yeah that's really cool
<FromGitter> <dscottboggs_gitlab> what's a Flesch score?
<FromGitter> <dscottboggs_gitlab> also what's your ZSH theme? I really like itk
* FromGitter * dscottboggs_gitlab looks up Cadmium... ⏎ ⏎ Oh...shit.... 😀
<FromGitter> <watzon> Fleisch: "Flesch reading ease of the text sample. A higher score indicates text that is easier to read. The score is on a 100-point scale, and a score of 60-70 is regarded as optimal for ordinary text."
<FromGitter> <dscottboggs_gitlab> interesting
<FromGitter> <watzon> I'm pretty proud of Cadmium so far. Still has a long way to go, but I'm working hard