ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.21.1 | Fund Crystal's development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
Raimondi has quit [Quit: WeeChat 1.6-dev]
Raimondi has joined #crystal-lang
Raimondi has quit [Client Quit]
Raimondi has joined #crystal-lang
Raimondi has quit [Quit: WeeChat 1.6-dev]
<kodo[m]> Is there a way to force a struct to return falsy?
<kodo[m]> if foo = Thing.something and if Error then falsy
<kodo[m]> rather than just turning a nil on failure. my pet peeve with that is you never know why operation failed if you just return nil
<FromGitter> <fridgerator> raise an error?
<FromGitter> <fridgerator> / exception
<kodo[m]> meh I'm not a fan of exception handling
<kodo[m]> heh
<kodo[m]> > A contrasting view on the safety of exception handling was given by C.A.R Hoare in 1980, describing the Ada programming language as having "...a plethora of features and notational conventions, many of them unnecessary and some of them, like exception handling, even dangerous. [...] Do not allow this language in its present state to be used in applications where reliability is critical[...]. The next rocket to go
<kodo[m]> astray as a result of a programming language error may not be an exploratory space rocket on a harmless trip to Venus: It may be a nuclear warhead exploding over one of our own cities." [14]
<kodo[m]> I tried doing something like `if foo = Something.thing && foo.class != Error` but it complains about using variable name inside assignment
<kodo[m]> I guess I can just put the assignment on the line above the conditional
<kodo[m]> would be cool to have some assignment/conditional paradigm though
<FromGitter> <jwoertink> I have this C lib I'm trying to write a binding for. How would I write this in a crystal lib?
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58db0d1fad849bcf422c1cb7]
<FromGitter> <jwoertink> actually, what I really care about is that `MIX_DEFAULT_FORMAT`. How I would access that from the lib
dzv has quit [Ping timeout: 240 seconds]
dzv has joined #crystal-lang
<Renich> Hey, How do I convert a Regex::MatchData to a string
* Renich tried .to_s and it's not working
<Renich> Ah, found it: try &.[1]
<Renich> pretty weird
* Renich is reading the manual
<havenwood> Renich: "Crystal".match(/[p-s]/).not_nil![0] #=> "r"
<Renich> havenwood: ah, that's much better
<Renich> havenwood: I think you meant [1]
A124 has quit [Ping timeout: 260 seconds]
<Renich> I am getting a compile time error; I dunno why: https://gist.github.com/renich/35b33a557a3f73610a81f76b51e55590
snsei has joined #crystal-lang
<Renich> Here's the error with trace enabled: https://gist.github.com/renich/ea1e6b7c8b077d7b4777ed62c4ace9e4
<FromGitter> <jwoertink> How do I pass a String to a function that is looking for a `Char*`?
A124 has joined #crystal-lang
<FromGitter> <mjago> @jwoertink https://gist.github.com/mjago/e30b72ad160cee2e3f9f8c04dd5e4b00 should work?
<FromGitter> <jwoertink> hmm
<FromGitter> <jwoertink> I get an error mentioning that the c lib function is expecting a Pointer Char and not a String
<FromGitter> <jwoertink> ```code paste, see link```
<FromGitter> <mjago> Would need to see lib declaration
<FromGitter> <jwoertink> `fun load_wav = Mix_LoadWAV(file : Char*) : Chunk*`
<FromGitter> <mjago> ``````
<FromGitter> <jwoertink> ohhh... that might be it. I'll try
<FromGitter> <jwoertink> damn....
<FromGitter> <jwoertink> Well, I get a new error, so I guess that's good
<FromGitter> <mjago> he he
<FromGitter> <jwoertink> thanks!
<FromGitter> <mjago> @jwoertink you doing audio stuff? I’ve written a few audio bindings - libao, libsoundfile, libmpg123, libtaglib
<FromGitter> <jwoertink> I'm trying to get SDL2_Mixer in to sdl.cr
<FromGitter> <mjago> ah cool
<FromGitter> <jwoertink> Now I get `ld: symbol(s) not found for architecture x86_64` so I guess I'm missing something here
<FromGitter> <mjago> which symbol(s)
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58db2eb5b52518ed4dba0a34]
<FromGitter> <mjago> have you @[Link(“mixer object file name")]
<FromGitter> <mjago> hmmm its not SDL_Mixer is it? (I’m not familiar with SDL)
<FromGitter> <jwoertink> SDL_Mixer is the 1.0 version. I have 2.0 installed through `brew install sdl2_mixer` which also requires a bunch of options for support with flac, mp3, etc...
<FromGitter> <mjago> might still use SDL_mixer for object file names - worth a try
<FromGitter> <mjago> *name
<FromGitter> <jwoertink> `ld: library not found for -lSDL_mixer`
<FromGitter> <mjago> k
<FromGitter> <jwoertink> hmm
<FromGitter> <jwoertink> Looks like the sample boots if I remove https://github.com/jwoertink/sdl.cr/blob/audio/samples/21_sound_and_effects.cr#L11
<FromGitter> <mjago> there are references to ```SDL::Mixer``` in there
<FromGitter> <jwoertink> yup. Everything else seems ok. It's just that one line that borks it
Raimondi has joined #crystal-lang
<kodo[m]> Is there a way to get line number for logger?
A124 has quit [Ping timeout: 240 seconds]
snsei has quit [Remote host closed the connection]
<crystal-gh> [crystal] bcardiff opened pull request #4208: Allow Iterator.stop to be used inside Iterator.of block (master...fix/iterator-of-stop) https://git.io/vS3JB
<kodo[m]> you
<kodo[m]> doh
<kodo[m]> damn enter key
RX14 has quit [Ping timeout: 240 seconds]
RX14 has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
<jhass> so we can no longer pass nil in place of a null pointer?
<jhass> nvm something else is broken
olek_poz has joined #crystal-lang
mark_66 has joined #crystal-lang
Qchmqs has joined #crystal-lang
bjz has joined #crystal-lang
Raimondi has quit [Remote host closed the connection]
Raimondi has joined #crystal-lang
olek_poz has quit [Ping timeout: 260 seconds]
gloscombe has joined #crystal-lang
olek_poz has joined #crystal-lang
gewo has joined #crystal-lang
gloscomb1 has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 268 seconds]
splitty_ has quit [Ping timeout: 260 seconds]
splitty_ has joined #crystal-lang
<crystal-gh> [crystal] huacnlee opened pull request #4210: Add `HTTP::Client.put_form`, same as post_form. (master...feature/http-client-put-form) https://git.io/vS3Pb
<crystal-gh> [crystal] huacnlee closed pull request #4210: Add `HTTP::Client.put_form`, same as post_form. (master...feature/http-client-put-form) https://git.io/vS3Pb
raz has left #crystal-lang ["*fump*"]
bjz_ has quit [Quit: Textual IRC Client: www.textualapp.com]
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
gloscombe has quit [Quit: leaving]
snsei has joined #crystal-lang
Raimondi has quit [Quit: WeeChat 1.6-dev]
gewo has quit [Ping timeout: 240 seconds]
snsei has quit [Ping timeout: 246 seconds]
olek_poz has quit [Ping timeout: 260 seconds]
<FromGitter> <azzuwan> Hi guys I get undefined reference to `SSL_library_init' when trying the http server example
<FromGitter> <azzuwan> How can I remedy that
<FromGitter> <sdogruyol> be sure to have libssl on your system
<FromGitter> <azzuwan> @sdogruyol I just verified that libssl is present.
<FromGitter> <azzuwan> Is there any compilation flag I need to use to explicitly tell the linker?
<FromGitter> <KCreate> What OS are you running?
<FromGitter> <azzuwan> It's Deepin Linux but it is really a Debian 8 underneath
<FromGitter> <KCreate> Could you post the complete output of the compiler?
<FromGitter> <fridgerator> do you have libssl-dev also?
<FromGitter> <KCreate> Leaving this here in case it's helping to resolve the issue: https://github.com/crystal-lang/crystal/wiki/All-required-libraries
<FromGitter> <fridgerator> yeah I usually end up installing all of those as well
<FromGitter> <azzuwan> apt-get tells me I have the latest version
<FromGitter> <azzuwan> Deepin faithfully follow debian directory structure
<FromGitter> <azzuwan> I'm going to find a real debian instance and try it on there
Raimondi has joined #crystal-lang
olek_poz has joined #crystal-lang
<FromGitter> <azzuwan> Okay it is working on on a fresh Debian 8 instance
<FromGitter> <azzuwan> The difference is in the libssl version
<FromGitter> <azzuwan> Debian 8 is using libssl1.0.0
<FromGitter> <azzuwan> Deepin is using libssl1.1.0
mark_66 has quit [Remote host closed the connection]
<BlaXpirit> azzuwan, well that's crazy, if even Arch has 1.0.2
<kodo[m]> multilib/lib32-openssl 1:1.0.2.k-1 [installed]
<kodo[m]> core/openssl 1.0.2.k-1 [installed] ... same diff
<kodo[m]> deepin y u so bleedin?
<kodo[m]> yeah arch has 1.1 but it's in testing repo
<FromGitter> <azzuwan> Hey guys interesting. I'm downgrading the libssl see if that works
<kodo[m]> if something is in arch testing u know it's unstable heh
<FromGitter> <azzuwan> <kodo[m]> deepin is bleedin indeed :D
Qchmqs has quit [Quit: Konversation terminated!]
<FromGitter> <azzuwan> <kodo[m]> You are right I have some unstable repo enabled. I have no idea. It must be one of the previous install scripts
<FromGitter> <azzuwan> I'm using libssl1.0.0 and it's working fine yeah
<adam12> Has anyone linked Lua into a Crystal project?
<adam12> All I've found is this which is mostly quiet. https://github.com/pine/crystal-lua
<crystal-gh> [crystal] bcardiff pushed 1 new commit to master: https://git.io/vSsc6
<crystal-gh> crystal/master 27e697d Brian J. Cardiff: Docs update Set#merge! to Set#concat. fixes #4211
balduin has joined #crystal-lang
Renich has quit [Remote host closed the connection]
<travis-ci> crystal-lang/crystal#27e697d (master - Docs update Set#merge! to Set#concat. fixes #4211): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/216416362
<DeBot> https://github.com/crystal-lang/crystal/issues/4211 (undefined method 'merge!' for Set)
<FromGitter> <samueleaton> I'll just leave this here. 👍 ://stackoverflow.com/questions/43100378/how-to-modify-the-httpresponse-after-it-has-been-written-to
<FromGitter> <samueleaton> http
<vegai_> do any of you develop on NixOS?
<vegai_> I'm swimming in this thing for the first time, and I'm a bit confused on how to make arbitrary projects (like Crystal) see all the libs Nix has hidden in non-fhs places
<FromGitter> <fridgerator> never heard of it
<FromGitter> <fridgerator> @samueleaton `HTTP::Server::Response#write` ?
<vegai_> it's a Linux with an .... interesting .... package manager
<FromGitter> <fridgerator> @vegai_ interesting
<vegai_> they have packaged crystal, though. I could just use that
<vegai_> would be fun to follow git master too, though
gloscomb1 has quit [Ping timeout: 268 seconds]
<bmcginty> vegai_: I think the -l and -L options with the --link-flags will do what you want. Using -L/path/containing/library _should? do it...
<FromGitter> <samueleaton> @fridgerator I want to modify the existing HTML content in the response body before it is sent to the client
<FromGitter> <samueleaton> Based on this kemal issue: https://github.com/kemalcr/kemal/issues/343
olek_poz has quit [Ping timeout: 260 seconds]
<FromGitter> <fridgerator> ah
<FromGitter> <crisward> @samueleaton I asked this a while ago, I wanted to write middleware which modified the output. However I was told that the output is write only because it's a pipe - so it would need to buffered to be modifiable and I believe it's streamed, though I could be wrong.
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
kragniz has quit [Ping timeout: 258 seconds]
kragniz has joined #crystal-lang
bjz has joined #crystal-lang
olek_poz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
fazibear has joined #crystal-lang
dzv has quit [Ping timeout: 258 seconds]
dzv has joined #crystal-lang
<FromGitter> <N0r1x> Hey hello, I'm trying to use the tcp socket standard library class and the << operator doesn't quite work like I think it would (i.e like the cout << thing in c++): I'm making a irc-client for fun and I get a response from the server if I use puts <String> but not with the << operator
<FromGitter> <N0r1x> Is this me being an idiot and not getting it (quite likely) or is there something wrong? If it's me being an idiot I could maybe add a more detailed doc
<FromGitter> <fridgerator> would help if I could, but i'm not familiar
fazibear has quit [Ping timeout: 240 seconds]
olek_poz has quit [Ping timeout: 260 seconds]
sz0 has joined #crystal-lang