jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.7.4 | 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
sailorswift has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
zipR4ND has joined #crystal-lang
sailorswift has joined #crystal-lang
<vifino> Is there a blocking .gets for a TCPSocket?
NeverDie has quit [Read error: Connection reset by peer]
NeverDie has joined #crystal-lang
sailorswift has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<vifino> I'mma derp, nevermind me! \o/
luislavena has quit [Remote host closed the connection]
luislavena has joined #crystal-lang
zz_Cidan has quit [Ping timeout: 248 seconds]
luislavena has quit []
zipR4ND has quit [Ping timeout: 264 seconds]
sailorswift has joined #crystal-lang
strcmp1 has joined #crystal-lang
sailorswift has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
havenwood has joined #crystal-lang
<crystal-gh> [crystal] MakeNowJust opened pull request #1005: Add ordered list for Markdown (master...add-ordered-list) http://git.io/vmyXc
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
ufm has joined #crystal-lang
<ufm> hi, ppl. Anybody home?
<jhass> ufm: sup?
<ufm> one simple question - why crystal community ignores rosettacode ?
<jhass> I guess nobody found it interesting/important enough yet
<jhass> I don't think it's willfully ignored ;)
<ufm> http://rosettacode.org/wiki/Category:Crystal - I think this can be named "ignored".
<jhass> again, ignoring is a willful action IMO
<jhass> people do what's fun to them
<ufm> sometimes example code - better documentation for newbie, who know another language.
<jhass> creating libraries people will actually use is a lot more appealing to many ;)
<jhass> but anyway, why don't you contribute there then?
<ufm> because I - newbie. I know Erlang, Go and Forth.
<jhass> feel free to post your solutions for review then ;)
<jhass> do you have an account? http://rosettacode.org/wiki/100_doors#Crystal can be improved by using .each_with_index(1)
ufm has quit [Quit: Page closed]
BlaXpirit has joined #crystal-lang
wanderer_ has joined #crystal-lang
zipR4ND has joined #crystal-lang
havenwood has joined #crystal-lang
zipR4ND has quit [Ping timeout: 264 seconds]
<strcmp1> jhass, hey sorry do you mind translating a short clip from merkel?
<jhass> as long as it isn't the one with the refugee...
<strcmp1> nah i dont think so, it's a german guy: https://www.youtube.com/watch?v=8gzCDNIP2LE&feature=youtu.be&t=1m59s
<strcmp1> she seems to be rude and dismissive but i dont get it cos i dont speak german :(
<jhass> well heute show is a bit notorious of cutting stuff in a way that doesn't properly retain context
<strcmp1> could be but the way she says 'oh ja' seems really rude
<jhass> note it's shut really short, to the point that some intonation could've been cut away
<jhass> *cut
<strcmp1> alright but what is she replying to? i mean what was his question/statement?
<jhass> well, first of all it was at least two answers to different people
<jhass> none of them included the questions
<jhass> first part something about "and did you already submit a lawsuit?"
<strcmp1> but the blonde guy says something, and she replies 'oh ja'
<jhass> and to him "did you already seek for an apprenticeship? / What would you be interested in?"
<jhass> he answers with (landscape) gardening
<strcmp1> ok thanks :) her response is kinda weird then
<jhass> and yes the answer could be interpreted as a non gallant "that's what you look like"
<jhass> but again it's cut in a way that you can't be sure it was even as reaction to his answer if you're honest
<strcmp1> yeah that's possible but then again merkel could just be an ass :P
<jhass> her main skill is to not show any personality ... ;)
<strcmp1> yeah she's a tough cookie
<crystal-gh> [crystal] davydovanton opened pull request #1007: Add documentation about JSON serialization and deserialization (master...doc-json) http://git.io/vm9fI
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vm9fE
<crystal-gh> crystal/master 80fabdd Ary Borenszweig: Fixed #1006: mangle strings/symbols in LLVM IR in way that they don't conflict with external funs.
<crystal-gh> [crystal] asterite pushed 3 new commits to master: http://git.io/vm9TB
<crystal-gh> crystal/master 8bc8403 TSUYUSATO Kitsune: Add spec for ordered list
<crystal-gh> crystal/master 995f0db TSUYUSATO Kitsune: Add ordered list parser and renderer
<crystal-gh> crystal/master d0e4a82 Ary Borenszweig: Merge pull request #1005 from MakeNowJust/add-ordered-list...
<travis-ci> manastech/crystal#80fabdd (master - Fixed #1006: mangle strings/symbols in LLVM IR in way that they don't conflict with external funs.): The build passed. https://travis-ci.org/manastech/crystal/builds/71646164
asterite has joined #crystal-lang
<asterite> vifino: I originally started the few rosseta code samples. The main problem is that it takes time and manpower to do it, so that's basically the explanation of why there aren't many :-)
asterite has quit [Client Quit]
<travis-ci> manastech/crystal#d0e4a82 (master - Merge pull request #1005 from MakeNowJust/add-ordered-list): The build passed. https://travis-ci.org/manastech/crystal/builds/71646891
blue_deref has joined #crystal-lang
NeverDie has joined #crystal-lang
havenwood has quit [Ping timeout: 246 seconds]
havenwood has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vm9u2
<crystal-gh> crystal/master f4fbafa Ary Borenszweig: On "undefined method ...", show compile-time type if the receiver's type is different than the type that's missing the method. Related to #1008. Related to #982.
Ven has joined #crystal-lang
<crystal-gh> [crystal] colinmarc opened pull request #1009: Add Iterator#flatten. (master...iterator-flatten) http://git.io/vm9gg
<travis-ci> manastech/crystal#f4fbafa (master - On "undefined method ...", show compile-time type if the receiver's type is different than the type that's missing the method. Related to #1008. Related to #982.): The build passed. https://travis-ci.org/manastech/crystal/builds/71654397
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kulelu88 has joined #crystal-lang
<vegai> that's interesting
<vegai> in an amethyst controller, I have this:
<vegai> puts "foo".class
<vegai> puts request.body.class
<vegai> both output "String"
<vegai> but somehow if I try to do json "foo" that works, but json request.body gives me a type error
<kulelu88> vegai: what is the type error?
<vegai> in ./src/api.cr:22: no overload matches 'ItemsController#json' with types String?
<vegai> Overloads are: - ItemsController#json(body : String, status = 200)
<vegai> I see that I can force it to work by doing "json request.body.to_s"
<vegai> just wondering why I need to convert a String into a String before it's ok :)
<vegai> I suppose request.body isn't a string, but what then
<vegai> and why does its class method say it is
<kulelu88> could be an error in the docs/compiler.
<vegai> ok
<vegai> another interesting point is where I parse my input as json, which gives me a Hash(String, JSON::Type)
<vegai> but trying to use that hash via j["foo"] gives me a type error "undefined method '[]' for Int64"
<vegai> this is all on crystal-0.7.4 btw -- perhaps I oughta try the latest master too?
<vegai> but no more of this today, possibly tomorrow
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
blue_deref has quit [Quit: bbn]
zipR4ND has joined #crystal-lang
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
<jhass> vegai: for the first one, String? is actually a union, it's shortcut notation for String|Nil
<jhass> .class is evaluated at runtime, so you get String because in this instance you actually got one
<jhass> but you may get nil too, hence it's typed as String?
<jhass> String#to_s just returns self, so that call is free, Nil#to_s should return the empty string
NeverDie has joined #crystal-lang
<jhass> vegai: regarding the second issue have a look at https://github.com/manastech/crystal/issues/982#issuecomment-121156428
<jhass> ?json_union=https://github.com/manastech/crystal/issues/982#issuecomment-121156428
<DeBot> jhass: Set json_union.
<travis-ci> kidaa/crystal-2#3720caf (master - Attributes): The build passed. https://travis-ci.org/kidaa/crystal-2/builds/71670627
<jhass> meh and this issue :/
<zipR4ND> hey is there a way to save variables during macro evaluation? i create a bunch of getters via a class macro and would like to define a method later to give me an array of all the defined getters values
<jhass> no, but you could for example just do something like DEFINED_GETTERS << :{{name.id}}
<zipR4ND> oh, already thought of using constants .. thanks, i try
havenwood has joined #crystal-lang
NeverDie has quit [Read error: Connection reset by peer]
NeverDie has joined #crystal-lang
<vegai> jhass: yeah, I did notice the ? there, but didn't quite know what it meant
<vegai> thanks
<Kilo`byte> what good web templating languages for crystal are there?
<jhass> there's a mustache port, not sure how usable yet https://github.com/MakeNowJust/crustache
<Kilo`byte> kk
<Kilo`byte> doesn't really need to be very advanced xD
<Kilo`byte> apparently no logic - so probably no if/while etc
<jhass> and ECR in stdlib of course
<Kilo`byte> well, tbh i probably will do most of my stuff via json
<Kilo`byte> or ajax rather
flaviu has quit [Ping timeout: 264 seconds]
flaviu has joined #crystal-lang
flaviu has quit [Ping timeout: 256 seconds]
<Kilo`byte> another time i may write my own template language. mustache just seems a bit limiting
<Kilo`byte> but not now, no time
flaviu has joined #crystal-lang
BlaXpirit has quit [Quit: Konversation]
<thor77> jinja would be great :D
<thor77> but i think its too python-specific
<jhass> the non-eval variant of slim could be neat
<jhass> perhaps liquid
<thor77> are there some db-drivers available yet?
<thor77> (sqlite, postgres or mysql?)
<thor77> or even redis?
zipR4ND has quit [Ping timeout: 265 seconds]
<jhass> http://crystalshards.herokuapp.com/ press Ctrl+F ;P
<jhass> (yes, all of them)
<thor77> uh, yeah \o/
<thor77> how can i insert projects into this site?
<thor77> or is it just a parser parsing github every x hours for crystal-projects?
<willl> the postgres one is the best
<jhass> thor77: the latter
<thor77> willl: hehe :P
<thor77> jhass: any excpectations when you'll fix the gc-static-thing? i don't rly want to replace my gc
<jhass> it's fixed
<jhass> upstream needs a release and the official package needs an update then
<jhass> until then either write a git release package or rebuild the existing one without --disable-static
<jhass> the latter is all gc-static does
<thor77> okey, thanks :)
ozra has joined #crystal-lang
<ozra> Is there any method for returning a filtered array? (true = keep element in new arr, false = skip)
Locke23rus has joined #crystal-lang
<jhass> .select
<ozra> Thanks!
<jhass> I wonder if we have .grep too already
<jhass> >> %w(foo moo bar).grep(/oo/)
<DeBot> jhass: # => ["foo", "moo"] - http://carc.in/#/r/7k9
<jhass> \o/
<ozra> cool :) - mmm, but shouldn't this work? It says keep–readers is a bool!? `keep–readers = (@readers.select &.load–ok() == true)`
<jhass> there should also be .reject as the negating counterpart and .select! and .reject! as self modifying variants
<jhass> ugh, we allow - in variable names?
<jhass> but yeah, it's a bool
<ozra> jhass: They're beatiful, underscores are from the stone age! :) It's endash (unicode)
<jhass> you're doing @readers.select(&.load_ok?) == true
<ozra> Aha, shit.
<ozra> thanks!
<jhass> == true is rather pointless in a .select anyway
<ozra> Ok, I don't think I get what the &.notation _really_ is then :-P - yes, the explicit compare just made it more clear in the specific code...
<jhass> it's a plain syntax rewrite to {|e| e.expr }
<jhass> but it only consumes to the next whitespace
<jhass> so you could do .&load_ok?.==(true)
<jhass> but ew
<jhass> (that method name seems a bit itchy too... I have no idea what it would mean in the context of a reader-ish thing)
<ozra> Aha, wow, that's weird. Ok, then I get it.
havenwood has quit [Ping timeout: 240 seconds]
<ozra> It's load() actually.. load returns true if ok..
<jhass> I guess load? would be the idiomatic name then
<ozra> it's prototype stage, should probably be setup(), init(), prepare() or something ;-)
<jhass> and stop with the empty parens already :P
<ozra> I do... some times. I still find it clearer, I'll probably get used to the idiomatic crystal way.. maybe.. hopefully B-)
<ozra> I do find the "everything's a method" a consistent and good approach, just a bit odd "feeling" still.
zipR4ND has joined #crystal-lang
zipR4ND has quit [Ping timeout: 252 seconds]
blue_deref has joined #crystal-lang
kulelu88 has quit [Ping timeout: 256 seconds]
wanderer_ has quit [Quit: Page closed]
kulelu88 has joined #crystal-lang
<vifino> What is the escape to use the matches in gsub?
<vifino> I tried both "\1" and "\\1", both don't work :/
<jhass> iirc you have to use the block form for now
<vifino> And how so?
<jhass> >> "foobar".gsub(/f(o+)/) {|m| "b#{m[1]}" }
<DeBot> jhass: # => "bobar" - http://carc.in/#/r/7kb
<vifino> alright, thanks :)