ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.19.4 | Fund Crystals 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
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
j2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
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…]
<crystal-gh> [crystal] samueleaton opened pull request #3537: Change shard repo url (master...shard-repo-url) https://git.io/vX63I
<FromGitter> <samueleaton> I've installed Crystal and Shards on my machine from github and put both executables in my PATH... but when trying to run a crystal app it doesn't know where to look for dependencies. Is there something I need to set in my project to tell crystal where dependencies are installed?
bjz_ has joined #crystal-lang
<FromGitter> <jwoertink> Did you run shards install?
<FromGitter> <samueleaton> yeah. installation works great. its just when I try to run the app, it doesn't know where to find them.
<FromGitter> <jwoertink> You show the deps in .shards and libs folders?
<crystal-gh> [crystal] bcardiff closed pull request #3537: Change shard repo url (master...shard-repo-url) https://git.io/vX63I
<FromGitter> <jwoertink> Then use require "whatever"?
<FromGitter> <cjgajard> @samueleaton what it your output for `crystal env` ?
<FromGitter> <samueleaton> @jwoertink yeah. there is no problem on that front.
<FromGitter> <samueleaton> @cjgajard ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5827cea8e097df7575a3bb00]
<FromGitter> <jwoertink> Hmm weird
<FromGitter> <cjgajard> my CRYSTAL_PATH is "/home/cjgajardo/github/crystal/src:libs:lib"
<FromGitter> <cjgajard> you need add lib or libs to you CRYSTAL_PATH
<FromGitter> <samueleaton> where is the CRYSTAL_PATH derived?
<FromGitter> <cjgajard> as asterite answered in #3535 you need to use bin/crystal instead of .build/crystal
<FromGitter> <samueleaton> Thats looking like the prob heehee ⏎ ⏎ ```/Users/same/.bin/crystal -> /Users/same/dev/github/crystal/.build/crystal``` [https://gitter.im/crystal-lang/crystal?at=5827d010c2f2cf72750306ca]
<FromGitter> <samueleaton> Dangit. I update my symlink, rebooted terminal, and still same prob. 😔
<FromGitter> <cjgajard> what `/Users/same/.bin/crystal`is? Shouldn't it be `/Users/same/dev/github/crystal/bin/crystal`?
<FromGitter> <samueleaton> Thats a folder in my PATH. I symlink that to my binaries.
<FromGitter> <samueleaton> ```$ which crystal ⏎ /Users/same/.bin/crystal``` [https://gitter.im/crystal-lang/crystal?at=5827d151df5ae966454cb8b3]
<FromGitter> <samueleaton> I figured out the problem!! I had run `make std_spec` earlier to run the specs in crystal and somewhere when running specs is resets the CRYSTAL_PATH. I just had to do `make` again and all is good. :smile:
<travis-ci> crystal-lang/crystal#8717b32 (master - Change shard repo url (#3537)): The build was broken. https://travis-ci.org/crystal-lang/crystal/builds/175413825
snsei has joined #crystal-lang
<crystal-gh> [crystal] tbrand opened pull request #3538: `crystal build` without spepecified program files (master...feature-build-cmd) https://git.io/vX6Gp
snsei has quit [Ping timeout: 258 seconds]
akwiatkowski has joined #crystal-lang
BlaXpirit has quit [Quit: Bye]
BlaXpirit has joined #crystal-lang
pduncan has quit [Ping timeout: 260 seconds]
akwiatkowski has quit [Quit: Konversation terminated!]
matp_ has quit [Ping timeout: 246 seconds]
matp has joined #crystal-lang
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
matp has quit [Quit: ZZzzzZz...]
bjz has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 248 seconds]
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…]
bjz has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 256 seconds]
pawnbox has joined #crystal-lang
poikon has quit [Ping timeout: 240 seconds]
poikon has joined #crystal-lang
Philpax_ has joined #crystal-lang
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
poikon has quit [Ping timeout: 258 seconds]
poikon has joined #crystal-lang
jeromegn_ has quit [Ping timeout: 260 seconds]
jeromegn_ has joined #crystal-lang
poikon has quit [Ping timeout: 258 seconds]
jeromegn_ has quit [Read error: Connection reset by peer]
bjz has joined #crystal-lang
poikon has joined #crystal-lang
jeromegn_ has joined #crystal-lang
<FromGitter> <jots_twitter> How to do recursive block calls? I get a compile error when trying to call recursively: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5828289545c9e3eb433017a3]
<FromGitter> <jots_twitter> code here (line number that error is reported doesn't seem right): https://play.crystal-lang.org/#/r/1dub
matp has joined #crystal-lang
<BlaXpirit> jots_twitter you can't, they're implemented by inlining code
<FromGitter> <maiha_twitter> Although I don't know how delegating block works exactly in Crystal, it works by passing Proc explicitly rather than using block implicitly. ⏎ https://gist.github.com/maiha/d99212c573b33cc3a4e716bb733079aa
snsei has joined #crystal-lang
matp has quit [Quit: ZZzzzZz...]
<FromGitter> <jots_twitter> Thanks @maiha_twitter That seems to work. trying to grok it now.
snsei has quit [Ping timeout: 260 seconds]
<FromGitter> <greentornado> Is there any lib c binding example in crystal ? I've read the doc but not quite understand yet
<FromGitter> <maiha_twitter> @jots_twitter Yep. Just using Proc object in 2nd arg. `->` is a syntax sugar to Proc.
<FromGitter> <maiha_twitter> @greentornado a simple example of using `ntohl` https://play.crystal-lang.org/#/r/1duc
<FromGitter> <greentornado> @maiha_twitter thanks
<FromGitter> <greentornado> Oops i mean maiha
<FromGitter> <maiha_twitter> In most case, we can automatically generate the glue code by using `crystal_lib` : https://github.com/crystal-lang/crystal_lib/blob/master/examples/libc.cr
<FromGitter> <greentornado> How can i use it ?
<FromGitter> <maiha_twitter> 1) download `crystal_lib` 2. write scheme like above. 3. run the file by `crystal src/main.cr -- lib_xxx.cr`
<FromGitter> <greentornado> src/main.cr is my project main.cr right ?
<FromGitter> <greentornado> In the cheme i'll have to include the header lib name and some fun name ?
<FromGitter> <maiha_twitter> No. `crystal_lib` repos has it!
<FromGitter> <barisbalic> @asterite thanks, some small updates to come, and when it's stable I'll ask crystalshards.xyz about adding a link on projects, feels a bit redundant to have my own index if they already do a good job of it
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
<FromGitter> <barisbalic> @luislavena sorry for delayed response, I was trying to keep things really simple to minimise maintenance, but that is another option. I think for now having the docs rebuilt frequently will have to suffice, but please DM me with any particular thoughts or concerns
<FromGitter> <maiha_twitter> @greentornado Please try this for above `ntohl` example. https://gist.github.com/maiha/9b86bbea607be2431befe3ee63b2d539
<FromGitter> <greentornado> Oh cool
<FromGitter> <greentornado> Got it now
<FromGitter> <greentornado> 👍
<FromGitter> <maiha_twitter> yeah! :)
soveran has quit [Ping timeout: 268 seconds]
<FromGitter> <greentornado> Thanks
<FromGitter> <sdogruyol> @maiha_twitter doumo!
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 252 seconds]
<FromGitter> <maiha_twitter> @sdogruyol Hi! I missed here. Thank you for bringing me here by your tweet :)
<FromGitter> <sdogruyol> @maiha_twitter thanks for joining :)
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
bjz has joined #crystal-lang
bjz_ has quit [Ping timeout: 248 seconds]
<FromGitter> <greentornado> `🚀 crystal src/main.cr -- examples/lib_uv.cr ⏎ ld: library not found for -lclang ⏎ clang: error: linker command failed with exit code 1 (use -v to see invocation) ⏎ Error: execution of command failed with code: 1: `cc -o "/Users/Hai/.cache/crystal/crystal-run-main.tmp" "${@}" -rdynamic -rpath `xcode-select --print-path`/usr/lib -L`xcode-select --print-path`/usr/lib -lclang -lpcre -lgc -lpthread
<FromGitter> ... /usr/local/Cellar/crystal-lang/0.19.4_1/src/ext/libcrystal.a -levent -liconv -ldl -L/usr/lib -L/usr/local/lib`` [https://gitter.im/crystal-lang/crystal?at=5828411edf5ae966454e52f2]
<FromGitter> <greentornado> Got some error :D
<FromGitter> <greentornado> I got libuv installed via homebrew
matp has joined #crystal-lang
<FromGitter> <maiha_twitter> It seems you lack `libclang-dev` . Some libs are essential. Plz see the install setting of `.travis.yml`
<FromGitter> <maiha_twitter> Although those package names are ubuntu(or debian) package, you need ones like that.
<FromGitter> <greentornado> yep
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 256 seconds]
_jungh4ns has quit [Remote host closed the connection]
soveran has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 250 seconds]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
pawnbox_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 248 seconds]
soveran has quit [Remote host closed the connection]
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
DeBot has joined #crystal-lang
Philpax_ has quit [Ping timeout: 248 seconds]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
j2k has joined #crystal-lang
soveran has quit [Remote host closed the connection]
keith__ has quit [Quit: Connection closed for inactivity]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
<jokke> hello
<jokke> how is the correct way to deal with inline c functions?
<jokke> *what
<BlaXpirit> jokke, you can't "deal" with them. you can reimplement them
<jokke> BlaXpirit: mh i was afraid you'd say that
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 245 seconds]
<FromGitter> <greentornado> `ld: library not found for -lclang` still can't fix this in mac :< el capitan
ponga has joined #crystal-lang
<FromGitter> <greentornado> fixed it with `cd /usr/local/lib && sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib libclang.dylib`
j2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mhib has joined #crystal-lang
mhib has quit [Client Quit]
j2k has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
j2k has quit [Quit: Textual IRC Client: www.textualapp.com]
ruby has joined #crystal-lang
ruby is now known as Guest37071
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
unshadow has joined #crystal-lang
<transfire> What would be preferable, `class YAML::CoreSchema < YAML::TagSchema` or `class YAML::TagSchema::Core < YAML::TagSchema::Base`?
soveran has quit [Ping timeout: 268 seconds]
<BlaXpirit> CoreSchemaFactory
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
<transfire> And what would the factory method use to decide which class to provide? And we still got name the classes, in any case.
pawnbox has joined #crystal-lang
pawnbox_ has quit [Ping timeout: 252 seconds]
<Yxhuvud> wooosch
<transfire> Really?
soveran has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Guest37071 has quit []
pawnbox has quit [Ping timeout: 248 seconds]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
<FromGitter> <jots_twitter> I clearly have the wrong syntax ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ how to do? [https://gitter.im/crystal-lang/crystal?at=5828c66dc2f2cf7275072462]
<Yxhuvud> jots: You try adding entries to a class. You probably want to instantiate it first.
<FromGitter> <jots_twitter> ahhh `b = Hash(String,Int32).new` works. is it possible to set default value? like `b = Hash(String,Int32=0).new` or some such?
<FromGitter> <cjgajard> @jots_twitter ⏎ ⏎ ```b = Hash(String,Int32).new(0) ⏎ b["x"] #=> 0``` [https://gitter.im/crystal-lang/crystal?at=5828c89bc2f2cf7275073034]
<FromGitter> <johnjansen> @jots_twitter Hash can take a proc for defaults
bjz has joined #crystal-lang
<FromGitter> <jots_twitter> thank you people!
soveran has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
transfire has left #crystal-lang [#crystal-lang]
soveran has joined #crystal-lang
pawnbox has quit [Ping timeout: 252 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
soveran has quit [Remote host closed the connection]
<crystal-gh> [crystal] bcardiff pushed 1 new commit to master: https://git.io/vX6Ap
<crystal-gh> crystal/master 7e37c22 Brian J. Cardiff: Playground: enforce same origin check for client websocket...
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
<Papierkorb> Can I somehow dump which fibers are running, and/or which fiber is currently running?
<Papierkorb> My application is "hanging" for some reason
<Papierkorb> Not a infinite loop though, the CPU's sleeping
<tilpner> Maybe set a signal handler to print Fiber.current.name?
<Papierkorb> tilpner: I had that idea too, but the comments say that signal handlers run in their own fiber
<tilpner> Aww
matp_ has joined #crystal-lang
matp has quit [Ping timeout: 260 seconds]
<FromGitter> <sdogruyol> @papierkorb log
<RX14> Papierkorb, do you use Scheduler or Fiber in your code, or is it a crystal stdlib bug?
<Papierkorb> I log tons of things, no exceptions are thrown, but the just spawned fibers just don't start running
<Papierkorb> RX14: ::spawn, no direct use of Scheduler
<RX14> huh
<FromGitter> <sdogruyol> just don't start running* that's weird
<RX14> so you use `sleep` to reschedule in the main fiber, or what?
<RX14> what happens to the main fiber
<Papierkorb> Yes, and the first fibers run just fine
<RX14> oh
<RX14> any shards?
<Papierkorb> Not used there, just standard lib and my code
<RX14> any library bindings which might be blocking?>
<RX14> C bindings*?
<Papierkorb> Nope. It's networking code though, with some fibers waiting for UDP packets to arrive
<RX14> interesting
<RX14> you could use the actual OS threading for this maybe
<Papierkorb> Can I kindly ask (read that as "if I have to shoot at it it's fine too") libevent to tell me all waiting events, and maybe even map those to fibers?
<RX14> well
<RX14> i think your best bet is to spawn an OS thread to read the current fiber and use LibC.write to write it to sedout
<RX14> as long as you don't malloc or use IO it should be fine
<travis-ci> crystal-lang/crystal#7e37c22 (master - Playground: enforce same origin check for client websocket): The build was fixed. https://travis-ci.org/crystal-lang/crystal/builds/175548875
<Papierkorb> > Current fiber: 0x0
<RX14> always?
<RX14> or does it change
<RX14> check it every 0.5s
<Papierkorb> ran it 3 times, always
<RX14> make sure it gives correct results
<RX14> Papierkorb, you're going to need to save a reference to Thread.current before you start the thread
<RX14> then call current_fiber on that
<RX14> because Fiber.current is thread-local
bjz has joined #crystal-lang
bjz has quit [Read error: Connection reset by peer]
bjz has joined #crystal-lang
bjz has quit [Ping timeout: 260 seconds]
<Papierkorb> There we go, let's see
<Papierkorb> Good thing I wrap ::spawn, and good thing I today hacked a caller_name method
<coderobe> hey, is there a yaml shard for crystal?
<Papierkorb> coderobe: YAML is in the stdlib :)
<coderobe> oh sweet
<coderobe> heh
<BlaXpirit> is this in the threads branch
bjz has joined #crystal-lang
soveran has quit [Remote host closed the connection]
<Papierkorb> BlaXpirit: ?
<BlaXpirit> why are you dealing with threads?
bjz has quit [Read error: Connection reset by peer]
<Papierkorb> BlaXpirit: See above, I needed a way to grab the currently running fiber which hangs the process
<Papierkorb> Blargh, damn you real blocking IO.select
<crystal-gh> [crystal] luislavena opened pull request #3539: Automatically unpack Tuple when sorting arrays (master...auto-unpack-tuple-array-sort_by) https://git.io/vX6j4
<RX14> Papierkorb, did you work it out?
<Papierkorb> RX14: Yep, IO.select blocks the process, which I did not expectto do
<RX14> yes
<RX14> that really should go
<Papierkorb> at least the docs could say so
<RX14> no, IO.select should be removed
<FromGitter> <sdogruyol> Wtf is IO.select
<FromGitter> <sdogruyol> It is not select right?
<coderobe> any idea why File.new doesn't actually create a file?
<RX14> @sdogruyol what?
<RX14> coderobe, opening a file with "r" doesn't create it
<RX14> "w" or "a" modes do create the file
<FromGitter> <sdogruyol> It is not the same as select keyword right?
<RX14> no
<RX14> it uses LibC.select
<RX14> which is blocking
<coderobe> RX14: oh, thanks
<FromGitter> <sdogruyol> What's the purpose for using that pardon me
<RX14> there isn't one any more
<RX14> well
<RX14> actually
<Papierkorb> sdogruyol, waiting for any one of multiple file handles to become active
<RX14> yes
<RX14> the new select doesn't work with IO does it
<RX14> damn
<FromGitter> <sdogruyol> Oh I see thanks for the explanation
shawn42 has joined #crystal-lang
Philpax_ has joined #crystal-lang
unshadow has quit [Remote host closed the connection]
am_ has joined #crystal-lang
<RX14> it should be possible to implement read_select_action, write_select_action, etc. on IO
<RX14> well
<RX14> not IO
<RX14> but IO::FileDescriptor
<RX14> i *might* give that a shot tomorrow
<Papierkorb> RX14: that would be much appreciated
<Papierkorb> would get rid of some otherwise useless fibers in the torrent lib
<FromGitter> <jots_twitter> this is surprising: ⏎ ⏎ ```icr(0.19.4) > "hello\n".split(/\s+/) ⏎ => ["hello", ""]``` ⏎ ⏎ ruby just returns the "hello" not the empty string at the end [https://gitter.im/crystal-lang/crystal?at=5828fda165485ebc678f9ca0]