jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.17.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
senorprogrammer has quit [Quit: senorprogrammer]
<travis-ci> crystal-lang/crystal#913c84b (master - Updated Changelog): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/136840234
kulelu88 has left #crystal-lang ["Leaving"]
triangles has quit [Ping timeout: 252 seconds]
Oliphaunte has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
Philpax has joined #crystal-lang
<crystal-gh> [crystal] jhass opened pull request #2797: Replace and rename all mentions of SSL with TLS (master...ssl_to_tls) https://git.io/voZac
bjz has joined #crystal-lang
bjz has quit [Max SendQ exceeded]
senorprogrammer has joined #crystal-lang
senorprogrammer has quit [Quit: senorprogrammer]
bjz has joined #crystal-lang
senorprogrammer has joined #crystal-lang
<crystal-gh> [crystal] jhass closed pull request #2273: resolves segfaults on older kernel versions (master...build_min_version) https://git.io/v2N5l
<Davy_CC> donpdonp: yes I got the same problem https://play.crystal-lang.org/#/r/117o
<jhass> a JSON array can contain any other JSON type
<Davy_CC> jhass: I saw that, compile-time check it's JSON::Type and runtime is Array(JSON::Type) right?
<jhass> yup
Oliphaunte has quit [Remote host closed the connection]
snsei has quit [Read error: Connection reset by peer]
<Davy_CC> so I have to do `value.map(&.as_a).map do |i|` because JSON::Type does not have `.as_a` method?
Oliphaunte has joined #crystal-lang
snsei has joined #crystal-lang
<jhass> yeah dunno, the JSON::Any stuff seems half baked still tbh, I never could get it to work beyond the first level either
<Davy_CC> okay
pawnbox has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
|2321 has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
dhk has joined #crystal-lang
Raimondi has quit [Quit: WeeChat 1.5-dev]
Raimondi has joined #crystal-lang
dhk has quit [Quit: Leaving]
paulcsmith_ has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 258 seconds]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
pawnbox has joined #crystal-lang
paulcsmith_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pawnbox has quit [Ping timeout: 244 seconds]
snsei_ has joined #crystal-lang
snsei has quit [Ping timeout: 276 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 272 seconds]
donpdonp has quit [Ping timeout: 252 seconds]
donpdonp has joined #crystal-lang
zodiak has joined #crystal-lang
zodiak_ has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
ryanw-se has quit [Quit: Leaving...]
<Davy_CC> Will Crystall support for starting multiple here documents in one line?
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
Raimondii has joined #crystal-lang
zodiak has quit [Read error: Connection reset by peer]
zodiak has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
senorprogrammer has quit [Quit: senorprogrammer]
Raimondii is now known as Raimondi
soveran has joined #crystal-lang
<BlaXpirit> Davy_CC, why would you do that? I don't understand
sandelius has joined #crystal-lang
sandelius has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<BlaXpirit> hm, can't find any good command line arguments parser
<BlaXpirit> gotta have one like JSON.mapping
<BlaXpirit> https://github.com/mosop/optarg looks cool but i'm looking for more features, for example, integer input
<Davy_CC> BlaXpirit: just ruby supports and want to know if crystal will support
<BlaXpirit> Davy_CC, I don't understand
<Davy_CC> Another question for heredoc, how can I call a method like `String#gsub` on the heredoc?
<BlaXpirit> Davy_CC, like normal.. what's the problem?
<Davy_CC> but not in Crystal
<BlaXpirit> actually no, you're probably right, this is a problem
<BlaXpirit> Davy_CC, you have to do it like this https://carc.in/#/r/118g because opening and closing of a heredoc must be alone on the line
<Davy_CC> or this https://carc.in/#/r/118l (but it's so ugly)
matp has quit [Remote host closed the connection]
<jhass> regarding multiple methods, we won't just do something because Ruby does it, you gotta show convincing usecases
<jhass> *multiple heredocs I mean
matp has joined #crystal-lang
trapped has joined #crystal-lang
<BlaXpirit> I dislike this https://carc.in/#/r/118m
ome has joined #crystal-lang
<BlaXpirit> how can I execute some function when my program is being closed (kill, interrupt, whatever)?
soveran has quit [Remote host closed the connection]
<BlaXpirit> at_exit, of course
<BlaXpirit> doesn't seem to catch interrupt :(
<jhass> Signal::TERM.trap do ... end
<Davy_CC> jhass: thanks, and https://github.com/crystal-lang/crystal/issues/2089#issuecomment-178586949 seems to be the point I want
<Davy_CC> I want to keep my code clean and simple that I don't have to create a tmp var for the heredoc
<jhass> Add a comment ;)
<BlaXpirit> how to send a JSON body in a HTTP request?
<BlaXpirit> I guess body: {stuff: 5}.to_json
jokke has quit [Remote host closed the connection]
jokke has joined #crystal-lang
<BlaXpirit> found a gotcha: HTTP::Client.get modifies the Headers object passed to it so it can't be reused. bug?
<jhass> BlaXpirit: mmh, adding Content-Length?
<BlaXpirit> jhass, yeah, that and more
<jhass> what else?
<jhass> I mean besides Content-Length it would add those anyway again
<jhass> but makes me wonder whether we can/should make it wrap a NamedTuple
<jhass> I would hate having to copy a hash for every request
<BlaXpirit> jhass, I supplied "Authorization", "Accept", and it permanently added "Host", "Content-Length", "User-agent", "Accept-Encoding"
<jhass> okay I guess Host could be troublesome if you were to reuse it for different clients
<BlaXpirit> jhass, no, making it a tuple would make some things impossible
<BlaXpirit> jhass, content-length is by far the most troublesome, it just makes everything hang
<jhass> yes
<jhass> I guess we have to copy it :/
<BlaXpirit> I don't think so.. i mean, these things could be added in a separate loop as the last stage instead of modifying the object
matp has quit [Quit: Textual IRC Client: www.textualapp.com]
<BlaXpirit> now I'm looking for a way to parse streaming JSON. I thought crystal could do it if I supply an IO but it consumes one extra token and expects EOF
<BlaXpirit> >> require "json"; io = MemoryIO.new(%<{"a": [5]}{"b": 6}>); p JSON.parse(io); p JSON.parse(io)
<DeBot> BlaXpirit: in line 21: can't require dynamically - https://carc.in/#/r/119e
Philpax_ has joined #crystal-lang
<jhass> BlaXpirit: no that would require redesigning and rewriting HTTP::Client at this point. Not saying that it may not be worth it, but I think fixing the behavior is more important first, the longstanding issue can then be getting rid of the copy again
<BlaXpirit> sure
Philpax has quit [Ping timeout: 252 seconds]
ome has quit [Quit: Connection closed for inactivity]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<crystal-gh> [crystal] jhass opened pull request #2801: Do not mutate the users HTTP::Headers object in HTTP::Client (master...http_client_headers) https://git.io/voZFC
ragmaanir has joined #crystal-lang
<BlaXpirit> sigh, couldn't tweak the stdlib JSON after all. unfortunately, the lexer also always reads an extra character and that's too much work to avoid
<BlaXpirit> "streaming json" https://carc.in/#/r/119i
Philpax_ is now known as Philpax
ragmaanir has quit [Quit: Leaving]
alanwillms has quit [Read error: Connection reset by peer]
alanwillms has joined #crystal-lang
pawnbox_ has joined #crystal-lang
<BlaXpirit> >> "\x20" # weird
<DeBot> BlaXpirit: # => "x20" - https://carc.in/#/r/119s
<jhass> >> 20.chr.to_s
<DeBot> jhass: # => "\u{14}" - https://carc.in/#/r/119t
<BlaXpirit> yeah thanks
pawnbox has quit [Ping timeout: 264 seconds]
alanwillms93 has joined #crystal-lang
alanwillms has quit [Ping timeout: 244 seconds]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/voZN5
<crystal-gh> crystal/master 3678687 Ary Borenszweig: Fixed #2798: Playground doesn't show error when it can't listen on port
senorprogrammer has joined #crystal-lang
<travis-ci> crystal-lang/crystal#3678687 (master - Fixed #2798: Playground doesn't show error when it can't listen on port): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/136922117
pawnbox_ has quit [Remote host closed the connection]
<jhass> always interesting how you're ignored until you actually do invest work :/
pawnbox has joined #crystal-lang
matp has joined #crystal-lang
<crystal-gh> [crystal] asterite opened pull request #2802: Make heredoc end if the end matches and a non-identifier char is found (master...feature/fix_heredoc) https://git.io/voZxs
pawnbox 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
<Davy_CC> I can't alias a generic type like `alias Foo(T) = Hash(Symbol, T)`, can I?
snsei_ has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<jhass> well if that doesn't work then no
<Davy_CC> is there any method can do this?
<jhass> you could try writing a wrapper struct that uses macro method_missing to delegate all methods
<Davy_CC> okay, thanks
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 272 seconds]
pawnbox_ has joined #crystal-lang
<Yxhuvud> jhass: well, if delegation is what you want, wouldn't forward_missing_to be a better macro to use?
<jhass> oh we got that?
pawnbox has quit [Ping timeout: 250 seconds]
<Yxhuvud> yeah.
<jhass> never realized :D
<jhass> well it's just defining the boilerplate macro method_missing
<jhass> aaand will currently break with 0.18
<Yxhuvud> :(
<jhass> asterite: ^ gotta patch up forward_missing_to for the dropped macro method_missing variant
icezimm has joined #crystal-lang
snsei_ has joined #crystal-lang
snsei_ has quit [Remote host closed the connection]
snsei_ has joined #crystal-lang
snsei has quit [Ping timeout: 272 seconds]
<Davy_CC> jhass: I dont understand the issue you mentioned
<jhass> mmh, in retrospect it's about doing class Foo(T); alias Bar = Array(T);
<jhass> sorry
<Davy_CC> oh i see
<Davy_CC> so, will the generic alias be available in the feture?
<jhass> perhaps, if you suggest it
<Davy_CC> maybe i can open a issue on github to suggest it?
<Davy_CC> :)
snsei_ has quit [Ping timeout: 252 seconds]
Philpax has quit [Ping timeout: 252 seconds]
snsei has joined #crystal-lang
Netfeed has quit [Changing host]
Netfeed has joined #crystal-lang
Oliphaunte has joined #crystal-lang
senorprogrammer has left #crystal-lang [#crystal-lang]
senorprogrammer has joined #crystal-lang
snsei_ has joined #crystal-lang
snsei has quit [Ping timeout: 240 seconds]
no0p has joined #crystal-lang
tommoor has joined #crystal-lang
<tommoor> any suggested patterns for reloading, particularly with kemal
<jhass> there's no code reloading support
<tommoor> re running the server on change would be okay for now, I was thinking of just using the npm watch module but if there is something written in crystal than I'd happily prefer that :)
<jhass> quick search turns up https://github.com/f/guardian
<jhass> no idea if/how usable that is
<tommoor> thanks @jhass - those look interesting
snsei_ has quit [Remote host closed the connection]
snsei has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
<crystal-gh> [crystal] jhass pushed 2 new commits to master: https://git.io/vonT8
<crystal-gh> crystal/master c2ae51d Jonne Haß: Do not mutate the users HTTP::Headers object in HTTP::Client
<crystal-gh> crystal/master 9d00831 Jonne Haß: Merge pull request #2801 from jhass/http_client_headers...
<jhass> BlaXpirit: ^ there you go, fixed
<BlaXpirit> thx
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vonTz
<crystal-gh> crystal/master 3c36108 Ary Borenszweig: Compiler: no need to requrie `dl`. Related to #2800
<crystal-gh> [crystal] senorprogrammer opened pull request #2805: Adds Char#swapcase and String#swapcase instance methods. (master...add-swapcase-to-char-and-string) https://git.io/vonT5
Oliphaunte has quit [Remote host closed the connection]
<jhass> Yxhuvud: first link in the readme is broken ;)
<BlaXpirit> Yxhuvud, I don't know what it does. Primarily, what is the output format?
<jhass> Yxhuvud: a class can be a namespace too, you don't need to use a module as toplevel namespace and then forward .new
<jhass> I would avoid "short" names such as sigfigs at least on the external names
<travis-ci> crystal-lang/crystal#9d00831 (master - Merge pull request #2801 from jhass/http_client_headers): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/136955104
<BlaXpirit> is there a convenient way to map an array with an external function, not a method
<BlaXpirit> like arr.map &Regex.escape
<BlaXpirit> i.e. shorthand for arr.map { |x| something(x) }
<Yxhuvud> fixed link.
<Yxhuvud> BlaXpirit: currently it is just methods to get statistical information, but eventually it will be able to output files compatible with hdrhistogram plotters, such as http://hdrhistogram.github.io/HdrHistogram/plotFiles.html
snsei_ has joined #crystal-lang
<Yxhuvud> jhass: Yeah, I know regarding the class/module, but I kinda expect the root to get some other methods as well eventually.
<jhass> BlaXpirit: I think you could do .map &->Regex.escape, though not sure it actually works and it's probably slow
<icezimm> tommoor: better late than never, I use Guard with crystal
<BlaXpirit> >> ["3*5", "[z]"].map &->Regex.escape
<DeBot> BlaXpirit: error instantiating ->Regex.escape - https://carc.in/#/r/11bs
snsei has quit [Ping timeout: 250 seconds]
<BlaXpirit> >> ["3*5", "[z]"].map &->Regex.escape(String)
<DeBot> BlaXpirit: # => ["3\\*5", "\\[z\\]"] - https://carc.in/#/r/11bt
<BlaXpirit> I need this often
<travis-ci> crystal-lang/crystal#3c36108 (master - Compiler: no need to requrie `dl`. Related to #2800): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/136955349
<icezimm> tommoor: check this if interested: https://gist.github.com/fernandes/45dde425e038ae2deae83e0e9688ebdd
snsei_ has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vonIQ
<crystal-gh> crystal/master c31a86c Ary Borenszweig: Improve a bit error message when accesing a global variable before it's initialized
Oliphaunte has joined #crystal-lang
<travis-ci> crystal-lang/crystal#c31a86c (master - Improve a bit error message when accesing a global variable before it's initialized): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/136960906
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
<shadowshell> tommoor/jhass/icezimm: I've been using guardian for a week or so. It isn't bad. Not a feature rich as guard gem, but works pretty well: https://gist.github.com/bramswenson/fc45a2c1b6dc3aa4c6740d115bd9ce68
yawniek has quit [Ping timeout: 244 seconds]
<shadowshell> it could stand for some better variable substitution options on the run lines
<shadowshell> but generally has stayed out of my way pretty well
Raimondi has quit [Quit: WeeChat 1.5-dev]
Raimondi has joined #crystal-lang
<shadowshell> i've also been using guard gem when i want to use the serverspec gem for testing things in crystal projects
<shadowshell> updated the gist with examples
<shadowshell> using guard-shell
<icezimm> shadowshell: great… thanks for sharing
<shadowshell> anytime :)
<icezimm> I don't worry about features, I'm only using 1 line hahahah
<shadowshell> word
<shadowshell> simple is sweet
<icezimm> +1
<icezimm> really liked your setup, I'm gonna use it, great to use things for the same env, and can help guardian improve :)
<shadowshell> indeed!
<shadowshell> i might take a whack at better subs for the run line if no one beats me too it
<shadowshell> working on things i find more interesting at the moment ;)
soveran has quit [Remote host closed the connection]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vontx
<crystal-gh> crystal/master b488b81 Ary Borenszweig: Improve a bit error message when accessing nilable class variables
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vonth
<crystal-gh> crystal/master c34db9b Ary Borenszweig: Fixed #2796: Block argument unpacking overwrites local variable
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
snsei_ has joined #crystal-lang
<travis-ci> crystal-lang/crystal#b488b81 (master - Improve a bit error message when accessing nilable class variables): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/136966563
snsei has quit [Ping timeout: 272 seconds]
snsei_ has quit [Remote host closed the connection]
snsei has joined #crystal-lang
Nik736 has joined #crystal-lang
<travis-ci> crystal-lang/crystal#c34db9b (master - Fixed #2796: Block argument unpacking overwrites local variable): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/136966624
<BlaXpirit> jhass, well I've rewritten a bridge bot in Crystal. that should be more appealing :D
<jhass> :D
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vonYY
<crystal-gh> crystal/master 09f90ba Ary Borenszweig: Small fix in IO docs
senorprogrammer has quit [Quit: senorprogrammer]
<icezimm> I'm in doubt of how using an Array with two values, not at same time, carcin is here: https://carc.in/#/r/11c6
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
<icezimm> I thought Array(Int32 | HashierValue) the `|` would indicate can be Int32 OR HashierValue on array
<icezimm> I'm probably missing some concept
soveran has quit [Remote host closed the connection]
<travis-ci> crystal-lang/crystal#09f90ba (master - Small fix in IO docs): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/136971571
<BlaXpirit> icezimm, yeah it's pretty annoying. https://carc.in/#/r/11c9
soveran has joined #crystal-lang
<icezimm> ohhhhh
<icezimm> BlaXpirit: thank you very much! :bow: :)
snsei_ has joined #crystal-lang
snsei has quit [Ping timeout: 258 seconds]
ozra_ has joined #crystal-lang
<crystal-gh> [crystal] jhass opened pull request #2807: Remove --cross-compile flags (master...remove_cross_compile_flags) https://git.io/von3p
ryanw-se has joined #crystal-lang
ozra_ has quit [Ping timeout: 240 seconds]
tommoor has quit [Quit: Connection closed for inactivity]
paulcsmith_ has joined #crystal-lang
paulcsmith_ has quit [Client Quit]
paulcsmith_ has joined #crystal-lang
bcardiff has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
soveran has quit [Remote host closed the connection]
ozra_ has joined #crystal-lang
bcardiff has quit [Quit: bcardiff]
Oliphaunte has joined #crystal-lang
<icezimm> jhass: thanks for the link :)
<icezimm> BlaXpirit jhass If I use some classes, isn't there a kind of "alias"?
<BlaXpirit> icezimm, explain more
<icezimm> usually I just use 2, 3 classes and I write all of them, but in this case I'm gonna use 5 classes, annoying to write 5 all the time
<icezimm> alias MyHash = (String | Int32 | Aclass | AnotherClass)
<icezimm> [] of MyHash
<icezimm> something like this
<icezimm> I'm looking for on doc but haven't found
<BlaXpirit> icezimm, this seems like the wrong approach. why do you need all these types in an array?
<BlaXpirit> icezimm, I think you've just written the right syntax for it, though
<icezimm> yeah, just have tried first :~
<icezimm> BlaXpirit: that's what I was trying to say: https://carc.in/#/r/11ca
<icezimm> I can use Hashier::MyHash on whole code… great!
soveran has joined #crystal-lang
paulcsmith_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
soveran has quit [Ping timeout: 272 seconds]
ozra_ has quit [Ping timeout: 244 seconds]