RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.25.1 | 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
<RX14> i might just register a finalizer on every allocated object
<RX14> at least it's worth a try...
<RX14> that or hope the memory leak is in sidekiq and just rip out sidekiq
jokke1 has joined #crystal-lang
marius has quit [*.net *.split]
DTZUZU has quit [*.net *.split]
jokke has quit [*.net *.split]
notdaniel has quit [*.net *.split]
woodruffw has quit [*.net *.split]
livcd has quit [*.net *.split]
francisl has quit [Quit: francisl]
DTZUZU has joined #crystal-lang
notdaniel has joined #crystal-lang
livcd has joined #crystal-lang
marius has joined #crystal-lang
woodruffw has joined #crystal-lang
notdaniel has quit [Max SendQ exceeded]
DTZUZU has quit [Max SendQ exceeded]
notdaniel has joined #crystal-lang
maxpowa has quit [Ping timeout: 257 seconds]
ashirase has quit [Ping timeout: 269 seconds]
raz has quit [Ping timeout: 260 seconds]
ashirase has joined #crystal-lang
maxpowa has joined #crystal-lang
akaiiro has joined #crystal-lang
akaiiro has quit [Ping timeout: 244 seconds]
akaiiro has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
<FromGitter> <MisterBianco> Is there a docs section on symbols? I am having a hard time grasping them and their use cases. I read the docs and still am not sure. I hate asking such noob questions, but I really like this language and want to learn it to the fullest extent.
akaiiro has quit [Ping timeout: 272 seconds]
<FromGitter> <MisterBianco> Read it
<FromGitter> <MisterBianco> So let's say I have
<FromGitter> <MisterBianco> :symbol
<FromGitter> <MisterBianco> : symbol
<FromGitter> <MisterBianco> What can I do with that besides printing it out...
<FromGitter> <alehander42> they can be used as quicker version of strings, something like ad hoc enums
<FromGitter> <alehander42> if you have a limited number of strings describing stuff, e.g. months, categories of something, colors etc
<FromGitter> <alehander42> it makes sense to use symbols, as internally they are just a number, but they are written and printed as names
<FromGitter> <alehander42> hav you used enum-s in another language?(not important, just would help you with similarity)
<Yxhuvud> RX14: didn't groogy have some tool related to tracking allocation?
DTZUZO has quit [Ping timeout: 240 seconds]
ashirase has quit [Ping timeout: 268 seconds]
ashirase has joined #crystal-lang
<FromGitter> <bararchy> @veelenga can't thank you enough for Ameba :)
<FromGitter> <samof76> hi
<FromGitter> <samof76> can you run rails like framework through crystal?
<FromGitter> <bararchy> We have just released a FIX protocol library in pure Crystal -- check it if you're interested. ⏎ https://github.com/NeuraLegion/fix
francisl has joined #crystal-lang
<FromGitter> <veelenga> @bararchy cool :)
<FromGitter> <veelenga> still have big plans for Ameba, but my free time is kinda limited for moment. Hope will continue active development in the nearest future.
<FromGitter> <bararchy> πŸ‘
francisl has quit [Quit: francisl]
francisl has joined #crystal-lang
return0e has quit [Remote host closed the connection]
return0e has joined #crystal-lang
return0e has quit [Remote host closed the connection]
return0e has joined #crystal-lang
return0xe has joined #crystal-lang
return0e has quit [Ping timeout: 240 seconds]
<FromGitter> <fridgerator> @samof76 checkout Kemal, Lucky and Amber
<FromGitter> <fernandes> @veelenga in which awesome crystal https://github.com/NeuraLegion/fix would fits in? heheh `Data Formats` ?
DTZUZO has joined #crystal-lang
akaiiro has joined #crystal-lang
<livcd> I am a bit skeptical about Crystal :-/
scott_tams has joined #crystal-lang
<scott_tams> I'm a little confused about how to narrow down types when something has multiple types. For example, in this gist, @value is String | Nil, but the unless statement should limit it to just being a String inside the block. I'm getting an error, "undefined method + for Nil..." what am I doing wrong?
<FromGitter> <veelenga> @fernandes probaby Network Protocols https://github.com/veelenga/awesome-crystal#network-protocols
<z64> @scott_tams For nilable types, you can reduce `Nil` from the union by assigning it to a local variable in `if var = @var`; https://carc.in/#/r/4ql4
<FromGitter> <fernandes> thought network protocols were more related to client/server protocols, not file/batch processing hehehe
<scott_tams> oh that's what I was missing!
<scott_tams> thanks!
<z64> scott_tams: no problem. check out https://crystal-lang.org/docs/syntax_and_semantics/if_var.html which covers this in more detail
<FromGitter> <fernandes> oh yeah, this fix works as a server/client hahah really ;)
<FromGitter> <Grabli66> Hi! I updated crystal to 0.26 (Ubuntu 16) and i always getting error "execvp: Not a directory (Errno)" on compilation, even simple program. Anyone has same problem?
<FromGitter> <j8r> Nope. What is you simple program?
<FromGitter> <Grabli66> p "GOOD"
<FromGitter> <j8r> try to delete the cache?
<FromGitter> <j8r> `rm -rf ~/.cache/crystal`
<FromGitter> <Grabli66> Did not help. :(
<FromGitter> <bcardiff> @Grabli66 do you have `which`?
<FromGitter> <bcardiff> We detect some issues in the rpm package that show that error, but not in .deb
<FromGitter> <Grabli66> Yes. I have
<FromGitter> <Grabli66> I am trying to reinstall crystal
scott_tams has quit [Ping timeout: 260 seconds]
ua has quit [Ping timeout: 272 seconds]
<FromGitter> <Grabli66> Maybe, it's possible to show stacktrace of that error? Cause error message does not have any usefull information.
scott_tams has joined #crystal-lang
<FromGitter> <fridgerator> livcd, me too, and i've been using crystal for 2+ years ;)
<livcd> fridgerator: well ary said it's basically FUBAR
<FromGitter> <fridgerator> he says that all the time, but then he talks about how great it is
<FromGitter> <fridgerator> IMO Crystal has the most momentum its ever had
<FromGitter> <fridgerator> currently
<livcd> he balances on the verge of sanity and insanity :P
<FromGitter> <fridgerator> possibly, but I dont know him so I try not to judge :)
<FromGitter> <fridgerator> lol
<FromGitter> <fridgerator> Ary's comments have also gotten me down before
<RX14> well one way to be 100% sure it won't work is to give up
<FromGitter> <bararchy> @fernandes we can always make a "fintech" category hahahah
<FromGitter> <fridgerator> I'm now using Crystal in 2 production server apps at work, and would 100% use crystal for any personal / side project work
<FromGitter> <fridgerator> Working in Crystal makes me happy
<FromGitter> <j8r> Crystal isn't perfect, but well, tell me one that it is and I'll follow πŸ˜„
<scott_tams> FromGitter, me too
<FromGitter> scott_tams, I'm a bot, *bleep, bloop*. I relay messages between here and https://gitter.im/crystal-lang/crystal
<scott_tams> @fridgerator, me too :D
<FromGitter> <fernandes> @bararchy hahahah great... will be needed in 2 weeks :P
marius has quit [Quit: baj]
return0xe has quit [Remote host closed the connection]
return0xe has joined #crystal-lang
<FromGitter> <bararchy> @fridgerator that's awesome!
<FromGitter> <Grabli66> @bcardiff I compiled crystal from source and it works now :)
<FromGitter> <MisterBianco> @alehander42 okay that makes sense. Yes I have used enums from C and I appreciate your answering.
scott_tams has quit [Ping timeout: 268 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 272 seconds]
Raimondii is now known as Raimondi
<FromGitter> <bcardiff> @Grabli66 πŸ‘ then either is something of your installation of the .deb or something with the packaging. I test installer before releases with debian/jessie64 and ubuntu/xenial32 vagrant machines.
<FromGitter> <bcardiff> And they both succedded
<FromGitter> <Grabli66> @bcardiff And i took crystal 0.26 binary for linux64 and it also does not work on my machine, with the same error. It's very strange :)
<FromGitter> <drosehn> Does crystal use the same GC as ruby? I've tracked down memory-leak problems in ruby using some calls into the GC, but I don't remember if I've done that in crystal.
<Yxhuvud> drosehn: no, crystal uses BΓΆehm collector, ruby uses their own.
ua has joined #crystal-lang
DTZUZU has joined #crystal-lang
akaiiro has quit [Remote host closed the connection]
ua has quit [Ping timeout: 244 seconds]
akaiiro has joined #crystal-lang
ua has joined #crystal-lang
<FromGitter> <jwoertink> Why is amber the test for running crystal on homebrew? Why not one of the samples crystal? Those samples could be moved out to another repo, and then those samples could be used
<RX14> @jwoertink it's not
<RX14> the problem is that amber is a homebrew package itself
<FromGitter> <jwoertink> ah! ok... Because it's a homebrew package and has crystal as a dependency
<RX14> yes
<FromGitter> <jwoertink> wow. Interesting. I didn't think about that
<FromGitter> <jwoertink> that kind of sucks then.
<FromGitter> <jwoertink> If amber was a tap instead of a direct formula, then it would be fine, right?
<RX14> yes
alex`` has joined #crystal-lang
Yxhuvud has quit [Remote host closed the connection]
<FromGitter> <MrSorcus> https://github.com/crystal-lang/crystal/issues/6534 - no ideas why broken?
<FromGitter> <bararchy> Seems like @ysbaddaden already have quite a good progress on multi-threading POC, maybe someone can give him a hand and we will have a beta to test :) https://twitter.com/ysbaddaden/status/1029420622026293249
<FromGitter> <vegai> nice!
akaiiro has quit [Ping timeout: 244 seconds]
Yxhuvud has joined #crystal-lang
ua_ has joined #crystal-lang
ua has quit [Ping timeout: 272 seconds]
akaiiro has joined #crystal-lang
<FromGitter> <talbergs> lacally thou this works =/ https://play.crystal-lang.org/#/r/4qly < here says no output
<FromGitter> <bew> you don't need the additional quotes for the arg: https://play.crystal-lang.org/#/r/4qm0
<FromGitter> <talbergs> thanx
<jhass> eh, well... https://p.jhass.eu/71.txt
<jhass> I'm kinda stuck on coming up with ideas on how to troubleshoot that one
<FromGitter> <asterite> the compiler now depends on `which`
<jhass> oh
<jhass> why not a shell and command -v ? :/
<FromGitter> <asterite> I don't know. Nobody knows yet what made it depend on `which`
<FromGitter> <asterite> It was using `which` before, though
<jhass> and probably got removed since it's not too portable :P
<jhass> but thanks
<FromGitter> <asterite> it's still being used. I just checked the diff bewteen 0.25.1 and 0.26.0 and couldn't find a mention to `which`. I don't know what's going on
<FromGitter> <asterite> but it's a known issue (at least for the core members)
francisl has quit [Quit: francisl]
<FromGitter> <bew> it's not a huge deps, it's only used in 2 places: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b7325ea5ec2bc174ffb6a0f]
<jhass> ok, idk why it wasn't failing before then
<FromGitter> <bew> the stacktrace looks quite short, maybe it's not this problem
<FromGitter> <talbergs> I finally put together my question: https://play.crystal-lang.org/#/r/4qm6 ⏎ ⏎ I encounter this error (i'ts in comment at end of file).
<FromGitter> <talbergs> I know the error is lost if `while o = p.output.gets` is not in fiber, but I have to use fibers there.. Error is pretty cryptic, I do not know what to do there. Even play.cr.org can't illustrate, one must try locally.
<FromGitter> <bew> does `sh -c 'echo 0;sleep 1;echo 1;sleep 1;'` work for you locally? (it works for me)
<FromGitter> <talbergs> yes, do you receive the error, that was in comment there?
<FromGitter> <bew> note that when you use `Process.run` with a block, crystal will wait for the process to finish, so your kill will never work
<FromGitter> <bew> btw, what are you trying to do?
alex`` has quit [Ping timeout: 260 seconds]
<FromGitter> <talbergs> I have an web application that communicates via websocket and client may choose to invoke some script file on host machine, that will then send stdout to client to render while remining responsive to other client events (like config edits and so on). ⏎ ⏎ This dummy code illustrates quite close on my projects architecture (at least I get exact same error message). https://play.crystal-lang.org/#/r/4qmc ⏎
francisl has joined #crystal-lang
<FromGitter> <talbergs> And yes - while client observes output seperately as stdout and stderr, he can send SIGTERM at any point - so thats there on what I want to acheive
<FromGitter> <bew> instead of using `Process.run` you might want to use `Process.new`, so you have a bit more control on when the process finishes, and how crystal handle it
baweaver is now known as lemur
lemur is now known as baweaver
<FromGitter> <talbergs> hmm, ima try that.
<FromGitter> <bew> sth like that: https://play.crystal-lang.org/#/r/4qmi (ignore the errors from carcin)
<FromGitter> <talbergs> Aha, thank you a lot - it is cleaner using `.new` here , I modifiet that a bit to kill it at some point. https://play.crystal-lang.org/#/r/4qmk ⏎ ⏎ Again the same error is there. ⏎ ⏎ Thou still would be neat to understand why exactly i originated. [https://gitter.im/crystal-lang/crystal?at=5b732e82a3a93d24226538ad]
<FromGitter> <talbergs> like fiber within fiber situation
<FromGitter> <bew> what errors do you have exactly? yes channels are recommended to pass data around between fibers
alex`` has joined #crystal-lang
<FromGitter> <talbergs> error is ```Unhandled exception in spawn: ⏎ Error reading file: Bad file descriptor (Errno) ⏎ from /usr/local/Cellar/crystal/0.25.1/src/crystal/system/unix/file_descriptor.cr:55:9 in 'unbuffered_read'``` ⏎ ⏎ so the output.gets is called once more after the proc is killed? [https://gitter.im/crystal-lang/crystal?at=5b733069a37112689c1d7586]
<FromGitter> <bew> and there is no such thing as fiber within fiber, fibers are not container of some things. All fibers are at the same level, they can just be spawned from anywhere
<FromGitter> <bew> did you specified that output & error should be piped?
<FromGitter> <talbergs> did I specified? That is the same example from above. https://play.crystal-lang.org/#/r/4qmk
<FromGitter> <talbergs> Sorry I may just be too much noob for this.
<FromGitter> <talbergs> Im not sure if i did specify .. it is passed to `send` method
<FromGitter> <bew> ah yes ok I get that error too
<FromGitter> <talbergs> I guess the example is not throwing an error on your os?
francisl has quit [Quit: francisl]
<FromGitter> <bew> not exactly sure why, but wrapping the `proc.kill` call in a `proc.terminated?` check fixes it.. https://carc.in/#/r/4qmm
<FromGitter> <bew> (not in carcin x) )
<FromGitter> <bew> ah ok I get it, the check does nothing, it's just that doing something else (e.g: using puts to display some data) will avoid the problem. The problem (not a bug) is that when you try to read from a closed pipe, you get that error, and that's what is happening
<FromGitter> <bew> one way to handle it is to wait for the Errno exception and ignore it
<FromGitter> <talbergs> yes looks like it. Could be reading from closed pipe..
<FromGitter> <talbergs> ```code paste, see link``` ⏎ ⏎ but this again gave me an error. ⏎ I used last snippet you shared, added a bit `sleep` at the end to get error and replaced the spawned while loops like so.. [https://gitter.im/crystal-lang/crystal?at=5b7336a2a3a93d2422656a62]
<FromGitter> <bew> https://carc.in/#/r/4qmt
<FromGitter> <bew> you can't know in advance if the pipe is closed without trying to read from it first
<RX14> has someone reproed the which thing to bisect?
<FromGitter> <bew> if I followed the discussion correctly, the error doesn't happen when you build from source or sth like that (might be wrong though..)
<FromGitter> <talbergs> @bew Well I had the muted-rescue there few hours ago. Then at some point (maybe it was spawned multiple proccesses (not sure)) binary wouldn't even exit when terminal sends that sighterm <^-z>
<FromGitter> <talbergs> uff, muted-rescue not so clean ... but it works :)
<RX14> the compiler part where it uses which is part of the link flags code
<RX14> maybe something special happened where that code branch started to be taken only recently
<FromGitter> <asterite> maybe some link flags changed
francisl has joined #crystal-lang
<RX14> yes that was my thought
akaiiro has quit [Ping timeout: 244 seconds]
<FromGitter> <asterite> that doesn't seem to be it, by looking at `git diff 0.25.1 0.26.0`
<FromGitter> <asterite> I think the best way would be to compile the compiler with --debug and check the stack trace...
<FromGitter> <asterite> actually, without `--debug`, but without `--no-debug` either
<jhass> well, I kinda just installed which for now, sorry
<FromGitter> <talbergs> no rly how to properly do `proc.output.gets`knowing Process may be killed at any point? https://carc.in/#/r/4qn5 ⏎ testing for `!proc.terminated? && !proc.output.closed?` is not enough - they are falsy right on next iterration, i tested.
<FromGitter> <talbergs> is this worth an issue?
francisl has quit [Quit: francisl]
alex`` has quit [Ping timeout: 272 seconds]
jhass has quit [Ping timeout: 255 seconds]
asterite has quit [Ping timeout: 240 seconds]
hightower4 has joined #crystal-lang
akaiiro has joined #crystal-lang
<FromGitter> <Timbus> @talbergs you catch the error on ead
<FromGitter> <Timbus> There is no way around it, a process could die anytime mid-read. Also this is .. very similar to my last chat with @ysbaddaden