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
duane has joined #crystal-lang
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duane has quit [Ping timeout: 256 seconds]
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
<FromGitter> <jeffutter> I'm pretty new to Crystal. I'm trying to figure out if there is some way to get access to tags when parsing a YAML document, any suggestions?
<FromGitter> <jeffutter> I would think that this would be a 'cheating' way to get access to it: https://play.crystal-lang.org/#/r/3q2j
qard has joined #crystal-lang
<FromGitter> <bew> yeah that's wrong
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qard has joined #crystal-lang
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alex`` has joined #crystal-lang
<FromGitter> <straight-shoota> https://crystal-lang.org/api/0.24.2/YAML/PullParser.html#tag%3AString%3F-instance-method
<FromGitter> <bew> here is an exemple with a converter https://play.crystal-lang.org/#/r/3q2x
<FromGitter> <bew> @straight-shoota do you know if there is a way to use a converter without a YAML (or JSON for that matter) without the mapping macro? like a simple thing like `Array(String).from_yaml ...` but each String obj would be created from a Converter.. Can't seem to find an easy way to do this..
moei has quit [Quit: Leaving...]
bonemind has joined #crystal-lang
flaviodesousa has joined #crystal-lang
<FromGitter> <straight-shoota> I don't think so
<FromGitter> <straight-shoota> Converter is only used by mapping macro
alex`` has quit [Quit: WeeChat 2.0.1]
moei has joined #crystal-lang
<f1refly> Can somebody here give me a hint why my code won't compile? I'm trying to create a singleton-like log class
<f1refly> Heres the class and output: https://hastebin.com/qecuzojeni.ruby
return0e has quit [Remote host closed the connection]
Papierkorb has joined #crystal-lang
Papierkorb has left #crystal-lang ["Konversation terminated!"]
return0e has joined #crystal-lang
<FromGitter> <aisrael> @f1refly Because in between `@@obj = Logger.new(STDOUT)` and the `return @@obj` theoretically, another fiber (or thread) could run and set `@@obj` back to `nil`
<FromGitter> <yxhuvud> Because the compiler isn't smart enough to figure out nothing else is chnaging the @@variable.
<FromGitter> <aisrael> @f1refly Try `return @@obj ||= Logger.new(STDOUT)` instead
return0e_ has joined #crystal-lang
return0e has quit [Read error: Connection reset by peer]
<f1refly> Ah, i didn't think of that. Yes, thats the problem
return0e_ has quit [Ping timeout: 264 seconds]
<f1refly> I'll try to work around it with a mutex
<FromGitter> <aisrael> I don't think a mutex is needed. The `||=` should be enough. There may be a corner case where (depending on the generated binary code) another thread can come in between the comparison of `@@obj != nil` and the assignment, but is that really a problem with `Logger`?
return0e has joined #crystal-lang
<f1refly> No, it isn't for the logger, but i wanted to create a universal singleton class that could potentially run into problems
<FromGitter> <aisrael> Well, you could use a constant.`LOGGER = Logger.new(STDOUT)` ⏎ But you don't get lazy initialization that way
<f1refly> It could go really bad though if i were to use the singleton with another class, since it could mean data loss when a new object is created, handed over and then discarded after potential manipulation
rohitpaulk has joined #crystal-lang
<crystal-gh> [crystal] ysbaddaden closed pull request #5648: Don't use heredoc inside interpolation (master...fix/crystal/dont-use-heredoc-inside-interpolation) https://git.io/vNMVT
<crystal-gh> [crystal] ysbaddaden closed pull request #5824: add HTTP OPTIONS method to HTTP::Client (master...http-client-options-method) https://git.io/vxULI
marius has quit [Quit: baj]
marius has joined #crystal-lang
<travis-ci> crystal-lang/crystal#863f301 (master - add HTTP OPTIONS method to HTTP::Client): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/353259799
<travis-ci> crystal-lang/crystal#52fa3b2 (master - Don't use heredoc inside interpolation): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/353259433
<FromGitter> <jeffutter> @bew Yeah, my use case falls into the scenario of not knowing the schema beforehand
shalmezad has joined #crystal-lang
alex`` has joined #crystal-lang
duane has joined #crystal-lang
tilpner_ has joined #crystal-lang
tilpner has quit [Ping timeout: 248 seconds]
tilpner_ is now known as tilpner
alex`` has quit [Ping timeout: 260 seconds]
alex`` has joined #crystal-lang
<FromGitter> <bararchy> how can I do something like ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5aa93286a60157d62fe7badc]
<FromGitter> <bararchy> or should I just if elsif
<FromGitter> <bararchy> ?
marius has quit [Quit: baj]
marius has joined #crystal-lang
<FromGitter> <bararchy> or even better ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5aa932e4e4ff28713a301807]
<FromGitter> <straight-shoota> first one should work
<FromGitter> <bararchy> should it?
<FromGitter> <straight-shoota> https://carc.in/#/r/3q9t
<FromGitter> <bararchy> that's awsome, didn't thought the syntax is ok with that\
<FromGitter> <bararchy> yap, GG me for not testing first
<FromGitter> <bararchy> sorry
alex`` has quit [Ping timeout: 264 seconds]
alex`` has joined #crystal-lang
alex`` has quit [Client Quit]
alex`` has joined #crystal-lang
<FromGitter> <mrfoto> hey - long time hobby crystal user here
<FromGitter> <mrfoto> got a raspberry pi zero - because why not
<FromGitter> <mrfoto> I see arm compilation is native in crystal but as far as I can tell it's still very hard/impossible to get crystal running on raspberry pi
<FromGitter> <mrfoto> the semi-official repo (portalier) is a couple of versions behind
<RX14> oh, thats unfortunate
<FromGitter> <mrfoto> and built against the old raspbian - jessie, not the current one - stretch
<RX14> hmm
<FromGitter> <mrfoto> so I'm a high level dev (coming from Ruby) so all this llvm stuff is way over my head :D but I am wondering if it would be possible to build binaries for arm processors with every release
<RX14> maybe we should have raspbian packages as part of the official release
<RX14> since it comes up quite often...
<FromGitter> <mrfoto> well that would be AWESOME :D
<RX14> @mrfoto it's actually not that hard to cross-compile
<RX14> well... if you can get the LLVM versions to sync up
<FromGitter> <mrfoto> but yeah, LLVM versions and all that `cc` thingy - I gave up :D
<FromGitter> <mrfoto> the whole reason why I think it would be good to have them as a part of official release is ⏎ a) yeah, it comes up often - I saw similar topics all over the place ⏎ b) crystal is much more resource efficient than ruby so it's perfect for a resource constrained env like rpi, especially the zero one
<RX14> hmm
<RX14> that'd actually be quite hard
<FromGitter> <mrfoto> ah, ok - like I said this is all way over my head :P maybe we just need to ping whoever is maintaining portalier to do a better job or provide some sort of instructions to get recent versions
<FromGitter> <straight-shoota> automatic build would require a arm CI runner
<FromGitter> <j8r> I've tried to build crystal on arm like you miha, and created issues: https://github.com/crystal-lang/crystal/issues/5467 and https://github.com/crystal-lang/crystal/issues/5689
<FromGitter> <j8r> we can use a qemu-static-arm to run arm code on ARM Docker image on x86_64
benharri has joined #crystal-lang
<FromGitter> <straight-shoota> yeah but emulated is not the real arch
<RX14> it's more than good enough
<RX14> although it'll take aaages to compile
<FromGitter> <straight-shoota> yes, it's better than nothing and should suffice to provide packages
<FromGitter> <straight-shoota> with the right setup it could even cross-compile from x64 and only link on qemu-arm
<FromGitter> <mrfoto> well it would take aaaages to compile on rpi 0 as well :D
<RX14> less time than emulated
<FromGitter> <mrfoto> really? emulation shouldn't be held back by the CPU power - while rpi 0 has armv6 @ 700mhz :D
<RX14> uhh
<RX14> emulation is super slow
<RX14> like really really slow
<FromGitter> <straight-shoota> qemu emulates the entire arm cpu
<FromGitter> <j8r> Yes, python and php needs 30minutes at least
<FromGitter> <straight-shoota> there is no hardware acceleration
<FromGitter> <mrfoto> well than how about getting some rpis and build on them? we can raise funds :P
<FromGitter> <j8r> scaleway's one are good, but then a rework of the CI will be needed :-/
<RX14> even if we had raspis we'd probably not use them
<RX14> since the CI currently runs on circleci
<RX14> and so you can't just plug whatever machine in
<FromGitter> <j8r> I've searched if Circle CI supports ARM - nothing found
<RX14> no it doesn't
<FromGitter> <j8r> One time builds with qemu is good enough - better than nothing
<RX14> and even then it'd likely be later armv8 instead of arnv7/6
<RX14> or whatever raspbian compiles for these days
<FromGitter> <mrfoto> well it doesn't have to be official official. If there's a set of instructions provided one can run binaries can be made available once the release is out - independent of the official CI
<RX14> yeah
<FromGitter> <j8r> aarch64 is backward compatible - nothing to worry :-)
<RX14> uhh
<RX14> thats impossible?
<wuehlmaus> hmm, https://freeshell.de/~wuehlmaus/error.txt i don't get crystal git compiled on my Apple with High Sierra. My fault?
<RX14> there's no way you can run an aarch64 binary on a 32bit processor
<RX14> the other way around sure
<FromGitter> <j8r> like x86 images can be runned on x86_64, armhf can be runned on aarch64
<RX14> yeah sure
<RX14> but you still have to compile for the lowest common denominator
<RX14> which is what raspbian does
<FromGitter> <mrfoto> @wuehkmaus - the file is not accessible
<wuehlmaus> oh sorry
<FromGitter> <straight-shoota> why did it turn out to move entirely (?) to circle-ci, anyway? RX14
<FromGitter> <j8r> we can have arm64 + armhf builds
<FromGitter> <straight-shoota> I remember you were working on setting up jenkins...
<RX14> @straight-shoota it was easier
<RX14> plus I obviously wasn't going to finish jenkins any time soon
<wuehlmaus> i think i fixed the link
<RX14> with circle we have something that works
<RX14> there's builds for 32, 64, and osx
<RX14> and circleci lets you do nightlies and release builds too
<FromGitter> <straight-shoota> okay
<FromGitter> <straight-shoota> so it's an easy working solution right now
<RX14> yes
<RX14> wuehlmaus, you're using llvm6
<wuehlmaus> that's the problem?
<RX14> yep
<wuehlmaus> oh
<FromGitter> <straight-shoota> circleci 2.0 was really a huge improvement
<RX14> i'm not 100% on how homebrew works
<wuehlmaus> i think i just used brew and upgraded
<RX14> but you might need to link? the old llvm@5 package
<RX14> homebrew is weird
qard has joined #crystal-lang
<RX14> everyone should just use linux :)
<FromGitter> <mrfoto> brew install crystal-lang will require llvm@5 and it'll work just fine
<FromGitter> <mrfoto> I fresh installed it this morning :P
<RX14> we really need a proper "nightly release download page"
<FromGitter> <mrfoto> anyway, I don't think rpi build needs to be a part of CI run - it can be a separate thingy like this portalier was. as long as it's updated regularly or there is some sort of automation that does it
<RX14> instead of the nightly release artifacts being cooped up on circleci
<wuehlmaus> mrfoto: yes, that crystal works
<RX14> @mrfoto yeah
<RX14> i mean the artifacts are these
<RX14> there*
<FromGitter> <straight-shoota> yeah a nightlies download page would be great
<RX14> the docker image iirc has a nightly tag
<FromGitter> <straight-shoota> yeah
<FromGitter> <j8r> btw, I was working on compiling crystal on Alpine for x86_64, arm64 and armfh - only succeed the first one for now
<RX14> someone should just
<RX14> properly package crystal for alpine
<RX14> and get it in the official repos
<FromGitter> <faustinoaq> RX14, What about http://public.portalier.com/alpine/ ?
<RX14> likely out of date
<RX14> plus being in the official repos is way way better
<FromGitter> <faustinoaq> Oh, Ok
<FromGitter> <mrfoto> the raspbian one is very outdated
<FromGitter> <mrfoto> idk how to check atm but iirc it was over 2 years old
<FromGitter> <faustinoaq> RX14, Do you think would be possible to publish arm binaries on crystal release page?
<FromGitter> <faustinoaq> This one https://github.com/crystal-lang/crystal/releases
<RX14> we just talked about that
<RX14> @mrfoto 2 years? unlikely
<FromGitter> <faustinoaq> Oh, yeah, my bad 😅
<wuehlmaus> i have llvm5 installed , how can i switch the make process to use it instead of 6.0 ?
<RX14> do you have llvm-config-5?
<wuehlmaus> it doesn't complete llvm-config-5
<wuehlmaus> but brew says i have llvm5
<wuehlmaus> ah, i think it is one correction in the PATH
<wuehlmaus> ah, that was it
<wuehlmaus> and brew told me
<wuehlmaus> i just neclected to read it :)
<wuehlmaus> neglected
<RX14> ok
<wuehlmaus> bam, it worked :)
<RX14> make crystal LLVM_CONFIG=llvm-config-5
<RX14> and you should be done
<RX14> idh
<RX14> ish
<wuehlmaus> environment variables are cool :)
<FromGitter> <mrfoto> @RX14 0.23.1-1 so yeah a year, not 2 years. still not quite fresh :P
benharri has quit [Quit: benharri]
Disrecollection has quit [Quit: Leaving.]
benharri has joined #crystal-lang
<FromGitter> <straight-shoota> yeah but 0.24.1 released less than 3 months ago, until then 0.23.1 was the most recent release
bonemind has quit [Quit: WeeChat 2.0.1]
<benharri> how's it going :)
<FromGitter> <j8r> Other topic, how create an `alias` for named tuple?
<FromGitter> <bararchy> in HTTP::Context.body, what is the way I can read it all? just handle as standard IO? is it Memory::IO ? the type is IO+ w\e that means
<RX14> it's just an IO
<RX14> IO+ means IO and subclasses
<FromGitter> <bararchy> ```code paste, see link``` ⏎ ⏎ Even though I know the body is filled, I still get an empty body [https://gitter.im/crystal-lang/crystal?at=5aa951da458cbde557343815]
<FromGitter> <bararchy> hm... puts io.to_s => `HTTP::FixedLengthContent`
<RX14> uhh
<RX14> maybe a middleware read the body before you
<RX14> idk
<RX14> either way that's not how you read from an IO
<RX14> p io.gets_to_end is easier to debug
marius has quit [Quit: baj]
<FromGitter> <bararchy> Maybe something in Kemal screws it up for me, I'll check with @sdogruyol
<benharri> anyone had luck installing in bash on windows?
alex`` has quit [Quit: WeeChat 2.0.1]
marius has joined #crystal-lang
marius has quit [Client Quit]
hightower2 has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
hightower has quit [Ping timeout: 240 seconds]
<FromGitter> <straight-shoota> benharri, sure
<FromGitter> <straight-shoota> no luck involved
<benharri> gpg: requesting key 7CC06B54 from hkp server keys.gnupg.net
<benharri> gpg: keyserver receive failed: keyserver error
<benharri> gpg: keyserver timed out
<benharri> ok didn't see this before. time to debug my network settings
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
flaviodesousa has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
azur_kind has joined #crystal-lang
marius has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 276 seconds]
<FromGitter> <j8r> How can avoid replicating the NamedTuple here? https://carc.in/#/r/3qan . I was thinking about using macros
alex`` has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
<RX14> @j8r you can't really
<RX14> plus that's a super duper weird named tuple
<RX14> why not just use a record
<RX14> then you can specify the defaults and constructors and whatever
<benharri> Segfault on windows bash
<benharri> Any ideas?
<benharri> straight-shoota: did you run in to this at all?
Groogy has joined #crystal-lang
shalmezad has quit [Quit: This computer has gone to sleep]
rohitpaulk has joined #crystal-lang
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qard has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 246 seconds]
qard has quit [Client Quit]
qard has joined #crystal-lang
p0p0pr37 has joined #crystal-lang
mangoicedtea has joined #crystal-lang
azur_kind has quit [Remote host closed the connection]
shalmezad has joined #crystal-lang
shalmezad has quit [Remote host closed the connection]
mangoicedtea has quit [Ping timeout: 245 seconds]
alex`` has quit [Quit: WeeChat 2.0.1]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
<Groogy> Am I blind but I can't find a pow function or anything :/
<Groogy> nvm I was blind and found it
duane has quit [Ping timeout: 265 seconds]
duane has joined #crystal-lang
<Yxhuvud> groogy! long time not being here!
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qard has joined #crystal-lang
<FromGitter> <straight-shoota> benharri, I'm not sure about the initial problem with crystal, but the valgrind report looks like https://github.com/Microsoft/WSL/issues/120
<FromGitter> <straight-shoota> what windows build are you using?
ua_ has joined #crystal-lang
duane has quit [Ping timeout: 276 seconds]
ua has quit [Ping timeout: 260 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 246 seconds]
ssvb has quit [Ping timeout: 240 seconds]