jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.8.0 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/manastech/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
qard has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<crystal-gh> [crystal] jhass pushed 2 new commits to master: http://git.io/vnwoO
<crystal-gh> crystal/master 7869372 Adler: add documentation to markdown
<crystal-gh> crystal/master 1c30d55 Jonne Haß: Merge pull request #1560 from adlerhsieh/master...
<travis-ci> manastech/crystal#1c30d55 (master - Merge pull request #1560 from adlerhsieh/master): The build passed. https://travis-ci.org/manastech/crystal/builds/81695475
jeromegn has quit [Quit: jeromegn]
NeverDie has quit [Quit: http://radiux.io/]
NeverDie has joined #crystal-lang
NeverDie has quit [Client Quit]
qard has joined #crystal-lang
jeromegn has joined #crystal-lang
ssvb has joined #crystal-lang
NeverDie has joined #crystal-lang
Philpax has joined #crystal-lang
jeromegn has quit [Quit: jeromegn]
willl has quit [Quit: Connection closed for inactivity]
qard has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Philpax has quit [Quit: Leaving]
jeromegn has joined #crystal-lang
jeromegn has quit [Quit: jeromegn]
jeromegn has joined #crystal-lang
jeromegn has quit [Quit: jeromegn]
willl has joined #crystal-lang
vjdhama has joined #crystal-lang
kulelu88 has quit [Quit: Leaving]
havenwood has joined #crystal-lang
vjdhama has quit [Read error: Connection reset by peer]
vjdhama_ has joined #crystal-lang
vjdhama_ has quit [Remote host closed the connection]
trapped has joined #crystal-lang
vjdhama has joined #crystal-lang
vjdhama has quit [Ping timeout: 250 seconds]
havenwood has quit [Ping timeout: 240 seconds]
vjdhama has joined #crystal-lang
NeverDie has quit [Quit: http://radiux.io/]
Kilo`byte has quit [Ping timeout: 240 seconds]
Kilo`byte has joined #crystal-lang
certainty has left #crystal-lang ["WeeChat 0.4.3"]
vjdhama has quit [Read error: Connection reset by peer]
Ven has joined #crystal-lang
vjdhama has joined #crystal-lang
nakilon has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
vjdhama has quit [Read error: Connection reset by peer]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<crystal-gh> [crystal] vjdhama opened pull request #1566: added documentation for stat, lstat and exists? (master...master) http://git.io/vnr7P
Ven has joined #crystal-lang
<crystal-gh> [crystal] waterlink opened pull request #1567: Followup for PR #1548 (Dismantle CGI module) (master...followup/pr/1548) http://git.io/vnr5q
nakilon has quit [Ping timeout: 264 seconds]
vjdhama has joined #crystal-lang
greenarrow has joined #crystal-lang
<crystal-gh> [crystal] jhass closed pull request #1567: Followup for PR #1548 (Dismantle CGI module) (master...followup/pr/1548) http://git.io/vnr5q
<crystal-gh> [crystal] chdorner opened pull request #1568: Partial Hash documentation (master...add-hash-docs) http://git.io/vnrxG
<crystal-gh> [crystal] jhass pushed 1 new commit to master: http://git.io/vnrxa
<crystal-gh> crystal/master 1a151e0 Jonne Haß: Merge pull request #1552 from manastech/http-deflate-handler...
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
willl has quit [Quit: Connection closed for inactivity]
<travis-ci> manastech/crystal#991bbbc (master - Merge pull request #1567 from waterlink/followup/pr/1548): The build passed. https://travis-ci.org/manastech/crystal/builds/81730230
Ven has joined #crystal-lang
vjdhama has quit [Remote host closed the connection]
Ven has quit [Client Quit]
<travis-ci> manastech/crystal#1a151e0 (master - Merge pull request #1552 from manastech/http-deflate-handler): The build passed. https://travis-ci.org/manastech/crystal/builds/81730605
<chdorner> jhass: something like this for the iterator docs? https://gist.github.com/chdorner/4e662c1caef7d7e69601
<chdorner> as the example
<jhass> I think our current iterator docs just call .next a couple of times sequentially
<jhass> doing your own loop is not really what it is for, you'd just use the block variant for that
<chdorner> so something like this I guess? https://gist.github.com/chdorner/4e662c1caef7d7e69601
<chdorner> I think as long as we mention that it is a normal `Iterator` and give a quick example, it should be fine
<jhass> yeah
<jhass> I wouldn't even mention the iterator class though
<jhass> since you can't find it in the docs
<jhass> "Returns an iterator over the hash entries"
<chdorner> ok cool
leafybasil has quit [Remote host closed the connection]
vjdhama has joined #crystal-lang
<crystal-gh> [crystal] jhass pushed 2 new commits to master: http://git.io/vnoqK
<crystal-gh> crystal/master 743353a chdorner: Add documentation for Hash methods
<crystal-gh> crystal/master c628bab Jonne Haß: Merge pull request #1568 from chdorner/add-hash-docs...
<jokke> hi
<jokke> i snatched up some conversation about bson parsing here
<jokke> how's it coming?
<jokke> i'd be very interested in a mongodb driver for crystal :)
<jhass> might need some compatibility fixes by now
<jokke> oh!
<jokke> awesome!
elia has joined #crystal-lang
<greenarrow> where I do nil || something, should it be returning nil?
<greenarrow> >>
<greenarrow> >> test
<DeBot> greenarrow: undefined local variable or method 'test' - http://carc.in/#/r/gsf
<greenarrow> >> nil || true
<DeBot> greenarrow: # => true - http://carc.in/#/r/gsg
<greenarrow> hmm
leafybasil has joined #crystal-lang
leafybas_ has joined #crystal-lang
leafybasil has quit [Read error: Connection reset by peer]
<jokke> jhass: what do you suspect how long it would take to implement a readonly subset for https://github.com/meteor/meteor/blob/devel/packages/ddp/DDP.md in crystal?
<jhass> 5-40 hours I guess
<jokke> jhass: by you yeah :D
<jokke> so i'll double that :)
<travis-ci> manastech/crystal#c628bab (master - Merge pull request #1568 from chdorner/add-hash-docs): The build passed. https://travis-ci.org/manastech/crystal/builds/81736769
<jhass> okay apparently I didn't pick a wide enough range, that was a "no idea, that depends on so many factors man"
<jhass> :P
<jokke> jhass: i'm not sure how to handle all the messages asynchronously
<jhass> spawn a fiber for each?
<jokke> hm yeah. have no experience in concurrency with crystal
<jokke> *with
<jokke> i'm writing my thesis and part of it is going to be an api which caches data from a meteor project and provides json representation of that data
<jokke> and i want it to be performant
<jhass> just wrap anything that blocks or waits into a fiber
<jhass> then while the fiber is blocked crystal will run another one that is no longer blocked for you
Ven has joined #crystal-lang
<jokke> yeah
<jokke> and last but not least, how stable would you think it would be (assuming i write perfect code)
<jokke> i know, stupid questions but you've got alot of experience with crystal so you can make educated guesses
<jhass> carc.in chokes on non-UTF-8 or otherwise weird input sometimes, but if you keep an open begin/rescue around the main handler and don't pass user data through unsafe features without being careful it should be fairly solid
<jhass> I wouldn't depend a business on it yet, but yeah
<jokke> thanks, that's the kind of answer i was looking for
BlaXpirit has joined #crystal-lang
<jokke> i think the more people code in crystal, the better for crystal
<jhass> and running it under a supervisor that always restarts on crashes should give you some extra margin
<jhass> sure
<jokke> yeah
<jokke> jhass: how about debugging btw. i've found it very difficult
<jhass> (I do that for carc.in so I have actually no idea if it crashes frequently :P)
<jokke> :D
<jokke> like: what do i do if i get a segfault, how do i debug it
<jhass> waj pushed some stuff that should at least give you proper line numbers for the current stack and allow some stepping through, though no value access yet as far as I can tell
<jhass> so you do build -d and run it through valgrind and/or gdb
<jokke> oh ok! that's better than what i knew
BlaXpirit has quit [Client Quit]
<jokke> i wonder what the code looks like in gdb...
BlaXpirit has joined #crystal-lang
<jhass> mmh? it attaches the source, so unless you hit a bug where line numbers are off, you get just your regular source
<jokke> ah ok wow
BlaXpirit has quit [Client Quit]
<jokke> makes sense i guess
BlaXpirit has joined #crystal-lang
<chdorner> by the way, is there a list of missing things that crystal should support? or just when somebody reports something?
<jhass> ?roadmap
<DeBot> You can find the roadmap at https://github.com/manastech/crystal/wiki/Roadmap
<jhass> but the issue tracker is more controversial
<jhass> you can filter for enhancement and RFC + accepted
<jhass> er, comprehensive is what I wanted to write, no idea how controversial came out m(
<jokke> :)
<jokke> jhass: i just tried debugging with nemiver
<jokke> but it goes to the ensure block in main right after GC init
<jhass> well gotta set a breakpoint or add a debug trap to your code (call debugger)
<vjdhama> jhass: does this looks fine https://gist.github.com/vjdhama/ba30a922909620a65cf5
<jokke> jhass: call debugger?
<jhass> >> debugger
<DeBot> jhass: undefined method 'inspect' for Void - http://carc.in/#/r/gsh
<jhass> heh
<jhass> >> debugger; 1
<DeBot> jhass: Program received and didn't handle signal TRAP (5) - http://carc.in/#/r/gsi
<jokke> oooh
<jokke> that's cool!
<jokke> like binding.pry :)
<jokke> kinda
<jhass> well... "kinda" :D
<jokke> :D
<jokke> that's really very very helpful
<jhass> vjdhama: I'd link the first File::Stat too and maybe even omit the "See" then. Are you sure ENOENT is the only Errno it can raise? I'd expect at least EPERM too and what not
<jokke> wooah that's so cool!
leafybas_ has quit [Read error: Connection reset by peer]
leafybasil has joined #crystal-lang
<jokke> if one could see local vars then it'd be a bliss
<vjdhama> jhass: couldn't generate any other.
<vjdhama> jhass: should i just mention that it might raise a error from from error mentioned in Errno.
<vjdhama> *errors
<jhass> man 2 stat lists a whole bunch of possible errors
<jhass> so yeah just say something like "Raises Errno in case of an error"
<vjdhama> ok thanks
<vjdhama> jhass: Is it ok to have multiple commits in a single PR.
<vjdhama> jhass: I made few mistakes. Didn't review the commit before pushing. That's why PR has multiple commits.
<vjdhama> won't happen agian
<vjdhama> *again
vjdhama has quit [Read error: Connection reset by peer]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
vjdhama has joined #crystal-lang
Philpax has joined #crystal-lang
n0xff has quit [Ping timeout: 268 seconds]
<jhass> vjdhama: sorry, afk
<jhass> vjdhama: ideally I'd like one commit per logical change, so for this one would be better
<jhass> I'll post you squash instructions
<vjdhama> jhass: thanks
<jhass> vjdhama: though with dropping the "see" I meant the entire paren, since it feels redundant to linking it in the former sentence now to me
<vjdhama> jhass: Aha
<vjdhama> my mistake
<trapped> hmmm "expected 'api_key' to return String?, not Nil"
<vjdhama> jhass: should i update it?
<jhass> vjdhama: yes, please :)
apt-get has joined #crystal-lang
<jhass> trapped: is there a question? ;)
<trapped> isn't String? shorthand for String|Nil
<crystal-gh> [crystal] jhass pushed 5 new commits to master: http://git.io/vnorc
<crystal-gh> crystal/master 528c935 Oleksii Fedorov: [http/request] Make @uri memoized
<crystal-gh> crystal/master 2e8ef4c Oleksii Fedorov: [http/request] Add path and query accessors
<crystal-gh> crystal/master ba79a27 Oleksii Fedorov: [http/request] Fix usage of request.uri
<jhass> trapped: yes
<jhass> probably your method always returns nil though? idk, hard to guess anything without context
<trapped> it's a macro containing only {{ env "VARIABLE" }}
<trapped> seems like a git pull on the compiler fixed it
<jhass> doubt you need a macro for that btw
<jhass> a constant, method or even doing it directly somewhere should be just fine
<greenarrow> >> Time.now.at_end_of_year
<DeBot> greenarrow: # => 2015-12-31 23:59:59 +0000 - http://carc.in/#/r/gst
<travis-ci> manastech/crystal#6fd650f (master - Merge pull request #1564 from waterlink/http/request/provide-uri-component-accessors): The build passed. https://travis-ci.org/manastech/crystal/builds/81749388
<greenarrow> anyone know how i can just get the date
<greenarrow> as a string from that
<jhass> any desired format?
<greenarrow> YYYY-MM-DD
<jhass> >> Time.now.at_end_of_year.format("%Y-%m-%d")
<DeBot> jhass: undefined method 'format' for Time - http://carc.in/#/r/gsu
<jhass> :o
<greenarrow> :o
<jhass> >> Time.now.at_end_of_year.to_s("%Y-%m-%d")
<DeBot> jhass: # => "2015-12-31" - http://carc.in/#/r/gsv
<greenarrow> ty
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vnoPH
<crystal-gh> crystal/master 6604ae4 Ary Borenszweig: Fixed #1565: `Regex#match` didn't work well with empty strings
<jokke> are there any fuzzy string matchers for crystal?
<jhass> didn't notice any, but I kinda lost track about which projects exist
<jhass> it's getting too many :P
<jokke> hehe
<jokke> that's a good thing
<jokke> wow
<greenarrow> nice I contributed to 1
<jokke> last time i checked there were a little > 200
<travis-ci> manastech/crystal#6604ae4 (master - Fixed #1565: `Regex#match` didn't work well with empty strings): The build was broken. https://travis-ci.org/manastech/crystal/builds/81751480
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vno1x
<crystal-gh> crystal/master 1a51d79 Ary Borenszweig: XML: set node content/text and name
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vnoDf
<crystal-gh> crystal/master ecc6f05 Ary Borenszweig: Fixed StringScanner spec
<travis-ci> manastech/crystal#1a51d79 (master - XML: set node content/text and name): The build is still failing. https://travis-ci.org/manastech/crystal/builds/81753298
<travis-ci> manastech/crystal#ecc6f05 (master - Fixed StringScanner spec): The build was fixed. https://travis-ci.org/manastech/crystal/builds/81753825
Ven has joined #crystal-lang
greenarrow has quit [Quit: 500]
<crystal-gh> [crystal] jhass pushed 2 new commits to master: http://git.io/vnod8
<crystal-gh> crystal/master 367788c vjdhama: added documentation for stat, lstat and exists?
<crystal-gh> crystal/master 088689c Jonne Haß: Merge pull request #1566 from vjdhama/master...
dyulax has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<travis-ci> manastech/crystal#088689c (master - Merge pull request #1566 from vjdhama/master): The build passed. https://travis-ci.org/manastech/crystal/builds/81756356
greenarrow has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vnoxe
<crystal-gh> crystal/master 92e56a4 Ary Borenszweig: XML: recover on errors and set `errors` property in such case. Fixes #1404
<jhass> asterite: ah, it's rather about the restriction :)
<asterite> Oh, I'd like Enumerable there
<jhass> but yeah, that sounds like it'll be O(N) then
Ven has joined #crystal-lang
<travis-ci> manastech/crystal#92e56a4 (master - XML: recover on errors and set `errors` property in such case. Fixes #1404): The build passed. https://travis-ci.org/manastech/crystal/builds/81757964
<jokke> jhass: i added my 2ct
<crystal-gh> [crystal] jhass pushed 1 new commit to master: http://git.io/vnojl
<crystal-gh> crystal/master 3549b47 Jonne Haß: Fix example for lstat and clarify its differences to stat
<jhass> asterite: btw got two PRs open ... :P
<asterite> jokke: you are jreinert ?
<jokke> yeah
<asterite> Ah, ok :)
<asterite> Better use dup there
<asterite> jhass: we'll probably spend one day this week reviewing PR, we try to do this lately
<jokke> ah yeah
<asterite> #1554 looks good, though
<jhass> https://github.com/manastech/crystal/issues/1453 I've been thinking for days on this one, can't come up with anything :/
<asterite> And I guess #1529 is good too, because you know more git/github :-P
<jhass> I just use github/hub extensively
<asterite> Mmm.. for #1453 there are the iterator, but maybe it's too heavy. I think we can just remove that from the docs
<jhass> so $ git remote -v | wc -l
<jhass> 38
<jhass> and the first one isn't manastech/crystal ;)
<asterite> Oh, cool, you documented stat vs. lstat. I didn't know the difference, now it's much easier then checking the man page :-D
<asterite> jhass: Ooooh... I see what you mean. Yes, #1529 sounds good. You can merge :-)
<jhass> I said I'd rather not merge my own PRs ;)
<asterite> Oh...
<jhass> if you think something looks good there's a green button
<asterite> But lately you've been merging lot of PR and it's been really good
<jhass> and we can always fix mistakes later before a release
<asterite> I'll check with waj today then
<jhass> it's not like a extensively test locally. If CI is green and the changeset looks good, I just merge it
<jhass> we can always revert the merge or do follow ups if it turns out bad
<jhass> but a fast review process increases contributor count IME
<jokke> would you tend to accept a select_with_index! method for enumerable?
<jhass> idk that seems very specific
<jokke> yeah
<jokke> thought so too
<jhass> besides enumerable can't have bang methods
<jokke> ah true
<jokke> :D
<jhass> >> %w(a b c).each.with_index.select {|ei| e, i = ei; i.even? && e.alpha? }
<DeBot> jhass: undefined method 'alpha?' for String - http://carc.in/#/r/gsy
<jhass> >> %w(a b c).each.with_index.select {|ei| e, i = ei; i.even? && e.chars.first.alpha? }
<DeBot> jhass: # => Iterator::Select(Iterator::WithIndex(Array::ItemIterator(String), String), {String, Int32}, Bool)(@iterator=#<Iterator::WithIndex(Array::ItemIterator(String), String):0x9acce58 @iterator=#<Array::ItemIterator(String):0x9acef30 @array=["a", "b", "c"], @index=0>, @offset=0, @index=0>, @func=#<({String, Int32} -> Bool):0x805f5f0>) - http://carc.in/#/r/gsz
<jhass> >> %w(a b c).each.with_index.select {|ei| e, i = ei; i.even? && e.chars.first.alpha? }.to_a
<DeBot> jhass: # => [{"a", 0}, {"c", 2}] - http://carc.in/#/r/gt0
<jhass> idk
<travis-ci> manastech/crystal#3549b47 (master - Fix example for lstat and clarify its differences to stat): The build passed. https://travis-ci.org/manastech/crystal/builds/81759581
<jokke> jhass: sure, but that allocates a new array
<jokke> but you're probably right about it being very specific. I'll just monkey patch it when i need it
<jhass> maybe we find a nice interface for collection modifying iterators one day
<jhass> until then I'd say go with allocating a new one or tracking i externally
<jokke> yeah i did the latter
<jhass> but I wouldn't want to add too many special case methods everywhere
<jhass> each_with_index is on the border already really
<jokke> yeah i get that
jeromegn has joined #crystal-lang
ljfa has joined #crystal-lang
<jokke> cool
sfcgeorge has joined #crystal-lang
jeromegn has quit [Ping timeout: 250 seconds]
jeromegn has joined #crystal-lang
vjdhama has quit [Ping timeout: 246 seconds]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Philpax has quit [Read error: Connection reset by peer]
Philpax has joined #crystal-lang
apt-get has quit [Read error: No route to host]
<dyulax> I never used multithreading, and I am confused about all this terminology: processes, threads, fibers, locks, etc. Also, it seems OS behave differently regarding this. Does anybody know any good introductory text about multithreading? (I tried Google, still confused)
apt-get has joined #crystal-lang
Ven has joined #crystal-lang
<jokke> jhass: is there already an issue for this: https://p.jreinert.com/SpP/
<jokke> compiling it segfaults
Philpax has quit [Quit: Leaving]
<jhass> dyulax: I don't know any good tutorial, got most of it from my university courses. But you can ask questions if you want ;)
<jokke> dyulax: same here
<jokke> jhass: dining philosophers? :)
<jhass> hah, well that's just a tiny thing
<jokke> the philosophers? sure :)
<jhass> also had a nice course on concurrency stuff in general (Java though)
<jhass> your issue seems unfamiliar btw
<jokke> it always annoyed me that they've translated it incorrectly. It makes much more sense when there are chopsticks between them instead of forks
<jhass> hehe
<jokke> :)
<jhass> yeah I always eat with a single fork too
<jokke> most people do, go figure.
<crystal-gh> [crystal] waterlink opened pull request #1569: Add HTTP::Params class - convenient wrapper over raw http params (master...http/params/make-it-a-convenient-hash-wrapper) http://git.io/vnKZY
<jokke> even most philosophers
<jhass> idk here it's pretty common to use a spoon to "aid" for noodle stuff
<jokke> yeah
<jokke> true
<jokke> you're from germany, right?
<jhass> yup
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sfcgeorg_ has joined #crystal-lang
<dyulax> I am so lost I don't know exactly what to ask. I wish there was any Coursera class on this.
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vnKCS
<crystal-gh> crystal/master 0c77435 Ary Borenszweig: Remove redundant calls in lib calls
<dyulax> I will keep reading and then I ask :-) thanks
<jhass> dyulax: if you have a specific problem we can also probably suggest a general approach to look into, then by just researching how to implement it you should be able to get fairly far and learn some stuff drive by
sfcgeorge has quit [Ping timeout: 240 seconds]
<dyulax> What I am trying to do: I have a CPU with 8 cores. Let's say I have a huge CSV file I want to process. If I do that normally, my application will only use 1 core, but it could use 8. How could I use all of those 8 cores? Can I, Crystal, detect how many cores my CPU has and then create N new processes?
<dyulax> Alas, all these processes will be distributed among the cores or the OS will handle it?
Ven has joined #crystal-lang
<travis-ci> manastech/crystal#0c77435 (master - Remove redundant calls in lib calls): The build passed. https://travis-ci.org/manastech/crystal/builds/81767988
<jhass> dyulax: what does process mean? what operation do you do?
<jhass> Crystal is currently not well equipped for true parallelism
<dyulax> By process I mean this: http://crystal-lang.org/api/Process.html
<jokke> dyulax: you would have to spawn Threads manually
<jhass> but you could probably gain the maximum out of one core by interleaving your "processing" with the IO blocks using coroutines
<jokke> dyulax: and those would be pthreads
<jhass> dyulax: oh I meant the verb, what's the action that you do on the rows?
<jokke> dyulax: as in "real" threads which can be allocated to different cores
<jokke> and the os will handle it, yes
<dyulax> jhass: inserting the CSV row into a database table
<jhass> ah so IO -> IO
<jhass> you could already greatly benefit from using coroutines then
<jokke> yeah
<jokke> there's no computation that will keep the threads occupied. they mostly just block on io
<jhass> then the OS will use one core to read the file and the DB will use another core or two
<jhass> so you'll have 3-4 cores utilized even if your crystal program only uses one
<dyulax> hmmm
<jhass> and all you need to do is create a Channel, then spawn; csv_row = channel.receive; DB.insert(convert(row)); end;
<jhass> and then iterate over the CSV rows and send them to the channel
<dyulax> that's pretty neat :-)
<jhass> you'll probably want to give the channel some slack, Channel.new(32) or so
<jokke> jhass: is anyone actively working on true parallelism?
<jhass> jokke: dzv made some comments that he had a branch or two
<jokke> ok
<jhass> I think asterite & waj are designing a bit too
<jokke> sounds promisiing
<jokke> -i
havenwood has joined #crystal-lang
<dyulax> Question 2: if I create two fibers, my program will run until both are finished, or I need to "wait" for them inside a loop before exiting?
ljfa has quit [Quit: Leaving]
<jokke> you never need to wait in a loop. that would be active waiting and is discouraged
<jhass> ah you do need to block the root fiber though, mmmh
<jhass> yeah, actually swap it around
<jhass> spawn the CSV parsing and do the DB stuff in the main fiber
<jokke> normally you just call join or something on the thread which will block until the thread finishes. i don't know about fibers though
<jhass> then channel.close when you're done with the reading I guess
<jhass> mmh, meh looks like you can't drain the bufer of a closed channel
<jhass> *buffer
<jhass> Scheduler.yield until channel.empty?; channel.close I guess
<jhass> asterite: waj what do you think? For a buffered channel, don't raise until closed _and_ empty?
<jhass> on receive
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vnK6V
<crystal-gh> crystal/master fad1793 Ary Borenszweig: Fixed #1570: special handling of `nil` when passed to variadic args
jeromegn has quit [Ping timeout: 240 seconds]
<jokke> asterite: you sure are fast ;)
jeromegn has joined #crystal-lang
greengriminal has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<travis-ci> manastech/crystal#fad1793 (master - Fixed #1570: special handling of `nil` when passed to variadic args): The build passed. https://travis-ci.org/manastech/crystal/builds/81773037
jeromegn has quit [Quit: jeromegn]
<dyulax> jhass: does the Crystal Channel class implements this? https://www.wikiwand.com/en/Channel_I/O (there is no doc, so I am trying to figure out)
kostya has joined #crystal-lang
<jhass> mmh, no that's something quite different
<jhass> a Channel is more like a classic queue, except for coroutines instead of threads
<jhass> but you don't even need to know that much about it, for now "what you put into .send will come out of .receive" should be enough
<jhass> we'll deal with terminating the pipeline (it's essentially a small pipeline or producer consumer pattern we're doing here) once that part works, eg. when you have a program that fails to quit when its done ;)
Ven has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
Ven has quit [Client Quit]
leafybasil has quit [Ping timeout: 252 seconds]
<sfcgeorg_> Do Crystal C bindings work with C++ libs too or just pure C?
<jhass> in theory they would work with C++ libs if you manually translated the mangling at hand on your system. So in practice no, best find or write a C wrapper
nopc0de is now known as j2k
<sfcgeorg_> Okay :) I'm wondering how hard it would be to write a Crytal wrapper for a native widget toolkit. Wx looks nice but is C++. Tk has a C lib I think but the docs are horrible.
leafybasil has joined #crystal-lang
j2k is now known as j2k_
<jhass> you've seen jhass/crystal-gobject ? :P
NeverDie has joined #crystal-lang
<jhass> now with improved signal handling! estimation: only 90% broken!
<jokke> :)
<jokke> jhass: have you actually managed to spawn some simple gui with it?
<jhass> sure, look at the samples
<jokke> oh!
<jhass> github_desktop_notifications uses it too
leafybas_ has joined #crystal-lang
leafybasil has quit [Read error: Connection reset by peer]
<jokke> why do you call it crystal-gobject?
<sfcgeorg_> Hmm interesting
<jhass> because it's a generator using gobject-introspection
<jhass> so _in theory_ it can handle all gobject based libs
<jokke> ah
<jokke> i see
<sfcgeorg_> Sounds complicated
sfcgeorg_ is now known as sfcgeorge
<sfcgeorge> I guess I have to learn what gobject is.
greengriminal has quit [Quit: Leaving]
greengriminal has joined #crystal-lang
<sfcgeorge> I was hoping to produce a simple GUI toolkit like Shoes in Ruby. Most GUI code seem horrible. I don't know how terse a wrapper could be in Crystal.
<jokke> gui code is always horrible
<andrew-l> yeah, just look at CSS... :-)
<jhass> I think the glade example (greeter.cr) is surprisingly terse already, for Gtk :P
<jhass> but yeah, even if the generator gets perfect, it'll need some manual glue code still and then one could think of building nice abstractions upon it
<sfcgeorge> I also found https://github.com/amerobin/sapphire which is a Crystal binding for Cocoa on OS X, but again the implementation is rather complex.
<jhass> well, GUI toolkits are complex
<jhass> HTML is complex too if we're honest
<sfcgeorge> Well I don't think they should be complicated :P http://shoesrb.com/walkthrough/
<sfcgeorge> Hmm I suppose I'm just used to HTML + CSS. JS makes a mess of it all though.
<jhass> well, let me rephrase, complex or guly
<jhass> *ugly
<jhass> :P
<jhass> and the JS part is what you write in code these days, both Qt and Gtk favor markup languages too for the most part these days (QML and Glade respectively)
<asterite> jokke: we were planning on removing curses from the standard library. You could do an ncurses binding and then do rofi-curses on top of that, using shards to connect them
<asterite> If you agree, I'll remove curses from the standard library
<sfcgeorge> All the ones I've seen certainly are complex and/or ugly, which is why I'd like to make a crystal_tk_shoes or something. But then I still have to write the nasty interface code.
<jokke> jhass: i just pushed my curses project to github (first travis project for me!). https://github.com/jreinert/rofi-curses It has a very weird bug: if it's being passed a _lot_ of lines either via stdin or file it segfaults exactly after three chars are entered.
<asterite> There's obviously no pressure, but if somebody asks what happened to the (very poor and incomplete) bindings, we can point them to your repo (again, this is very unlikely to happen)
<jokke> asterite: i do agree. the stdlib bindings are very limited
<jokke> i'll split them up when i get the chance
<sfcgeorge> Hmm while a dynamic language is nice for GUI dev it seems like another layer of complexity on top of GTK. And why JS not Python or Ruby :-/
<asterite> I'll remove them then. In any case none of us want to maintain that and it can perfectly be a 3rd party library
<jokke> anyway removing it from stdlib won't break my code since i use my own bindings
<jhass> sfcgeorge: ruby-gir and python-gobject ? ;)
<jhass> wait, python-gobject-introspection, they like the long names :P
<jokke> python m(
greengriminal has quit [Quit: Leaving]
<sfcgeorge> Right. There's just a lot to get your head around before doing anything.
<jokke> sfcgeorge: that's why i never write guis :D
<jokke> i did back when i coded java
<jokke> but personally i almost always prefer console programs over gui
<jokke> the only gui program i use is firefox and robomongo
<jokke> *s
<jokke> or rather "frequently use"
<sfcgeorge> I have done Java Swing and that's alright, though I did write a wrapper to make creating buttons not take 7 LOC ;) But Swing isn't native so it feels off.
<jokke> yeah
<jokke> and
<jokke> java
<sfcgeorge> Hehe. Well Java 8 got lambdas (kinda) that shorten a lot of code, so that's kinda nice.
wonderbread_ has joined #crystal-lang
<jhass> asterite: saw my earlier suggestion regarding buffered channels?
wonderbreadz has quit [Ping timeout: 244 seconds]
wonderbread_ is now known as wonderbreadz
<asterite> I guess waj should answer that, don't know if he's reading this (he got a bouncer :-P). If you close a channel, remaining items must be seen in the receive side, as far as I know
<jhass> if I read the implementation right (granted, I didn't actually try), close will kill all current receivers
<jhass> regardless if the channel is drained or not
<jhass> waj: you need to configure auto away if you disconnect from the bouncer ;P
dyulax has quit [Read error: Connection reset by peer]
dyulax has joined #crystal-lang
Ven has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vn6za
<crystal-gh> crystal/master 9c164d8 Ary Borenszweig: Fixed a small typo
n0xff has joined #crystal-lang
<travis-ci> manastech/crystal#9c164d8 (master - Fixed a small typo): The build passed. https://travis-ci.org/manastech/crystal/builds/81794837
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
BlaXpirit has quit [Quit: Konversation]
elia_ has joined #crystal-lang
willl has joined #crystal-lang
kostya has quit [Quit: Leaving]
elia has quit [Ping timeout: 240 seconds]
Ven has joined #crystal-lang
Ven has quit [Client Quit]
vjdhama has joined #crystal-lang
<vjdhama> Is there any 3rd party project building irb like thing for crystal?
jeromegn has joined #crystal-lang
<sfcgeorge> That appears to be written in Ruby. But it should be possible to write a Crystal REPL in Crystal as the Crystal compiler can be used from within Crystal :)
<sfcgeorge> Oh right that's what the last comment does https://gist.github.com/georgi/d2c8210d76f3edd3a1a5
kulelu88 has joined #crystal-lang
vjdhama has quit [Remote host closed the connection]
jeromegn has quit [Quit: jeromegn]
elia_ has quit [Quit: Computer has gone to sleep.]
<RX14> why do we still have global variables? are they really needed?
<RX14> what's the point of the magic variables?
shama has joined #crystal-lang
<RX14> oh, i see
<RX14> woah, the new docs format is super cool
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
Ven has joined #crystal-lang
<jhass> we need a devdocs.io style search, but yeah :P
<RX14> also, there doesn't seem to be anything in the crystal stdlib for being a websocket server
<RX14> you would have to do the HTTP upgrade yourself, then create a websokcet connection right?
ssvb has quit [Ping timeout: 240 seconds]
<jhass> http://crystal-lang.org/api/HTTP/WebSocket.html#open%28host%2Cpath%2Cport%3D%3Cspanclass%3D%22n%22%3Enil%3C%2Fspan%3E%2Cssl%3D%3Cspanclass%3D%22n%22%3Efalse%3C%2Fspan%3E%29-class-method
<RX14> server
<RX14> that connects to a server
<RX14> oh
greenarrow has quit [Quit: 500]
<RX14> what
<RX14> how could I miss that
<RX14> i LOOKED in the HTTP namespace
<RX14> i'm so blind
<jhass> :P
greenarrow has joined #crystal-lang
greenarrow has quit [Max SendQ exceeded]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RX14> is there a nice way of specifying a middleware stack and then a final block?
<RX14> it looks like if you use middleware, you need to implement HTTP::Handler
BlaXpirit has joined #crystal-lang
<RX14> passing a block to build_middleware would be nice...
<jokke> jhass: why can't we use yard?
<jhass> pretty sure yard uses a ruby parser
<jokke> let's fork it then! :D
<jhass> hf
<jokke> hehe
<jhass> I'm thinking about writing an exporter for devdocs.io though
<jokke> what's the docs format now?
<jokke> just plain markdown?
<jhass> pretty much
<jhass> `Foo` is special cased to link to class/method
<jhass> if found
<jokke> oh ok
<RX14> jhass, http://carc.in/#/r/gtg should I PR something like this in to crystal?
<RX14> you can use a proc, but that requires ugly braces
<RX14> oh
<jhass> I think
<jhass> compiles at least :P
<RX14> what
<RX14> how does that even work?
<jhass> overload
<RX14> Error in line 3: 'HTTP::Server::build_middleware' is not expected to be invoked with a block, but a block was given
<RX14> this implies it will never take a block
<RX14> how can adding brackets make it work?
<RX14> wait
<RX14> derrp
<jhass> guess I passed it as port :D
<RX14> yes, yes you did
<jhass> agreed, there's an overload missing
<jhass> http://carc.in/#/r/gti should work
<RX14> ok, add the overload to build_middleware too?
<jhass> I think that's semi private API
<jokke> jhass: yard can at least parse c files too
<RX14> hmmn
<RX14> ok
<jhass> jokke: well, rdoc
qard has joined #crystal-lang
vjdhama has joined #crystal-lang
<jokke> it works
<jokke> sure it doesn't know macro or so but it parses defs just fine
<jokke> ah
<jokke> that was coincidence
<jokke> syntax error
<jokke> meh
ssvb has joined #crystal-lang
leafybas_ has quit [Ping timeout: 250 seconds]
havenwood has joined #crystal-lang
<crystal-gh> [crystal] kostya opened pull request #1571: allow nil values in record (master...record_nil) http://git.io/vniuS
<sfcgeorge> How do you write a typedef like this in Crystal? `typedef void Tcl_FreeProc(char *blockPtr);`
<asterite> I learned about that some days ago :-)
<asterite> ailas Tcl_FreeProc = LibC::Char* ->
<sfcgeorge> Aah thanks :) I looked at alias docs but it doesn't mention that lambda syntax
<asterite> It's here: http://crystal-lang.org/docs/syntax_and_semantics/type_grammar.html but you are right, it's not linked in the alias section
pragmatism has joined #crystal-lang
greengriminal has joined #crystal-lang
DJ has joined #crystal-lang
pragmatism has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
DJ has quit [Quit: Leaving]
greengriminal has quit [Quit: Leaving]
greengriminal has joined #crystal-lang
leafybasil has joined #crystal-lang
<sfcgeorge> Ooh I see what's happening, thanks asterite
ozra has joined #crystal-lang
<asterite> Wow, just found this method: http://ruby-doc.org/core-2.2.0/File.html#method-c-size-3F
<asterite> size raises, size? returns nil :-)
<RX14> I get https://gist.github.com/RX14/6561f80abb6c6c693a0e when building crystal
<buggs> why aren't you using onigoruma instead of pcre?
<slash_nick> onigoruma? demon wheel?
<bjmllr> you mean onigmo? ruby switched to that around 2.0 iirc. i think some people would have preferred it, pcre was just easier to set up, as i understand it.
<bjmllr> pcre docs are much more complete imo
ljfa has joined #crystal-lang
ljfa has quit [Client Quit]
<jhass> buggs: what bjmllr said, it's not out of question yet, pcre was just way easier to integrate for now
<RX14> jhass, got any idea on that compiler error?
<jhass> RX14: make clean and make sure you got crystal 0.8.0 installed
<RX14> oh...
<jhass> alternatively git checkout 0.8.0; make; git checkout -; make
<RX14> why isn't community updated to 0.8.0 yet?
<jhass> anatolik is on vacation or something
<jhass> said he'll do it by the end of the month
<asterite> Yes, pcre was our first option. What is the benefit of onigmo?
<RX14> can nobody else accept patches?
<jhass> I updated my OBS repo thus
<RX14> i suppose the is responsible for his package
<RX14> he*
<jhass> yeah
<RX14> ok, i compiled
<RX14> yay
<RX14> i broke the specs
<RX14> wooo
<RX14> def initialize(@port, handlers : Array(HTTP::Handler), &block = nil : Request -> Response)
<RX14> why is this invalid?
<jhass> I guess because we overload on the block
<jhass> dunno
<jhass> gosh I hate omnibus
<asterite> RX14: `&block = nil` is a syntax error
<asterite> you either pass a block, or don't
<asterite> and they define different overloads
<RX14> but i want an optional block...
<RX14> so I have to overload
<asterite> For now you'll have to define two overloads
<asterite> But there's already def initialize(@port, handlers : Array(HTTP::Handler))
<asterite> so that overload is covered... no?
<RX14> no
<jhass> asterite: we thought something like HTTP::Server.new(8080, [LogHandler.new]) do |request| ... end would be nice
<RX14> what is you want handlers AND a block
<RX14> if*
<asterite> Maybe we can have a ProcHandler so you can mix them all... at least I imagine it implementing it like that
<jhass> sounds verbose :P
<asterite> Hehe, I know
<RX14> it looks ugly with the block inside the array
<asterite> but handlers have a `next` property
<asterite> I mean, if you receive an array of handlers and a block, how do you combine them?
<RX14> well, build_middleware seems to fix that
<RX14> it already has a last_handler proc argument
<RX14> it's just not exposed in the HTTP::Server ctor
<jhass> asterite: the proc is the last handler always, it doesn't need a next
<RX14> build_middleware can be modified to wrap the last_handler proc in a handler that can be chained
<RX14> if needed
<jhass> I guess, tbh I'm looking at something else atm
<RX14> how many green dots are there in the spec?
<RX14> ohh, a yellow star
<RX14> purty
<buggs> bjmllr, jhass so no special reason, thx
<jhass> RX14: 2000 something I think?
<buggs> is there a way to use sse/avx or intrinsics?
<RX14> what, the spec failed?
<RX14> buggs, i think you can link to them with the C ffi
<RX14> you can try it
<RX14> but i don't think you can align memory
havenwood has quit [Ping timeout: 250 seconds]
havenwood has joined #crystal-lang
<buggs> it would just be nice to see highlevel support for such things
<RX14> yes, it would
<asterite> jhass: it's true. Just adding this is enough to make it work:
<asterite> def initialize(@port, handlers, &handler : Request -> Response)
<asterite> @handler = HTTP::Server.build_middleware(handlers, handler)
<asterite> end
<RX14> asterite, i did that :P
<asterite> :-D
<RX14> also somehow my specs broke?
<RX14> i'm trying on master
<RX14> the specs all pass
<asterite> what do you mean with "broke"?
<RX14> but it mysteriously shows a stacktrace and exits 0
<RX14> it has the summary of the specs at the bottom even!
pragmatism has joined #crystal-lang
<RX14> on master, no changes
<RX14> well, changes stashed
<jhass> are you on testing?
<RX14> on master
<jhass> I mean for Arch :P
<RX14> umm, no
<jhass> kay, so it's not LLVM 3.7
<RX14> llvm 2.6.2-4 installed
<RX14> 3*
<asterite> RX14: run it with -v and tell us in which spec it fails
<asterite> bin/crystal spec/all_spec.cr -- -v
<RX14> Error while requiring "prelude": can't find file 'prelude'
<RX14> what
<RX14> somehow it's using 0.7.7
<RX14> even though i have it build
<RX14> what the
<asterite> Is there a way to use different colors for users in limechat?
<RX14> i know in hexchat...
<RX14> limechat is for mac right?
<asterite> yes
<RX14> in bin/crystal CRYSTAL_DIR="/data/programming/crystal/bin /data/programming/crystal/.build"
<RX14> SCRIPT_PATH='/data/programming/crystal/bin
<RX14> /data/programming/crystal/bin/crystal'
<RX14> so realname impl is broken somehow
<RX14> flipping FANTASTIC
<jhass> asterite: looks like it's something the theme does in limechat oO
vjdhama has quit [Remote host closed the connection]
<RX14> something in my local environment makes CD output to stdout not stdin
<RX14> and it screws bin/crystal
<RX14> so i patched it
<BlaXpirit> wat
<jhass> ?!
<RX14> strange stuff
<BlaXpirit> RX14, it's correct
<RX14> so why does bin/crystal use cd 2>/dev/null?
<RX14> to quiet it
<RX14> it works when run by make, because it doesn't have the inherited shell functions
<RX14> but when i run bin/crystal manually, it breaks
<BlaXpirit> cd outputs nothing at all here anyway
<BlaXpirit> nvm
<crystal-gh> [crystal] RX14 opened pull request #1572: Add block to handler array ctor in HTTP::Server (master...http-server-block) http://git.io/vnPQF
<BlaXpirit> RX14, it's to silence errors, i dunno
<RX14> well, shall i PR the fix?
<BlaXpirit> what fix?
<RX14> - (cd "$dir" 2>/dev/null && printf '%s/%s\n' "$(pwd -P)" "$file")
<RX14> + (cd "$dir" 2>&1 > /dev/null && printf '%s/%s\n' "$(pwd -P)" "$file")
<BlaXpirit> i think it makes no diference
<RX14> well, not in my shell
<RX14> as evidenced by my testing, and it not working before, and it working after
<BlaXpirit> but your example is totally different
<RX14> well, that patch fixes the script, is all i know
<RX14> the point of the '2>/dev/null' is to silence cd, and this patch simply lilences it on stdout too
greengriminal has quit [Quit: Leaving]
greengriminal has joined #crystal-lang
dyulax has quit [Quit: Saindo]
havenn has joined #crystal-lang
havenwood has quit [Ping timeout: 264 seconds]
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/vnPpq
<crystal-gh> crystal/master 38839cc RX14: Add block to handler array ctor in HTTP::Server
<crystal-gh> crystal/master 5663e7a Ary Borenszweig: Merge pull request #1572 from RX14/http-server-block...
<travis-ci> manastech/crystal#5663e7a (master - Merge pull request #1572 from RX14/http-server-block): The build passed. https://travis-ci.org/manastech/crystal/builds/81858073
havenn is now known as havenwood
trapped has quit [Read error: Connection reset by peer]
BlaXpirit has quit [Read error: Connection reset by peer]
BlaXpirit has joined #crystal-lang
BlaXpirit has quit [Quit: Konversation]
greengriminal has quit [Quit: Leaving]
grindhold_ is now known as grindhold
sfcgeorg_ has joined #crystal-lang
sfcgeorge has quit [Ping timeout: 244 seconds]
ponga has joined #crystal-lang
Philpax has joined #crystal-lang
Liothen- has joined #crystal-lang
ozra has quit [Ping timeout: 246 seconds]
Liothen has quit [Quit: The Dogmatic Law of Shadowsong]
Liothen- has quit [Client Quit]
Liothen has joined #crystal-lang
Philpax has quit [Quit: Leaving]
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
havenwood has quit [Ping timeout: 265 seconds]
apt-get has quit [Ping timeout: 255 seconds]