jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
deavmi has quit [Ping timeout: 256 seconds]
deavmi has joined #crystal-lang
Xeago has quit [Ping timeout: 265 seconds]
Xeago has joined #crystal-lang
<FromGitter> <thelinuxlich> does anyone here uses rabbitMQ with Crystal?
<FromGitter> <thelinuxlich> @watzon I'm using your pool fork, and after half a hour consuming the pool it always throws during pool.checkout: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Do you know what could be causing this? [https://gitter.im/crystal-lang/crystal?at=5eeda1d6fa0c9221fc4c68dc]
<mps> jhass: iiuc, https://github.com/crystal-lang/crystal/pull/9508 isn't commited for 0.35.1?
<FromGitter> <didactic-drunk> @dscottboggs_gitlab I find `preview_mt` reliable with carefully chosen dependencies or managing shared data structures myself. Many shards aren't ready.
<raz> thelinuxlich: haven't used amqp with crystal (don't know if it has shards for it). just as a word of caution; unless you have a legacy system or very specific requirements i'd generally avoid amqp and rather stick with nats, sqs, kafka, redis et al
<raz> amqp is a collection of footguns and rarely a headache worth having
<FromGitter> <thelinuxlich> hmmm good advice, gonna test nats them
<FromGitter> <rishavs> Hey guys. I am working on stitching my routing to my controllers and want to understand how would I implement a pattern like this; ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ here is a quick carc https://carc.in/#/r/9atw [https://gitter.im/crystal-lang/crystal?at=5eedc12a47fdfd21edd49b5c]
<FromGitter> <thelinuxlich> like this? https://carc.in/#/r/9aty
<jhass> mps: no it's not :(
<FromGitter> <rishavs> Thanks! what is the `->` operator here? I have never used it before
<FromGitter> <thelinuxlich> it's a Proc, call executes it, like a anonymous func
<FromGitter> <rishavs> Thanks @thelinuxlich . I really appreciate the help
<mps> jhass: don't understand why they didn't merged patches. anyway, tomorrow I will try to build with patches you posted for 0.35.0
<jhass> 👍
zorp_ has joined #crystal-lang
<oprypin> mps, didnt merged because the release caused a bit of a freeze
<oprypin> couldnt merge just before 0.35.0 because it has had enough, better be safe
<oprypin> couldnt merge after 0.35.0 because master branch was also being used for 0.35.1 and that one had only regression fixes
<oprypin> now... it is maybe the time that things will start to flow in. then again, it's the weekend 😩
deavmi has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
sagax has quit [Ping timeout: 258 seconds]
<FromGitter> <manveru> is there some way to send the outputs from `Process.run` to a `Log` instance without a lot of plumbing?
<FromGitter> <grkek> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5eede56b3a0d3931faa2d7cf]
<FromGitter> <grkek> well shit that is a new one for 0.35.1
<FromGitter> <grkek> is this supposed to be happening?
<FromGitter> <grkek> as in is it intentional to fuck with the devs?
<oprypin> grkek, just nuke your cache
<FromGitter> <grkek> aight
<FromGitter> <grkek> Same error
<oprypin> no it's something on your side
<oprypin> like half one Crystal version and half another
<FromGitter> <grkek> its the fucking jwt shard
gangstacat has quit [Remote host closed the connection]
<jhass> is that the full output? maybe codegen crashed earlier?
<jhass> also language please
<FromGitter> <j8r> ... LLVM-dev wants to move from the `master` branch name
<FromGitter> <j8r> And also change whitelist and blacklist to allowlist and denylist...
<FromGitter> <j8r> Sometimes I wonder if people has nothibg more important to do than things like this
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/9av5 is it expected that `T` is collapsed to `Base` versus `User`?
<jhass> yeah, it is
<FromGitter> <Blacksmoke16> rip
<jhass> ah, no wait I see what you mean
<FromGitter> <manveru> i just noticed there's no `select` syscall in stdlib for some reason...
<jhass> well
<jhass> I think it only does it once you instantiate both
<jhass> or it never does? idk
gangstacat has joined #crystal-lang
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/9avg
<jhass> manveru: it's kinda incompatible with libevent
<FromGitter> <Blacksmoke16> doesnt look like it
<jhass> yeah, nvm, ignore me
<FromGitter> <manveru> i just wanna do `Process.run("something", output: Log.for("this"))`... :P
<jhass> I guess you could write a LogIO?
<FromGitter> <manveru> since that won't work, i thought i could pass a block, but then i have to figure out whether stdout/stderr have any output
<FromGitter> <Blacksmoke16> `reader, writer = IO.pipe`?
<FromGitter> <manveru> in ruby i'd use a select call for that, but not sure in crystal
<FromGitter> <Blacksmoke16> pass `writer` as `output` and `reader` as part of `LogIO`?
<FromGitter> <manveru> hmm
<FromGitter> <Blacksmoke16> `IOBackend`*
<FromGitter> <manveru> ooh
<FromGitter> <manveru> i somehow missed that
<jhass> IOBackend is for how logs are written
<jhass> it's log output, not log input
<FromGitter> <Blacksmoke16> right, hence using `IO.pipe`
<oprypin> jhass, wait what is wrong there?
<jhass> forgot to return self from <<
<oprypin> jhass, hm probably a bit weird to do log entries based on how they're being passed to the io (could be subject arbitrary splits based on buffer size)
<oprypin> to*
oddp has joined #crystal-lang
<jhass> yeah, it's generally weird
<jhass> how should it behave? buffer everything until close to emit as one entry?
<jhass> split lines?
<oprypin> both
<jhass> idk, it's manveru's idea :P
<FromGitter> <manveru> lol
<FromGitter> <manveru> hard to say, but i think linewise is best for terminal apps...
<jhass> well, you got a PoC there, have fun :P
<FromGitter> <manveru> i'm trying to spawn some threads that each run another application that has tons of output, and i want to distinguish which output came from where
<FromGitter> <manveru> yeah :)
<FromGitter> <manveru> i tried the pipe approach, but there's no way with that
<FromGitter> <manveru> thanks a lot
<FromGitter> <manveru> this already behaves perfect for my use, will tweak it if needed later :)
<oprypin> im not sure where i was going with this, but https://play.crystal-lang.org/#/r/9awb
<oprypin> to split by newline and also prevent unexpected splits by newline
<oprypin> to split by newline and also prevent unexpected splits by buffer borders*
<jhass> well you could still have an unexpected split if the line length exceeds IO::Buffered buffer size
<oprypin> yes but that can be seen as a feature ;)
<jhass> fair
<FromGitter> <manveru> it's really cool, yeah
<oprypin> IO::Buffered should have those methods implemented as empty, like IO, not abstract...
<oprypin> ok so there's this interesting problem i have on Windows. in Crystal i'm interfacing with another library, through C ABI, of course. to my best knowledge, the bindings I have written are correct, I even did many cross-checks (printf sizeof, etc). I also thought I had implemented the ABI correctly.
<oprypin> *but* when calling a particular function with a complex signature, everything silently crashes. and I determined that the crash happens after the crystal code has started the call and before entering the function body in C. so it must be messing up the stack. now, how do I diagnose this?
<FromGitter> <wyhaines> @manveru! It's been a long time. Nice to see that you are exploring Crystal!
<FromGitter> <manveru> oh hey :)
<FromGitter> <manveru> yeah, been using it on-and-off for a few years now... but recently getting to use it in more production stuff
<FromGitter> <manveru> it's pretty neat for our devops stuff, not many runtime errors, and still rather easy to write
<FromGitter> <wyhaines> Yeah. I'm looking at it right now for some devops-ish stuff. I started diving into it in earnest when the company that I am with now started looking in earnest at using my venerable Analogger package as a seed for a new project. I reimplemented it with Crystal, and then diverged it into the new codebase. It's been an absolute treat to work with, and that fact that unless there's an algorithm error, by the time
<FromGitter> ... it compiles, there are usually few or no runtime errors has me looking at devops stuff where I can apply it.
zorp_ has quit [Ping timeout: 256 seconds]
<FromGitter> <manveru> well, atm i'm building a replacement for NixOps with it :)
<FromGitter> <manveru> using Nix to generate terraform and machine configs, and Crystal to make the UX nice
<FromGitter> <manveru> but also used it for prometheus exporting, wrote a little chaos-monkey replacement for messing with network settings from the browser, making a process supervisor to keep a very unstable app running... and a bunch of other things
<FromGitter> <manveru> now i just wish i had time to publish all that :|
<FromGitter> <manveru> oh right, also built a webapp in Lucky, but that's not released yet either
<jhass> you may also compare the generated LLVM IR to what clang produces (clang -emit-llvm, llvm-dis) for that call
<oprypin> yeah i may execpt im too stupid for that
<jhass> nah
<jhass> it's pretty self explanatory if you stare at it for a while
<oprypin> lemme just try your fix for now :>
<oprypin> ayyyy it works 🎉🎉🎉🎉🎉🎉🎉
<oprypin> now, where did this misconception spread from
<oprypin> (thanks)
<jhass> I wonder that too
<FromGitter> <wyhaines> @manveru Nice.
<FromGitter> <manveru> i still use Ruby for Sequel and quick irb sessions... haven't found a good replacement for those in Crystal yet
<FromGitter> <manveru> but well, that's why nobody ever uses just one language :)
<oprypin> jhass, no it does come directly from here https://github.com/rust-lang/rust/blob/29ac04402d53d358a1f6200bea45a301ff05b2d1/src/librustc_trans/trans/cabi_x86_win64.rs#L49 - i guess rust has fixed it since then
<jhass> maybe
<jhass> I tried to trace it back like that for aarch64, but couldn't
<oprypin> jhass, so i suppose this spec failed for you on aarch64? it didnt on Windows, what's special about it compared to my failign case? https://github.com/crystal-lang/crystal/blob/99eff6acb33fc754b09d5418b69a25848da1b92e/spec/compiler/codegen/c_abi/c_abi_spec.cr#L58
<jhass> yes it did
<jhass> I don't know :)
<FromGitter> <ImAHopelessDev_gitlab> hi
<jhass> oprypin: maybe it's passing for you out of luck?
<jhass> garbage just happens to return the right result
<FromGitter> <dscottboggs_gitlab> @didactic-drunk could you offer some advice on how shared data can be managed in Crystal? I'm not sure what caused my issues with `preview_mt` in the past. I'll have to take another crack at it if someone is being successful with it
<jhass> oprypin: or stuff just happens to retain in the right registers
<FromGitter> <wyhaines> @manveru Yeah. I don't think Ruby will ever go away in my lexicon., but for a lot of my own personal projects, Crystal has won over my heart.
<oprypin> did i really just find a bug on x86_64 too
<FromGitter> <naqvis> > is there some way to send the outputs from `Process.run` to a `Log` instance without a lot of plumbing? ⏎ ⏎ ☝️ May 20, 2020 3:08 AM (https://gitter.im/crystal-lang/crystal?at=5ec42ecbb0256038f9dd0a51)
<jhass> haha
<jhass> I bet if your format it in hex it looks like a stack pointer
<jhass> or heap pointer even, idk
<jhass> but yeah, I get garbage too
<oprypin> worth trying on aarch64? or too scary 😬
<FromGitter> <dscottboggs_gitlab> woaahhh this is awesome https://crystal-lang.org/api/0.35.1/YAML/Serializable.html#use_yaml_discriminator(field,mapping)-macro
<oprypin> hummm
<oprypin> how did you get that pointer like that? because if i add a temp variable `v = LibFoo::S.new(x: 6, y: 7); LibFoo.foo(1, 2, 3, 4, 5, v)`, the result changes from garbage to just 0
<jhass> I did nothing else
<jhass> that's aarch64
<jhass> with all my patches
<oprypin> congrats on that
<jhass> maybe we should make it tier 1 now and everything else tier 2 xD
<oprypin> ok so what is happening..
<oprypin> why do both part of the actual struct's value *and* a pointer to it end up there
<oprypin> jhass, would be funny, but no, `s/Attribute::ByVal/nil` only breaks more things
<mps> oprypin: thanks for explanation why aarch64 fixes are not merged
<mps> hope it will be for next release
<jhass> idk, I don't feel like that rabbit hole atm, sorry :)
<oprypin> :>
<oprypin> jhass, pls use permalinks 😩 https://i.imgur.com/E3ccTWQ.png
<jhass> nah, they're too long
<jhass> the message is timestamped, just go browse code at a commit about now if you're reading this two years later :P
<oprypin> 😩
<jhass> but probably easier to compare the call clang generates in LLVM IR to the one we generate and spot the diff
<jhass> and try to relate that back to the ABI implementation
<oprypin> oh man thats a rabbit hole
<jhass> yeh
<jhass> mmh, should dig out cgo's implementation, might be easier to follow
<jhass> yeah they were just like "nope"
<oprypin> i printed the contents of the stack around the first arg
<jhass> did you do as I say and compared LLVM IR yet?
<oprypin> no
<oprypin> im doing my stupid way to see it
<jhass> trust me, that's easier than what you're doing right now :D
<jhass> for aarch64 I did that, it was literally the same already just with that weird byval attribute tacked on
<jhass> so I just dropped it
<oprypin> fine
<jhass> --prelude=empty --no-debug will make the Crystal LLVM IR a bit easier to digest
<jhass> and yeah, as mentioned, clang only dumps the bytecode so you need to llvm-dis that
<oprypin> hmm? `clang -Dmain -S -emit-llvm test.c` seems quite friendly
<jhass> ah, TIL
<oprypin> nvm the -Dmain part, thats my thing
<jhass> well relearned? My shell history apparently already knew it xD
<oprypin> ok
<oprypin> clang: `call void @foo(i64 1, i64 2, i64 3, i64 4, i64 5, %struct.Vec* byval(%struct.Vec) align 8 %1)` where `%struct.Vec = type { i64, i64 }`
<oprypin> crystl: `call void @foo(i64 1, i64 2, i64 3, i64 4, i64 5, { i64, i64 } %9)`
<jhass> huh
<jhass> so it's basically the other way around than it was wrong on aarch64?!
<oprypin> maybe
<jhass> %struct.Vec will be just {i64, i64} at the top for sure in clang
<oprypin> jhass, yes i added that detail to the right side of my message
<jhass> ah, right, sorry
<jhass> maybe that explains where it came from in aarch64 and windows xD
<FromGitter> <dscottboggs_gitlab> I just reallized that `something <<<<-HERE` is valid crystal syntax lol
<jhass> so I *think* you wanna figure out why https://github.com/crystal-lang/crystal/blob/master/src/llvm/abi/x86_64.cr#L47 is false for your struct?
<jhass> or maybe it also depends on total argument size and we just ignore that fact right now
<oprypin> it's total argument size
<oprypin> removing one of the prior number args fixes it
<jhass> yay
<jhass> sounds fun
<jhass> seems doable
<jhass> count the reg args, count the sse args, if more than 6 or 8 respectively prior, mark structs as byval
<FromGitter> <didactic-drunk> @dscottboggs_gitlab For shared data there are many options. I'll list a few: ⏎ ⏎ 1) Treat it like java/c++. Use Mutexes/atomics on everything shared. ⏎ 2) Treat it like go (Channels). Pass your data structures using channels and only mutate them in 1 fiber at a time. ⏎ 3) Treat it like a functional language. Use struct or immutable (https://github.com/lucaong/immutable) data structures with
<FromGitter> ... channels. Be careful of @assignment or other mutation in your own classes or other shards. ... [https://gitter.im/crystal-lang/crystal?at=5eee3146fa0c9221fc4db23b]
<FromGitter> <dscottboggs_gitlab> hm, I feel like I tried with 2 and 3 and only using stdlib but I could've just messed it up or be misremembering. I'll try it again one of these days with your tips in mind
<FromGitter> <didactic-drunk> Array, Hash, nothing except struct are thread safe.
<FromGitter> <dscottboggs_gitlab> well that's less than great. what about String?
<FromGitter> <alexherbo2> hi
<FromGitter> <dscottboggs_gitlab> guess not
<FromGitter> <didactic-drunk> Somewhat. As long as you don't `.to_slice` then modify it.
<FromGitter> <alexherbo2> https://play.crystal-lang.org/#/r/9ax0
<FromGitter> <alexherbo2> why my party character is not preserved?
<FromGitter> <didactic-drunk> Ok so there are a few things in stdlib that are thread safe. I wouldn't count on it until you check or see it's a value.
<jhass> alexherbo2: it is https://play.crystal-lang.org/#/r/9ax2
<FromGitter> <Blacksmoke16> It's there no? Just encoded
<FromGitter> <alexherbo2> @jhass: my use case is to read a yaml file and write to that file.
<jhass> sure.
<FromGitter> <alexherbo2> when writing to the file in yaml, the custom characters are replaced by their unicode value.
<jhass> by their unicode escape sequence
<jhass> yes
<FromGitter> <alexherbo2> escape sequence yep
<jhass> as the spec asks document writers to do
oddp has quit [Ping timeout: 265 seconds]
oddp has joined #crystal-lang
Jesfre has joined #crystal-lang
Jesfre has quit [Ping timeout: 265 seconds]
<FromGitter> <dscottboggs_gitlab> where did the stdlib markdown thing go?
<FromGitter> <Blacksmoke16> Internal now
<FromGitter> <dscottboggs_gitlab> so the only option is icyleaf/markd now?
<FromGitter> <Blacksmoke16> That would be the better option yea
oddp has quit [Ping timeout: 265 seconds]
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
deavmi has quit [Read error: No route to host]
deavmi has joined #crystal-lang
Jesfre has joined #crystal-lang
<FromGitter> <renich_gitlab> Good `Time.local.to_time_of_day`, Crystallites! I started my first Keen list about programming and I've added a sublist called Crystal: https://staykeen.com/keen/78VRpnaFr7jiwAY0KGTb/v/G76OQc2uOGrNWtC9NUGT
<FromGitter> <renich_gitlab> If anybody wants to join, you're welcome to. We ain't used to collect a few things scattered around the net about Crystal. Keen seems to help by proposing you articles you can add and stuff.
<FromGitter> <Blacksmoke16> thoughts on how to test optional shards? Like imagine you have two shards A and B. Shard B can be used with shard A, but it is not required. If it is used, shard A has some extra code to integrate shard B into it.
<FromGitter> <Blacksmoke16> current plan is to just add shard B as a developmen_dependency and test the integration within shard A
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
<oprypin> Blacksmoke16, yea nothing wrong with that
<FromGitter> <Blacksmoke16> Cool, I guess it gets trickier when the integration code changes the default behavior, so probably will need to setup isolated tests specific for that
<FromGitter> <Blacksmoke16> Probably a good usecase for spec tags
<oprypin> Blacksmoke16, regarding "integration code changes the default behavior" thats just a problem of its own, i think that shouldnt be done??
<FromGitter> <Blacksmoke16> im not sure how to avoid it tho. A more definite example would be, say you include the `serializer` shard, the renderer would go from using `.to_json` to using the serializer implementation
<FromGitter> <Blacksmoke16> i suppose they could be separate implementations and the serializer one just runs before the default one, hmm
<oprypin> explicitly pass some object from serializer shard to it
<FromGitter> <Blacksmoke16> hm?
<oprypin> Renderer.new(serializer: Serializer)
<FromGitter> <Blacksmoke16> hmm, let me try something
<FromGitter> <Blacksmoke16> yea, probably better to just change what serializer object gets provided to the renderer
<FromGitter> <Blacksmoke16> use some default implementation by default, when the serializer shard is required, have that define another that is used instead
Jesfre has quit [Ping timeout: 240 seconds]
<FromGitter> <Blacksmoke16> yea i think i like that better, seems to be working fine
<FromGitter> <j8r> @ImAHopelessDev_gitlab hello, I am still working from time to time in Godot
<FromGitter> <j8r> I got a performance issue with drawing polygons in Node2D :(
zorp_ has joined #crystal-lang
oddp has joined #crystal-lang
zorp_ has quit [Ping timeout: 240 seconds]
<FromGitter> <j8r> I guess I have to touch to GLSL shaders :|
<FromGitter> <jwoertink> `Process.run("psql -U postgres", shell: true, input: STDIN, output: IO::Memory.new, error: STDERR)`. I have this line of code, but it enters a prompt. To get around this, I'm doing `%(echo "\\q" | psql -U postgres)`.
<FromGitter> <jwoertink> Is there another way to pass that `"\q"` to this command?
<FromGitter> <j8r> what is the prompt?
<FromGitter> <jwoertink> the psql prompt
<FromGitter> <j8r> I guess that depends also of? the input
<oprypin> @jwoertink: wait so what's the problem or what do you want to accomplish
<FromGitter> <jwoertink> I want to test that I can connect to postgres using specific credentials. The best way for what I need that I've found is to just try using `psql`.
<FromGitter> <jwoertink> But if it works, it enters the psql prompt which just hangs
<FromGitter> <j8r> that expected
<FromGitter> <jwoertink> so I need to send the `\q` so it quits
<oprypin> @jwoertink: stdin: :close then??
<FromGitter> <jwoertink> oh sweet
<FromGitter> <jwoertink> yup, that's what I wanted
<FromGitter> <j8r> Executing `\q` looks ok
<FromGitter> <jwoertink> thanks oprypin
<FromGitter> <jwoertink> Yeah, the `\q` was working, but it's wonky
<FromGitter> <j8r> when do you execute the close then?
<FromGitter> <jwoertink> I didn't know `input: :close` was a thing 😅
<FromGitter> <jwoertink> or stdin: :close
<FromGitter> <j8r> ha
<oprypin> input is correct
<FromGitter> <jwoertink> yeah, first one
<FromGitter> <jwoertink> lol
<FromGitter> <j8r> not sure it will work
<FromGitter> <j8r> nvm
<FromGitter> <j8r> So, essentially it will close client-side instead of the server doing so?
<FromGitter> <jwoertink> oh... wait... maybe that isn't working.. I fixed one part, but broke another
<FromGitter> <jwoertink> nope, wrong again
<FromGitter> <jwoertink> ugh. I need to step away from this computer
<FromGitter> <jwoertink> 😂
<FromGitter> <j8r> I think `\q` is good, it tests that an user can use psql and execute command
<FromGitter> <j8r> I don't understand the wonky part :/ ?
<FromGitter> <jwoertink> I don't like how this looks `%(echo "\\q" | #{command})`
<FromGitter> <jwoertink> So I was looking for another way to do it
<oprypin> jwoertink, as long as you dont do input: STDIN anything can work
<oprypin> u can pass `input: IO::Memory("\\q")` or sth
<oprypin> but i'm only guessing because you didnt specify what the problem is no
<oprypin> w
<FromGitter> <jwoertink> I like this `input: :close` option. It's pretty clean
<FromGitter> <j8r> it works?
<FromGitter> <jwoertink> yeah. Helps when you save the file before running it 😛
<FromGitter> <rishavs> Is a HTTP:Request immutable? Or can I add more attributes to it? For example, I am thinking of an authenticating middleware which after running will add a `IsAuthenticated = true` to the request
<FromGitter> <Blacksmoke16> you can do that, its a class so its not immutable
<FromGitter> <j8r> Possible, but does not mean it is good
<FromGitter> <Blacksmoke16> wouldnt it be better to do like, if you're *NOT* authorized, return a 401 and just not continue?
<FromGitter> <watzon> I want to know if and when this is ever going to be possible https://carc.in/#/r/9b0b
<FromGitter> <watzon> Procs seem to have a hard time working with subclasses
<FromGitter> <watzon> It's been a problem for as long as I can remember
<oprypin> watzon, this is expected
<FromGitter> <watzon> Is there any way around it though? Any possible way to make that workable from a language perspective?
<oprypin> hm no i'm not so sure.. i mean, it's doable but it's the same reason that Array(HTML) wouldn't pass as Array(Resource)
<FromGitter> <Blacksmoke16> the workaround is wrap the proc in another proc that casts the value to the inner proc to the type you want
<FromGitter> <Blacksmoke16> i think i have an example, sec
<FromGitter> <watzon> So basically create a "Handler" class/struct with a generic?
<FromGitter> <Blacksmoke16> something like that ^
Jesfre has joined #crystal-lang
<FromGitter> <thelinuxlich> is anyone using the nats client?
<FromGitter> <Blacksmoke16> Nope
<FromGitter> <thelinuxlich> it doesn't have a client.subscribe(queue, &block) which keeps open and receiving messages, it receives one and it closes
<FromGitter> <Blacksmoke16> Does it block while waiting for the first one?
<FromGitter> <thelinuxlich> yes
<FromGitter> <Blacksmoke16> Throw it in a loop? :P
<FromGitter> <thelinuxlich> I was thinking about doing it in a method recursively: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ But I don't know if this is "safe" [https://gitter.im/crystal-lang/crystal?at=5eee95017ba3965373bc6147]
<FromGitter> <thelinuxlich> ```code paste, see link``` ⏎ ⏎ this did the trick [https://gitter.im/crystal-lang/crystal?at=5eee981a405be935cdb252fc]
twosecslater has joined #crystal-lang
<twosecslater> hey all, how would I obtain the Crystal compiler for an aarch64 system? none of my repositories provide binaries for my architecture
<FromGitter> <Blacksmoke16> @jhass ^
<FromGitter> <watzon> Is there currently an easy way to take a block method and turn it into an iterator?
<FromGitter> <watzon> I thought maybe `Iterator.of`, but I can't figure out quite how it works
zorp_ has joined #crystal-lang
<FromGitter> <watzon> I'm hoping to avoid this nonsense https://github.com/watzon/arachnid/blob/master/src/arachnid/resource/html.cr#L38
<FromGitter> <j8r> No :/
<FromGitter> <watzon> Poo
<FromGitter> <watzon> Oh well
<FromGitter> <j8r> What is `Iterator.of`?
<FromGitter> <j8r> There is no API doc
<FromGitter> <j8r> Iterator of calls the block each time `next` is called
<FromGitter> <j8r> That's it
<FromGitter> <watzon> Yeah that appears to be it