RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.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
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <bew> I had to do this kind of parsing once for a school project, where we had to rewrite a simple `strace`, kinda bruteforce way but it works
moei has quit [Read error: Connection reset by peer]
moei has joined #crystal-lang
alex`` has quit [Quit: WeeChat 1.9]
jxv has quit [Quit: string on the can snapped off]
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
chromis has left #crystal-lang [#crystal-lang]
hightower3 has quit [Ping timeout: 265 seconds]
OceannBoy has joined #crystal-lang
faustinoaq has quit [Quit: IRC client terminated!]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 276 seconds]
rohitpaulk has joined #crystal-lang
faustinoaq has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
faustinoaq has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
OceannBoy has quit [Ping timeout: 256 seconds]
flaviodesousa has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
instancer73 has joined #crystal-lang
<instancer73> are macros not having access to instance variables ? because when im trying to use an instance variable array in the macro " for " then I get " unknown macro instance var: '@myarr' "
<instancer73> {% for arr in @myarr%}
A124 has quit [Read error: No route to host]
<instancer73> oh i understand now! its ok
A124 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <amadanmath> Just started, writing my first shard for fun and education; got stuck on spec. ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5a74254bb3c4a0d376cf0196]
<FromGitter> <amadanmath> `Spec.expect_raises(IndexError) { ... }` says `wrong number of arguments for macro 'expect_raises' (given 1, expected 1, 2, 3, 4)`
<FromGitter> <amadanmath> I have no idea what the error is trying to tell me
Papierkorb has quit [Ping timeout: 255 seconds]
jnyw has quit [Ping timeout: 260 seconds]
<FromGitter> <amadanmath> Ooh, never mind, removing `Spec.` fixes it.
<FromGitter> <aisrael> Stupid question: How do I ‘upcast’ in `Int32` to an `Int64`?
jnyw has joined #crystal-lang
<FromGitter> <aisrael> NVM I just discovered `n.to_i64`
Papierkorb has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
<FromGitter> <xfbs> Either that, or Int64.new(anytype) :)
<FromGitter> <xfbs> I've been there haha
<FromGitter> <xfbs> The Int64.new(anytype) syntax is useful for when you write generic classes, btw.
<FromGitter> <aisrael> Thanks. Will keep that in mind.
<FromGitter> <aisrael> Next stupid question: How can we check or test if we’re running in a test/spec? I know it’s not ideal but for now this will have to do. What am doing now is using a class instance variable (`testmode : Bool`) and setting that to `true` in `spec_helper.cr`. Is there a more elegant way to do this?
<FromGitter> <xfbs> Hmm, good question.. why exactly do you have to do that? Normally the way to go would be to use mocking I guess
<FromGitter> <aisrael> Am using Cossack. Since (currently) there’s no way to globally “inject” a `Middleware` (for testing, I want to log/record all HTTP calls, trying to make a VCR for Crystal), I have to resort to “if testing, inject test middleware"
alex`` has joined #crystal-lang
<FromGitter> <xfbs> Well I'm not sure, but there is one thing you could try: if the Cossack module has an internal method to send off a HTTP call, what you could do is you could override this method inside your tests, like so: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a742d7a4a6b0dd32b7c82e1]
hightower3 has joined #crystal-lang
<FromGitter> <xfbs> This way you don't have to clutter your main codebase with testing-related code
<FromGitter> <aisrael> Oh. I can override Cossack’s methods! Yeah didn’t realize I could do that. Thanks will give it a try
hightower3 is now known as hightower4
<FromGitter> <aisrael> Hmmnn… I just realize I’d also need to know what the current spec file and `describe` context is if I really want to mimic what VCR does. Looking at Crystal Spec’s docs I don’t think there’s an easy way to do that right now :(
<FromGitter> <xfbs> What is VCR?
<FromGitter> <aisrael> (Also, turns out I need to override `Cossack::Client.new` (or the `initialize`) method and that’s beyond my Crystal-fu
<FromGitter> <aisrael> VCR is the Ruby gem that silently and magically intercepts and records HTTP calls, then can play them back at a later execution. Useful for tests. You write and execute your code as normal, then VCR can record the interaction the first time, then just replay from thereon
<FromGitter> <xfbs> Ahh I see. Well maybe it would be useful if someone ported `vcr` to crystal? Seems like a nice gem :)
<FromGitter> <aisrael> I was hankering to do that… but… :)
rohitpaulk has joined #crystal-lang
hightower2 has joined #crystal-lang
instancer73 has quit [Quit: Page closed]
hightower4 has quit [Ping timeout: 240 seconds]
jnyw has quit [Quit: WeeChat 2.0.1]
<hightower2> mm how do I convert JSON Any to i64?
<FromGitter> <aisrael> @hightower2 `#as_i64`?
<FromGitter> <mamantoha> Hi! How can I loop through arrays parallel in Crystal? ⏎ ⏎ ```1_000_000.downto(1) do |i| ⏎ do_something(i) ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5a743f1a81cd9a5d7ea38778]
<FromGitter> <yxhuvud> @mamantoha please reformulate your question into something that makes a bit more sense
<FromGitter> <aisrael> Am I the only one who frequently gets confused between `[] of String` and `Array(String)`?
<FromGitter> <mamantoha> In my example, do_something will be run sequentially one after the other. But I would like them to be executed in parallel by 5 pieces for examples.
<oprypin> mamantoha, Crystal doesn't have parallel execution. if this is IO-heavy, you can settle for concurrent execution. start a fiber that sends these into a channel sequentially, and start 5 worker fibers each pulling from the channel
<oprypin> for parallel execution see https://gist.github.com/oprypin/00953b336673719dba25 - this is UNSAFE: no allocations are allowed inside workers
<FromGitter> <mamantoha> `GC Warning: Out of Memory! Heap size: 6285 MiB. Returning NULL!`. Anyway thanks @oprypin. I'll try to figure out what this code does)
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
hightower3 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
hightower has quit [Ping timeout: 276 seconds]
<FromGitter> <j8r> @aisrael I agree, one syntax should exist instead of two. I prefer the last one, leds confusing. Anyway there ishttps://github.com/mamantoha/crest
<FromGitter> <j8r> Using gitter on mobile is awful - changing to another tab of paste something make us send the message :(
OceannBoy has joined #crystal-lang
<txdv> is there a threadpool now that literally runs multiple threads?
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vNN33
<crystal-gh> crystal/master aa6521f Ary Borenszweig: Fix ASTNode#raise macro method (#5670)
rohitpaulk has quit [Ping timeout: 240 seconds]
OceannBoy has quit [Ping timeout: 276 seconds]
faustinoaq has joined #crystal-lang
<oprypin> j8r, so use irc lol
<oprypin> txdv, it's been there in that gist for like 3 years
<txdv> nice
<RX14> @j8r I tried to get the [] of String syntax removed but people complained it would be inconsistent with [...]
<RX14> and then removing the other one makes no sense either
<oprypin> doesn't it?
<RX14> well, how would the compiler codegen arrays thyen?
<RX14> the compiler internalls just calls Array(Foo).new and then << remember?
<RX14> [] of String literally expands to just
<RX14> begin
<RX14> Array(foo).new
<RX14> end
<RX14> s/foo/String/
<oprypin> does it really? wasn't it just for the Type{ } initialization?
<RX14> Type{} is just a generalization of []
<RX14> Array{"foo"} is exactly equal to [foo]
<RX14> uhh
<RX14> ["foo"]
alex`` has quit [Quit: WeeChat 2.0.1]
<FromGitter> <j8r> @RX14 Where it would be inconsistent?
<RX14> that ["foo"] of String works but not [] of String
alex`` has joined #crystal-lang
<travis-ci> crystal-lang/crystal#aa6521f (master - Fix ASTNode#raise macro method (#5670)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/336538149
olbat has joined #crystal-lang
<FromGitter> <faustinoaq> Hi, some ArchLinux user knows why I'm getting warnings on `amber-aur` package: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I marked crystal and shards as dependencies, because they ARE needed to use amber successfully, be namcap keep saying is not needed. Also why is warning about `/usr/lib/librt.so.1'` ? [https://gitter.im/crystal-lang/crystal?at=5a7466f4ce68c3bc7437746b]
alex`` is now known as alexherbo2
alexherbo2 is now known as alex``
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <faustinoaq> crystal stars vs commits XD
duane has joined #crystal-lang
<FromGitter> <imonmyown> guys timezone everyone!
<FromGitter> <imonmyown> did anyone have problems running crystal apps from VSCode on arch?
faustinoaq has quit [Quit: IRC client terminated!]
faustinoaq has joined #crystal-lang
<FromGitter> <imonmyown> seems like some environment variables did not make it into the shell environment used by VSCode :/
faustinoaq has quit [Read error: Connection reset by peer]
<FromGitter> <j8r> @RX14 I'm working on adding new targets. I'm seeing to types of syntax. Do I favor `fun access(name : Char*, type : Int) : Int` or `fun access(x0 : Char*, x1 : Int) : Int`- the first one maybe?
<FromGitter> <straight-shoota> @j8r names should follow the header files
<FromGitter> <faustinoaq> > did anyone have problems running crystal apps from VSCode on arch? ⏎ ⏎ @imonmyown Are you using vscode internal terminal?
<FromGitter> <imonmyown> I'm using a shell task in tasks.json
<FromGitter> <straight-shoota> These lib bindings are presumably going to be generated at one point
<RX14> Named is better
<RX14> The weird x0 is because they were auto generated
<FromGitter> <imonmyown> @faustinoaq I mean the run task I have configured. It doesn't reproduce with disabled extensions btw
<FromGitter> <j8r> I was thinking so too... I will take the named one. What is the most straight forward way to test if my bindings are correct, cross compile the compiler and test it with qemu?
flaviodesousa has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
<FromGitter> <faustinoaq> > I mean the run task I have configured. It doesn't reproduce with disabled extensions btw ⏎ ⏎ What vscode extensions are you using? `vscode-crystal-lang` doesn't touch the internal terminal, just provides syntax and some other basic features.
<FromGitter> <faustinoaq> @imonmyown ^
<FromGitter> <imonmyown> @faustinoaq I *am* using it and it is like one of the other three I'm using, so I'm kinda suspicious. Besides I'm not sure the configured tasks are using integrated terminal and not some other kind of special shell environment.
<FromGitter> <j8r> This won't be tomorrow that the bindings will be finished, but it's moving forward :-)
<FromGitter> <imonmyown> anyway, I filed an issue (https://github.com/Microsoft/vscode/issues/42829), so you can follow if you're interested. I have found a workaround for now.
<FromGitter> <faustinoaq> 👍
knight_ has joined #crystal-lang
<knight_> Are there any GUI libs other than libui.cr and Qt5? I can't get the Qt5 to work, and libui.cr seems really out of date.
rohitpaulk has joined #crystal-lang
<FromGitter> <faustinoaq> knight_, CrSMFL?
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
<RX14> knight_, you'd probably be better off getting qt5 to work
<jokke> there are qt5 bindings for crystal?
<jokke> cool!
<knight_> RX14, ok hmm.
qard has joined #crystal-lang
<RX14> knight_, if you need help then i'm happy to look at your error
<knight_> Thanks RX14. Yeah, let me paste it somewhere.
<RX14> i presume you're on the master-ready-to-use branch
<knight_> Yeah
<RX14> what are you using? mac?
<FromGitter> <vonKingsley> @aisrael @xfbs I ported VCR to crystal called HI8.cr https://github.com/vonKingsley/hi8.cr
<FromGitter> <vonKingsley> There still some work to be done on it, but should work to record http interactions
<Yxhuvud> awesome!
<FromGitter> <imonmyown> @RX14 `/Users/kevin` implies it's a mac
<RX14> oh yeah
<RX14> knight_, yeah qt5.cr doesn't work on mac right now
<RX14> ideally Papierkorb would be willing to do a debug session to find out how to make it work on mac
<RX14> because it should and can work on mac
<RX14> although the lack of errors is weird
rohitpaulk has quit [Remote host closed the connection]
<knight_> RX14: Ahhhh.
<knight_> Sorry, was in a meeting. Yeah, it's a mac.
<RX14> yeah
<RX14> Papierkorb doesn't have a mac so he can't work on getting it working
<RX14> i know if someone has a mac and is willing to get it working he'd accept the changes but so far not
<RX14> it works on linux
<FromGitter> <codenoid> morning
<vegai> b
<crystal-gh> [crystal] RX14 closed pull request #5668: Fix String#dump for UTF-8 charachters > \uFFFF (master...jm/fix/string-dump-utf) https://git.io/vNF1L
return0e has quit [Read error: No route to host]
return0e has joined #crystal-lang
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<travis-ci> crystal-lang/crystal#0491891 (master - Fix String#dump for UTF-8 charachters > \uFFFF (#5668)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/336665332
qard has joined #crystal-lang
<knight_> RX14: I'd be willing. Just need to figure out what to do.
<RX14> yeah
<RX14> well you need to install the qt5 development files and work out where they go and how to tell Papierkorb's scripts where to find the relevant files and directories
<RX14> knight_, do you have qmake on your path?
<RX14> actually knight_, you just need to comment on https://github.com/Papierkorb/qt5.cr/issues/3 or get Papierkorb on IRC
<Papierkorb> Don't have time right now (in 1.5hrs .. ish?), but the gist is that yeah, you need to provide qmake so it can find most files. You'll also need to edit config/find_paths.yml and just remove lines 56-65 for now. In any case, you need to get bindgen working first, use its test suite (just `crystal spec`) for that
<Papierkorb> If the test suite works, qt5 is just a (potentional) path fix away from working too knight_
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Papierkorb> And for bindgen you should only actually need: clang, llvm, and development libraries of both (basically, tons of static libs and headers)
<Papierkorb> You can use LLVM4.0 or 5.0, both work.
<Papierkorb> Use the master branch on qt5, the ready-to-use branch doesn't ship with macos files, only thing you get is a headache from getting your changes into the master branch otherwise :P
<RX14> i need to just steal someone's amc
<RX14> mac*
qard has joined #crystal-lang
<RX14> honestly I'm sure someone would be happy to arange for you to get a remote shell on their mac for a few hours Papierkorb
<FromGitter> <imonmyown> I'm currently trying to figure this out, if I fail (in 1.5hrs .. ish?), I'll arrange a remote shell
<FromGitter> <imonmyown> the problem I see now is that maverix, which I got downgraded to recently has no current support for crystal homebrew package. So need to download and install an update
<FromGitter> <imonmyown> Which might send me to constantly recurring reboots after update starts.
<FromGitter> <imonmyown> So-o-o.. remote shell is under the question
DTZUZU has quit [Read error: Connection reset by peer]
<lvmbdv> is there a reason these definitions are macros? https://github.com/crystal-lang/crystal/blob/master/src/openssl/lib_ssl.cr#L6
<oprypin> lvmbdv, well it's done so that it runs at compilation, not every time you run the program
<oprypin> but i guess it's not absolutely necesary
<lvmbdv> thanks
willamin has joined #crystal-lang
<crystal-gh> [crystal] Sija opened pull request #5675: Support BigDecimal comparison with and initialization from BigRational (master...bigdecimal-with-bigrational) https://git.io/vNAIv
<knight_> ~/w/c/w/rapp ❯❯❯ bundle exec ruby -v feature/20180201-meetings-controller-cleanup ✭ ✱
<knight_> oops, sorry
<RX14> lvmbdv, they're macros because we need to know their values at compile-time
<RX14> you can't choose what to link with based on runtime
<RX14> so you need to know at compile-time
<lvmbdv> i think i have a working fix for libressl now
<lvmbdv> it works with libressl, someone needs to test with openssl :^)
<RX14> lvmbdv, std_spec runs?
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<crystal-gh> [crystal] RX14 closed pull request #5667: Fix: string/symbol array literals recognize nested delimiters and escaped whitespace (master...jm/fix/percent-array-literal) https://git.io/vNFYV
<lvmbdv> i'm trying to test it with openssl before that
DTZUZU has joined #crystal-lang
<RX14> lvmbdv, surely you'd `make std_spec` with libressl then worry about if it runs with openssl
<lvmbdv> i'm doing it now .-.
<FromGitter> <erunks> Anyone in here use the shard lirith before?
<lvmbdv> RX14: is this good enough? https://paste.ubuntu.com/26509363/
<RX14> yes
<lvmbdv> it froze my whole computer at around the first 2 seconds btw
LastWhisper____ has joined #crystal-lang
<crystal-gh> [crystal] LVMBDV opened pull request #5676: Fixed OpenSSL bindings to recognize LibreSSL (master...fix/4676-libressl-support) https://git.io/vNAse
<travis-ci> crystal-lang/crystal#322d1c4 (master - Fix: string/symbol array literals nesting and escaping (#5667)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/336726351
moei has quit [Read error: Connection reset by peer]
moei has joined #crystal-lang
qard has joined #crystal-lang
<FromGitter> <j8r> What is llvm_ext.o?
<FromGitter> <j8r> A better question is: how to generate one for cross compilation?
<RX14> `make deps`
<RX14> on the target
<RX14> when cross-compiling you need the same version on target and host
<FromGitter> <j8r> ok I see
<FromGitter> <j8r> Not easy - I use docker containers to do so
<FromGitter> <aisrael> @vonKingsley Nice! FWIW I already got a functioning Cossack hook. But will check out Hi8 (no use reinventing the wheel) and maybe hopefully contribute
cremes has quit [Quit: cremes]
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
moei has quit [Quit: Leaving...]
cremes has joined #crystal-lang
duane has quit [Ping timeout: 268 seconds]
cremes has quit [Quit: cremes]
jnyw has joined #crystal-lang