ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.30.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
<FromGitter> <Blacksmoke16> so i kinda just realized its actually super easy to new up classes based on annotation fields
<FromGitter> <Blacksmoke16> its my new fav thing
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/7ebp example usage (just messing around, not final by any means)
<FromGitter> <Blacksmoke16> main benefits : ⏎ 1) im thinking it could be made in a format agnostic way (i.e. yaml/json etc could share the same metadata) and just implement th actual logic based on that metadata ⏎ 2) much more flexible around if a property should be serialized ⏎ 3) when combined with DI, makes it quite powerful as you can inject ACL services or the current request etc [htt
<FromGitter> ... ps://gitter.im/crystal-lang/crystal?at=5d53583dd03a7c63e6223426]
coderobe has quit [Read error: Connection reset by peer]
coderobe has joined #crystal-lang
_whitelogger has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 258 seconds]
Raimondii is now known as Raimondi
DTZUZO has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
_whitelogger has joined #crystal-lang
ht_ has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
ht_ has quit [Remote host closed the connection]
<FromGitter> <naqvis> 👍
DTZUZO has quit [Ping timeout: 248 seconds]
<FromGitter> <watzon> Wasn't even aware of this https://github.com/samueleaton/raze
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <bararchy> @watzon seems mostly dead
<FromGitter> <elorest> Yeah I think that was most of a coding exercise. I tried getting him to join amber once and he said he had just written that for fun one month and wasn't using crystal anymore.
return0e_ has quit [Ping timeout: 248 seconds]
<FromGitter> <absolutejam_gitlab> Aw, but he wrote Sentry and that's a good little Crystal showcase
<FromGitter> <watzon> Lol interesting. It is above Kemal in the techempower benchmark right now
laaron has left #crystal-lang ["Leaving"]
<FromGitter> <absolutejam_gitlab> Jesus, macOS is a PITA for statically linking
<FromGitter> <absolutejam_gitlab> had to copy libevent to a different dir so that it stopped using the dynlib
devil_tux has joined #crystal-lang
<FromGitter> <mavu> ```Error: undefined method 'to_json' for NamedTuple``` ⏎ ⏎ is there a way to do this? [https://gitter.im/crystal-lang/crystal?at=5d53cdc51db76d0ffeccf154]
<FromGitter> <watzon> @mavu you need to import json first
<FromGitter> <watzon> `require "json"`
<FromGitter> <mavu> doh!
<FromGitter> <mavu> thanks >.>
alex`` has joined #crystal-lang
<FromGitter> <watzon> No worries. Sometimes you don't need to do that because something else you're importing is already importing json, so it can be easy to forget
<FromGitter> <mavu> yeah, othertimes its just being dumb :P
return0e has joined #crystal-lang
DTZUZO has joined #crystal-lang
DTZUZO has quit [Client Quit]
<FromGitter> <absolutejam_gitlab> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d53f693a4efe3718dfe863b]
<FromGitter> <absolutejam_gitlab> When trying to compile crystal 0.30.1 (crystal-git) on Manjaro
<FromGitter> <absolutejam_gitlab> Anyone else had issues? I've seen a couple of other people in here using Arch or derivatives
<FromGitter> <tenebrousedge> yes, people on Arch and derivatives have been having issues. Not that one, that I've seen, though
lucasb has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <absolutejam_gitlab> tatties.
<FromGitter> <kniknoo> I'm about to dive into the LLVM intro tutorial. Am I correct in understanding that Crystal's LLVM class is all I need?
Yxhuvud has quit [Remote host closed the connection]
<FromGitter> <tenebrousedge> you can check the unit tests to see if they require other things
<FromGitter> <kniknoo> Cool, noted. Thank you.
rohitpaulk has quit [Ping timeout: 272 seconds]
<FromGitter> <absolutejam_gitlab> it's so freaking weird writing Elixir now
<FromGitter> <absolutejam_gitlab> after writing only Crystal for the last few weeks
<FromGitter> <tenebrousedge> oh?
<FromGitter> <absolutejam_gitlab> Just minor differences
<FromGitter> <absolutejam_gitlab> `defmodule Foo.bar` vs `module Foo::Bar`, `def foo(num) do` vs `def foo(num : Int64)`
<FromGitter> <absolutejam_gitlab> I mean, there's obviously big differences, but they're not catching me out haha
<FromGitter> <tenebrousedge> ah
duane has joined #crystal-lang
devil_tu1 has joined #crystal-lang
devil_tux has quit [Ping timeout: 244 seconds]
duane has quit [Ping timeout: 272 seconds]
devil_tu1 has quit [Ping timeout: 272 seconds]
<FromGitter> <kniknoo> I just realized, due to my workflow of writing each class in playground before integrating it, I bet I'd be a lot more likely to both use and rely on unit tests if there were a spec tab on the playground. I *want* to get into the unit test habit, but due to playground being the most efficient means I have for on-the-fly testing it's more an afterthought than TDD.
<FromGitter> <tenebrousedge> few people working on real code actually do TDD
<FromGitter> <tenebrousedge> even DHH walked it back
<FromGitter> <tenebrousedge> a lot of the time, your requirements aren't clear or solid enough to be able to do so
<FromGitter> <kniknoo> Hmmm, understood. I still wouldn't mind a spec that runs with the kind of feedback that the playground allows.
<FromGitter> <tenebrousedge> the only time that I've actually written tests in advance was for very small and well-defined problems
<FromGitter> <tenebrousedge> well, you can do that
<FromGitter> <tenebrousedge> just write the tests in the same playground
<FromGitter> <kniknoo> Indeed. Will need to learn more about the web side at some point.
<FromGitter> <kniknoo> Oh
<FromGitter> <kniknoo> :D ok
<FromGitter> <kniknoo> require "spec" and follow the format inline?
<FromGitter> <tenebrousedge> yup
<FromGitter> <kniknoo> cool, thanks!
<FromGitter> <tenebrousedge> 👍
ht_ has joined #crystal-lang
ht_ has quit [Quit: ht_]
ht_ has joined #crystal-lang
<FromGitter> <kniknoo> Is it worth it for me to be learning to process STDIN one char at a time or should I do gets_to_end and lex the result?
flaviodesousa has quit [Quit: KVIrc 4.9.3 Aria http://www.kvirc.net/]
<FromGitter> <naqvis> I would say get all input and then iterate through that via `Char::Reader`
<FromGitter> <kniknoo> Cool, thanks!
<FromGitter> <naqvis> ywc
dingenskirchen has quit [Remote host closed the connection]
dingenskirchen has joined #crystal-lang
<FromGitter> <jwoertink> Has anyone tried upgrading crystal to 0.30.1 from homebrew?
<FromGitter> <naqvis> is that available in homebrew? It wasn't yesterday
<FromGitter> <jwoertink> Yeah, it is now
<FromGitter> <jwoertink> I upgraded but just didn't read it right. Thought I had an issue, but the real issue is I need more coffee
<FromGitter> <naqvis> 😆
<FromGitter> <naqvis> i'm running `brew update` to see if it will get updated list
<FromGitter> <jwoertink> I thought 0.30.1 fixed the shards update, but it just linked 0.8.1 again
<FromGitter> <naqvis> yeah, I see crystal formula updated
<FromGitter> <naqvis> is `0.30.1` linked against different `llvm`?
<FromGitter> <jwoertink> yeah
<FromGitter> <naqvis> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d543abf53490e334defca5d]
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d543ad92612bb718c68b19f]
<FromGitter> <naqvis> aha
beepdog has joined #crystal-lang
Yxhuvud has joined #crystal-lang
al2o3-cr has joined #crystal-lang
al2o3-cr has left #crystal-lang ["WeeChat 2.5"]
<FromGitter> <dscottboggs_gitlab> are there any libraries for creating graphs from some data in Crystal?
<rkeene> I wrote one in bash... maybe you could port that ? ;-)
<rkeene> Also in C
<FromGitter> <dscottboggs_gitlab> C is fine
<FromGitter> <dscottboggs_gitlab> I was thinking of maybe just dumping the data as JSON and trying to find a generic tool for graphing JSON data, but I'll certainly give that a try first
<FromGitter> <dscottboggs_gitlab> oh wow that's really nice
<rkeene> It's a pretty simple tool
<rkeene> It's meant for bandwidth so it reads values 2 tuples from a text file, in and out -- each tuple is time,value
<rkeene> You can license it however you want if you do anything with it -- I just wrote it to plot some bandwidth data for a tool I wrote 15+ years ago
<FromGitter> <absolutejam_gitlab> Jesus christ rkeene
<rkeene> Hmm ?
<FromGitter> <absolutejam_gitlab> You mad man writing that in bash
<rkeene> :-D
<FromGitter> <tenebrousedge> I mean, 15 years ago that made more sense
<rkeene> It's not too bad, most of the mathy stuff is in awk
<rkeene> The bash version is much newer
<FromGitter> <tenebrousedge> :(
<rkeene> I wanted a simple line chart tool that I could easily include as part of my CI stuff for a project and bash was the easiest way
<FromGitter> <tenebrousedge> but this was a Ruby project?
<FromGitter> <kniknoo> Programmers have the weirdest definitions of easy. :D
<rkeene> tenebrousedge, No, it was for a Linux distribution I maintained that integrated Ceph, OpenNebula, QEMU/KVM, and a few hundred other packages
<FromGitter> <tenebrousedge> :( okay
<FromGitter> <kniknoo> Oh neat.
<rkeene> OpenNebula used ruby heavily, but everything in the distribution was cross-compiled
<FromGitter> <naqvis> How to add inner-xml to an XML `element`? Calling `text` on `element` is escaping the contents. I've string representation of xml and want to add that to an xml element.
<FromGitter> <dscottboggs_gitlab> why doesn't this work? https://carc.in/#/r/7eg5
<FromGitter> <Blacksmoke16> just nest another element? @naqvis
<FromGitter> <Blacksmoke16> ```xml.element("foo") do ⏎ xml.element("bar") do ⏎ xml.text "inner" ⏎ end ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5d545afb1db76d0ffed13f7b]
<FromGitter> <Blacksmoke16> something like that
<FromGitter> <naqvis> yeah, but `#text` is escaping the contents
<FromGitter> <Blacksmoke16> can you make an example?
<FromGitter> <naqvis> sure
<FromGitter> <naqvis> ```code paste, see link``` ⏎ ⏎ Instead I need ⏎ `<body><p>Hello <b>World</b></p></body>` [https://gitter.im/crystal-lang/crystal?at=5d545c54a4efe3718d019b5f]
<FromGitter> <sam0x17> so what is the current trick for installing `micrate` as a CLI app? I thought shards was now at a point where we can install global binaries, or is that not the case
<FromGitter> <Blacksmoke16> oh so you have a string that has xml content
<FromGitter> <naqvis> yeah
<FromGitter> <Blacksmoke16> cdata?
<FromGitter> <dscottboggs_gitlab> My example works fine in C: ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5d545cac1dadc42a116ec4eb]
<FromGitter> <Blacksmoke16> but afaik its handling it properly so you have valid xml
<FromGitter> <naqvis> i tried that, but that makes that as 'cdata'
<FromGitter> <Blacksmoke16> whats the end goal here?
<FromGitter> <naqvis> i'm working on XMPP protocol and XMPP message expects XHTML to be as inner xml
<FromGitter> <lebogan> Just a warning note on compile with Crystal 0.30.1 on Fedora 30 running on vagrant vm with Virtualbox 6.0 provider. Error didn't occur on Crystal 0.30.0. Also happened on a Centos7 vm. ⏎ ⏎ Ran similar test compiles on my host machine running Fedora 30. Same error with 0.30.1 but, ok on 0.30.0. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d545d96d03a7c63e6298b44]
<FromGitter> <Blacksmoke16> its not really an error @lebogan
<FromGitter> <nsuchy> A compiler issue came back up that people here may be interested in
<FromGitter> <naqvis> expected generated XML should be like ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d545dc09507182477da9166]
<FromGitter> <Blacksmoke16> its just saying that method is deprecated and is failing to build because you're using `--error-on-warnings`
<FromGitter> <Blacksmoke16> so either update the reference to the deprecated method, or remove `--error-on-warnings`
<FromGitter> <Blacksmoke16> ideally the former
<FromGitter> <j8r> I have to look at build failure on aarch64 Alpine, as reported by mps
<FromGitter> <Blacksmoke16> @naqvis yea i dont think you can skip the escaping in the xml builder
<FromGitter> <naqvis> dirty hack in my use-case would be to decode generated xml, but I was thinking if there are some other/proper ways
<mps_> j8r: if you need help just ask
<mps_> I upgraded to 0.30.1, only x86_64
<FromGitter> <j8r> it failed at compilation?
<FromGitter> <j8r> I got ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d54610c029a51607f940c90]
<FromGitter> <lebogan> @Blacksmoke16 Thanks. I traced the error to crystal-email shard. Made the changes on my local copy and ok. Will post an issue on the relevant github repo.
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <Blacksmoke16> is prob fine to just not use the `--error-on-warnings` for now
<mps_> j8r: in my test it builds ok, but fails on 'make spec'
<FromGitter> <j8r> i built on alpine edge, with crystal from latest
<mps_> will post build log to tpaste.us later if you will be here
<FromGitter> <j8r> I have to build on latest?
<mps_> on edge, latest is v3.10, i.e. latest stable
<FromGitter> <j8r> but we have to add the 3.10 repo
<FromGitter> <j8r> to have crystal
<mps_> no, just edge
<FromGitter> <j8r> but crystal, which is absent on edge
<mps_> static version needed to build is downloaded from dev.alpinelinux.org as tarball
<FromGitter> <j8r> *crystal need crystal
<mps_> yes
<mps_> look at source field in APKBUILD
<FromGitter> <j8r> ok
<FromGitter> <Blacksmoke16> seems like it would be doable, but would require binding that extra method and adding an overload to the builder?
<FromGitter> <sam0x17> if you need to build statically on alpine, https://hub.docker.com/r/durosoft/crystal-alpine works really well
<FromGitter> <sam0x17> it has a lot of the dependencies people forget to add that tend to be broken e.g. lzma etc
<FromGitter> <j8r> @sam0x17 how do you add the static linking hack for llvm?
<FromGitter> <j8r> and better to have a minimal image, to have our own based on it with `from`
<FromGitter> <sam0x17> yeah for my purposes I need a general purpose one that works with arbitrary shards, which is why I made that one
<FromGitter> <sam0x17> `docker run --rm -it -v $PWD:/app -w /app durosoft/crystal-alpine:latest crystal build test.cr -o output --release --static --no-debug` the `--no-debug` tends to fix random linking issues sometimes for no apparent reason
<FromGitter> <sam0x17> my main philosophy being that anything that could be included via the stdlib should be buildable from my base image
<FromGitter> <sam0x17> not sure if that's true, but in practice it has been for me
<FromGitter> <Blacksmoke16> *lets find out*
<FromGitter> <j8r> so you will end up installing most `-dev`and `-static` alpine packages
<FromGitter> <sam0x17> basically
<FromGitter> <sam0x17> if I missed any let me know xD
<FromGitter> <j8r> that's not a good idea
<FromGitter> <sam0x17> why may I ask?
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d546422029a51607f94257b]
<FromGitter> <Blacksmoke16> :P
<FromGitter> <sam0x17> ugg always libxml2
<FromGitter> <Blacksmoke16> xD
<FromGitter> <sam0x17> hold on I have a one liner for it I think
<FromGitter> <j8r> so we won't be sure what's libraries are really needed for our app
<FromGitter> <sam0x17> yeah you will have to play with different and weird orderings of --link-flags typically to fix that
<FromGitter> <sam0x17> I had to do a dance with that when using crystallang/crystal
<FromGitter> <sam0x17> but switching to alpine fixed this particular issue for me
<FromGitter> <j8r> mps I know what was my issue here, I didn't `make clean`
<mps_> ah, good. 'abuild clean'
<FromGitter> <sam0x17> yeah looks like I dont have that snippet anymore sorry
<FromGitter> <sam0x17> but feel free to use my image as a starting point, and let me know if there is a dev library that you added that made it work @Blacksmoke16
<FromGitter> <j8r> mps I'm just using the git repo, no abuild yet
<mps_> aha, ok then
<mps_> but you can download static crystal 0.29.0 from dev.alpinelinux.org and use it to build new version
<FromGitter> <j8r> mps to avoid running the whole spec suite, what was the failing one? (I use qemu, very slow)
<FromGitter> <j8r> mps yes I do
<mps_> sigfault, iirc
<FromGitter> <j8r> directly, hooooo 💀
<mps_> Invalid memory access (signal 11) at address 0x20
<mps_> head -n 80 of build log
<FromGitter> <naqvis> @Blacksmoke16 I got that sorted out by parsing the html via `XML#parse_html`, iterating through the nodes, adding them to `XML::Builder`. Good I didn't imply any dirty hack 😆
<FromGitter> <Blacksmoke16> ah nice, decent solution
<FromGitter> <naqvis> thanks
<FromGitter> <j8r> oh yes mps, I got errors
<mps_> PR you posted to me few days ago didn't solved build on aarch64/musl
<FromGitter> <j8r> I have more details than you
<mps_> I reverted that patch but didn't help
<FromGitter> <j8r> maybe due to the llvm version bump
<mps_> the same result I had with llvm 8.0.0
<mps_> with llvm 5 or 6 it doesn't even build, on both arch's
<FromGitter> <j8r> :/
<FromGitter> <asterite> try passing `--no-debug`
<mps_> asterite: will try
<FromGitter> <j8r> don't fix it @asterite
ht_ has quit [Quit: ht_]
<mps_> j8r: confirm
<FromGitter> <j8r> mps I finally was able to figure to link statically to curl https://github.com/alpinelinux/aports/pull/9925
<FromGitter> <j8r> I have to ping maintainers on IRC, or better create MR on GitLab?
<mps_> we are moving to gitlab so MR is fine
<FromGitter> <j8r> you think I can hope having faster responses than in GitHub?
<mps_> not sure, but for future history and following issue GL seems better
<mps_> (and I can help on GL but not on GH ;-) )
<FromGitter> <j8r> 👍
<mps_> and our issue/bug report system is already moved to gitlab.alpinelinux.org
<FromGitter> <j8r> patchwork will go away too I suppose
<mps_> it sr.ht ML system
<FromGitter> <j8r> oh ok
sagax has quit [Remote host closed the connection]
dingenskirchen has quit [Read error: Connection reset by peer]
dingenskirchen1 has joined #crystal-lang
dingenskirchen1 is now known as dingenskirchen
return0e has quit [Ping timeout: 272 seconds]
return0e has joined #crystal-lang
jokke is now known as repo
repo is now known as jokke
jokke has left #crystal-lang ["WeeChat 2.5"]
<FromGitter> <absolutejam_gitlab> how can I iterate properties?
<FromGitter> <absolutejam_gitlab> can I use a macro, or convert to a hash or something?
<FromGitter> <absolutejam_gitlab> these are objects that have been deserialized from yaml
<FromGitter> <Blacksmoke16> example of what you want to do?
<FromGitter> <Blacksmoke16> you can use a macro but it has to be within a method
<FromGitter> <sam0x17> it helps if you make a macro that puts them in something like a class variable where you can process them later in your code
<FromGitter> <sam0x17> sometimes
<FromGitter> <sam0x17> depends what you doing
<FromGitter> <sam0x17> granite_orm has some really good examples in the source code
<FromGitter> <Blacksmoke16> 😬
<FromGitter> <Blacksmoke16> yea dont do that
<FromGitter> <Blacksmoke16> its kinda a frowned upon practice