RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.0 | 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> can also do this
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c4cf5037b68f9410223ae68]
<FromGitter> <Blacksmoke16> `User.match(HasRole.new "Admin")`
<FromGitter> <dscottboggs_gitlab> I see
<FromGitter> <Blacksmoke16> or
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c4cf5b09221b9382dc91723]
<FromGitter> <dscottboggs_gitlab> nice
<FromGitter> <Blacksmoke16> or
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c4cf7101b62f12650553aad]
<FromGitter> <dscottboggs_gitlab> so then would author_id be a column on User or on another table?
<FromGitter> <Blacksmoke16> in the `jobs` table
<FromGitter> <Blacksmoke16> so like this would be used like `Job.match(OwnsJobs.new user)`
<FromGitter> <Blacksmoke16> where user comes from db or something idk
<FromGitter> <Blacksmoke16> which would be like select * from jobs where (author_id = 1321)`
<FromGitter> <Blacksmoke16> assuming that user's id is 1321
<FromGitter> <Blacksmoke16> `BelongsToUser` would be a better name
<FromGitter> <dscottboggs_gitlab> idk that just seems problematic to me unless you made the matchers subclasses of the things they're matching on like `Jobs::BelongsToUser`
<FromGitter> <Blacksmoke16> hm yea good point
<FromGitter> <Blacksmoke16> could get into trouble adding blocks to things they not supposed to go on
<FromGitter> <dscottboggs_gitlab> like you've got this struct that seems like a standalone filter but it depends on the column `author_id` in a table that has nothing obviously to do with it
<FromGitter> <dscottboggs_gitlab> yeah exactly
<FromGitter> <Blacksmoke16> exactly
<FromGitter> <Blacksmoke16> :p
<FromGitter> <dscottboggs_gitlab> haha
<FromGitter> <dscottboggs_gitlab> I see why this pattern is controversial. It's powerful but it can be dangerous if not done right
<FromGitter> <Blacksmoke16> what could i do to prevent that tho
<FromGitter> <dscottboggs_gitlab> oh nothing, that's not your responsibility
<FromGitter> <dscottboggs_gitlab> you are familiar with and want to use this pattern and that's fine,
<FromGitter> <Blacksmoke16> maybe if an ORM had a deep enough suport for this you could raise a compile time error if you used one on something that doesnt have that col
<FromGitter> <Blacksmoke16> or some sort of registration thing where you whitelist specs that a class is allowed to take
<FromGitter> <Blacksmoke16> :0
<FromGitter> <Blacksmoke16> remember how you were doing splat generics?
<FromGitter> <dscottboggs_gitlab> I'm just saying I recognize how it could be dangerous but if you know what you're doing with it (or use it in a well-tested ORM or other abstraction) it can be really great
<FromGitter> <dscottboggs_gitlab> yes, why?
<FromGitter> <Blacksmoke16> what if i did something like
<FromGitter> <Blacksmoke16> ```class User โŽ extend Specify(IsAdmin, HasRole) โŽ end``` [https://gitter.im/crystal-lang/crystal?at=5c4cf91613a2814df6d1b3a1]
<FromGitter> <Blacksmoke16> ๐Ÿ˜ฎ
<FromGitter> <dscottboggs_gitlab> now that's the sort of syntax we're here for! ๐Ÿ’ฏ ๐Ÿ‘Œ
<FromGitter> <Blacksmoke16> but how could i do that...
<FromGitter> <Blacksmoke16> hm
<FromGitter> <Blacksmoke16> give me a while
<FromGitter> <dscottboggs_gitlab> good luck!
<FromGitter> <Blacksmoke16> you still have that code handy?
<FromGitter> <dscottboggs_gitlab> which?
<FromGitter> <dscottboggs_gitlab> the named tuple splat?
<FromGitter> <Blacksmoke16> how we got it to an array
<FromGitter> <dscottboggs_gitlab> not sure what you mean, probably just forgetting, I was thinking you were talking about #7049
<FromGitter> <Blacksmoke16> {{T.type_vars.first.type_vars}} right?
<DeBot> https://github.com/crystal-lang/crystal/issues/7049 (Initializing a namedtuple from double splat)
<FromGitter> <dscottboggs_gitlab> oh that!
<FromGitter> <dscottboggs_gitlab> Yes, that's what it was, but I wound up not using that
<FromGitter> <dscottboggs_gitlab> found it โŽ โŽ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c4cfc3493fe7d5ac0f6e706]
<FromGitter> <Blacksmoke16> boo, cant use a macro to define type guard
<FromGitter> <dscottboggs_gitlab> โ˜๏ธ this so much
<FromGitter> <Blacksmoke16> wow that was actually pretty easy
<FromGitter> <Blacksmoke16> downside is you cant extend with no generic types
<FromGitter> <dscottboggs_gitlab> ๐Ÿคฆโ€โ™‚๏ธ figured out what I was doing wrong with Kemal
<FromGitter> <Blacksmoke16> so will have to be some default to use if you dont have any types
<FromGitter> <Blacksmoke16> which isnt a big deal i dont think?
<FromGitter> <Blacksmoke16> what was it?
<FromGitter> <dscottboggs_gitlab> I was directly binding TCP rather than just Kemal.run to allow for forking
<FromGitter> <Blacksmoke16> ah, gotcha
<FromGitter> <dscottboggs_gitlab> 100% on me haha
<FromGitter> <Blacksmoke16> `extend Specify(HasRole | IsAdmin)`
<FromGitter> <Blacksmoke16> ayy
<FromGitter> <Blacksmoke16> would be cool if you could provide a default value for a generic
<FromGitter> <Blacksmoke16> ๐Ÿ’ฏ
<FromGitter> <dscottboggs_gitlab> nice
<FromGitter> <dscottboggs_gitlab> can't install crystal on armv6, huh? just cross-compile-to?
laaron has joined #crystal-lang
<FromGitter> <proyb6> If you host a web server written in Crystal with ECR, what is your memory usage? How do you free up the memory?
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <Blacksmoke16> Why you would you have to? Isn't that what the GC is for
<FromGitter> <iambudi> what is the best way in crystal to implement expire time while waiting response from server?
<FromGitter> <iambudi> is delay() recommended?
<FromGitter> <dscottboggs_gitlab> delay seems perfect to me
<FromGitter> <proyb6> @Blacksmoke16
<FromGitter> <proyb6> I see the memory went up from 1MB to 100MB+ when benchmark with wrk and memory wonโ€™ GC
<FromGitter> <dscottboggs_gitlab> why won't it GC?
<FromGitter> <proyb6> Let me try Kemal, current using onyx rest
<FromGitter> <Blacksmoke16> Hmm, dunno
<FromGitter> <Blacksmoke16> Probably a bug
<FromGitter> <Blacksmoke16> Should try Athena ;)
<FromGitter> <staleo> Hi guys! I remember theres been a service with 4-letter io domain, where ppl could quickly run a piece of crystal code, but i cant remember the url. Sort of abbreviation, or something. Anyone?
<FromGitter> <ezrast_gitlab> @staleo https://carc.in/
<FromGitter> <dscottboggs_gitlab> compile and run code in
<FromGitter> <dscottboggs_gitlab> super clever whoever came up with that
<FromGitter> <proyb6> Itโ€™s the same memory issue on Kemal with ecr from 1MB to 113MB and stays there
<FromGitter> <staleo> Sweet! Best.
<FromGitter> <dscottboggs_gitlab> well ECR is basically a bunch of string builders
<FromGitter> <dscottboggs_gitlab> but that does sound like quite a lot
<FromGitter> <dscottboggs_gitlab> Maybe you could add a `GC.collect` after the render?
<FromGitter> <ezrast_gitlab> @proyb6 I don't think the GC ever releases memory back to the OS; it just keeps the empty pages around for reuse later.
<FromGitter> <dscottboggs_gitlab> oh my
<FromGitter> <proyb6> oh, thatโ€™s is a kind of worry for VPS with low memory
<FromGitter> <ezrast_gitlab> see https://github.com/crystal-lang/crystal/issues/3997#issuecomment-283737637 and the issue linked from there
gangstacat has quit [Remote host closed the connection]
sp3ncer has joined #crystal-lang
sp3ncer has left #crystal-lang [#crystal-lang]
<FromGitter> <proyb6> I see, it looks like the folks still need a permanent solution to free memory
<FromGitter> <proyb6> Meanwhile, calling ```GC.collect``` 5 or more times rapidly will free up memory usage while the app is idle
<FromGitter> <dscottboggs_gitlab> > calling GC.collect 5 or more times rapidly โŽ โŽ On one hand that sounds like a huge hack...what if the GC implementation changes? Ouch... โŽ โŽ On the other, this really seems like an issue you're running into specifically because you're running a benchmark... which actually reflects accurately the choices Crystal has made around optimization of time vs memory. If a server were under the
<FromGitter> ... sort of load a benchmark puts it under, you'd want it to hold onto some memory for a little while so that it doesn't have to wait to ask for more. But in most situations, after a while, the GC would release that memory anyway. [https://gitter.im/crystal-lang/crystal?at=5c4d41819221b9382dcace79]
oz has quit [Ping timeout: 252 seconds]
<FromGitter> <proyb6> I read the past issue and found ImmixGC, which we know is efficient than BDW-GC โŽ https://github.com/ysbaddaden/gc โŽ https://github.com/crystal-lang/crystal/issues/5271
<FromGitter> <proyb6> @dscottboggs_gitlab Not sure when it will release the memory and would stave other services require a large amount of memory as well.
<FromGitter> <dscottboggs_gitlab> I wonder if there's a way to increase the frequency of collections besides manually calling #collect...
<FromGitter> <dscottboggs_gitlab> no I don't think so
<FromGitter> <proyb6> I've used GC_FREE_SPACE_DIVISOR and increase it, not that I can effectively free when the benchmark is pushing the limits
<FromGitter> <dscottboggs_gitlab> true
<FromGitter> <dscottboggs_gitlab> I suppose if you really need that memory under extreme load, even at the expense of performance, then your only option is to use GC.collect manualy, because regardless of the GC it isn't going to be able to free up resources with the benchmark banging on it
_whitelogger has joined #crystal-lang
oz has joined #crystal-lang
<FromGitter> <proyb6> Maybe, only reverse proxy are able to handle that for now and seriously need folks to evaluate Immix.
<FromGitter> <proyb6> On the other hand, manually managing memory need more tutorials
rohitpaulk has joined #crystal-lang
blassin has quit [Quit: Ping timeout (120 seconds)]
blassin has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
fanta7531 has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
fanta7531 has quit [Quit: fanta7531]
ashirase has quit [Ping timeout: 244 seconds]
ashirase has joined #crystal-lang
fanta7531 has joined #crystal-lang
ua_ has quit [Quit: Leaving]
<FromGitter> <girng> @proyb6 i've had the same questions you had 7+ months ago or so
<FromGitter> <mavu> I just tested GPIOs on a pi using crystal -> wiringPi, just switching a pin high and low in a loop, to see how fast it could go in crystal vs. C. โŽ surprisingly, my scope can't tell the difference, both clock in at about 15mHz. I find that pretty neat :)
<FromGitter> <mavu> out of curiosity, I did a quick check with the node.js binding of wiringPi and that is so all over the place that my scope is unable to display a frequency. โŽ But that was not really fair, because I used a OnOff instead of the wiringPi directly. Maybe I'll try the ruby binding next
ua has joined #crystal-lang
<mps> mavu: what board you use
<FromGitter> <mavu> Raspberry pi 3, but I have others around here somewhere. You think it would make a big difference (beyond being a bit slower in c and crystal)?
_whitelogger has joined #crystal-lang
<mps> mavu: with aarch64 (arm64) OS on it?
<mps> actual question is what OS you have installed on it?
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <mavu> debian stretch on this one, but it will be updated next week.
<mps> arm64 version?
<FromGitter> <mavu> Sorry, rasbian stretch. I'm so used to answering debian to everything .. :)
<mps> no problem, it is debian in the base, at the end
<mps> I had a hope that I'll hear from you that it is arm32 and that the you managed to get crystal working on arm32 :)
<FromGitter> <r00ster91> When I do `llvm-config --version`, it gives me "6.0.0", when I run `crystal --version`, it shows "LLVM: 4.0.0". How do I make Crystal use 6.0.0?
<mps> r00ster91: rebuild it with llvm6
<FromGitter> <r00ster91> do you mean I should uninstall crystal and install it again? will try
<mps> no, rebuild, i.e. recompile with llvm6 installed
<mps> from source, I mean
<FromGitter> <r00ster91> but I didn't build Crystal myself. I installed it with the package
<mps> which distribution
<FromGitter> <r00ster91> Ubuntu 18.04
<mps> uh, strange that they built crystal with ancient llvm. I can't help with ubuntu because never used it
<FromGitter> <r00ster91> oh no does that mean I have to build it myself
<mps> let me look to debian stretch, wait a minute or two
<FromGitter> <mavu> I had to build crystal myself too.
<mps> uhm, debian does not have crystal. I'm astound.
<FromGitter> <mavu> But mainly because the 'inofficial' debian arm package is outdated
<FromGitter> <mavu> it is not oto hard to build yourself though.
<FromGitter> <mavu> but the 0.27 has a bug you need ot patch if you want to run on arm.
<mps> mavu: you mean crystal on arm32? If you have pointer/url how to build crystal on arm32 please post it here. I would like to have it in Alpine armv7 packaged
<FromGitter> <mavu> also, for some reason I don't remember I built with llvm-3.9 (I think I found a comment somewhere saying thats a good idea and just went with it, because I needed to Get-things-done_(tm)
<FromGitter> <mavu> How you make a package for alpine, i have no idea, but that above should get you a build for your system
<mps> r00ster91: you could try here and see with what llvm version crystal is build in these packages: https://crystal-lang.org/reference/installation/on_debian_and_ubuntu.html
<mps> if you didn't that already, of course
<FromGitter> <mavu> Also, if you check out crystal source, at current release tag 0.27, you will have to patch this. โŽ https://github.com/crystal-lang/crystal/issues/7039
<mps> mavu: I know these links and guides, I packaged lates 0.27.0 for Alpine Linux
<mps> s/lates/latest/
<FromGitter> <mavu> ok? then I didn't understand what you were asking :)
<mps> had a hope that someone managed to build crystal for armhf or armv7 arch's
<FromGitter> <mavu> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c4da1bc454aad4df7addda4]
<FromGitter> <mavu> I'm not too familiar with arm achitectures. this is what my raspberry crystal says.
<FromGitter> <mavu> (not sure why it says llvm 6.0.1 I definitely built it with llvm-config-3.9
<mps> Default target: armv7l-unknown-linux-gnueabihf, means that it is prepared to build armv7 by default
<FromGitter> <mavu> and I have this running on a different pi: โŽ โŽ `````` [https://gitter.im/crystal-lang/crystal?at=5c4da269f04ef006449467f5]
<FromGitter> <mavu> the second one is probably an older one, but I don't have physical access to it at the moment to check.
<mps> interesting, will look what and how raspbian people did it packaged
<mps> yes, armv6 is older architecture, better say older features on arm
<FromGitter> <mavu> again, i compiled the crystal compiler myself, no official or unofficial package used.
<mps> from the source on raspbian?
<FromGitter> <mavu> followed the links above, cross compiled crystal itself on x86_64 for raspi. linked in place.
<FromGitter> <mavu> I'll have to document my steps some time next week anyway, for work. so I can make a forum post about it then. (no promises though, I have to battle CSS next week and CSS makes me cranky.)
<mps> please, could you paste link again, I'm on the irc not gitter
<FromGitter> <mavu> this is the important one.
<mps> thanks, will look at it
<FromGitter> <mavu> and this: crystal-lang/crystal#7039 โŽ keep in mind you need to patch the crystal source before you cross-comple it.
<FromGitter> <mavu> good luck :)
<mps> patching source is everyday duty in Free/Opensource world :) no problem for me
<mps> thank you again for links and infos
rohitpaulk has joined #crystal-lang
<FromGitter> <r00ster91> when I `make`, I get `/mnt/c/Users/r00ster/Desktop/make/crystal/src/llvm/pass_registry.cr:11: undefined reference to `LLVMInitializeInstCombine'` :/
<FromGitter> <r00ster91> I tried master and 0.27.0
<FromGitter> <proyb6> @girng I saw your thread at Rust forum on Godot, yeah
<FromGitter> <girng> @proyb6 yeah. i think opyrpin and others basically told me (and what is boiled down to) is the GC will free some stuff, like sockets n whatnot. but other memory says around
<FromGitter> <girng> you can test this on your VPS. load up 500, 1000+ connections, then see memory usage in crystal app rise, then disconnect them, it drops down
<mps> r00ster91: do you have llvmX-libs installed on your build machine
<FromGitter> <r00ster91> yes, llvm-6.0-dev, llvm-6.0
<mps> and llvmX-dev. X is you preferred llvm version
<FromGitter> <bararchy> Does anyone has this issue too? โŽ When doing shards install โŽ โŽ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c4da98445248865a79c465d]
<FromGitter> <bararchy> only for this repo XD
<mps> r00ster91: do you add LLVM_CONFIG = /path to llvm-config in Makefile
<FromGitter> <drum445> @Blacksmoke16 I guess I don't even need to pass context into that protected macro
<FromGitter> <drum445> I can just use it like it's there
<FromGitter> <drum445> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c4dab49ca428b06450d91b7]
<FromGitter> <drum445> or is it better practice to pass through context?
<FromGitter> <proyb6> @girng It less efficient to disconnect, as GC precludes control and predictability. We have to manage memory allocation/deallocation ourselves for critical services, it's hard.
<FromGitter> <r00ster91> mps: LLVM_CONFIG is currently set to "llvm-config"
<FromGitter> <r00ster91> and llvm-config works
<mps> r00ster91: can't help over chat, but you can look at some build scripts, for example archlinux pkgbuild for crystal and try to adapt it to your case
<FromGitter> <r00ster91> it seems to be a bug in llvm 6.0.0. will try to install llvm 6.0.1
<mps> could be, I didn't tried to build with llvm6 yet, just with llvm5
<FromGitter> <Blacksmoke16> @drum445 makes sense, cleaner too
rohitpaulk has quit [Ping timeout: 268 seconds]
tankf33der has joined #crystal-lang
<FromGitter> <drum445> lovely, so just for my own ignorance, during compilation macros are placed in the code like they were there all along?
<FromGitter> <Blacksmoke16> yea
<FromGitter> <Blacksmoke16> which is why that works
<FromGitter> <drum445> perfect, ta
<FromGitter> <r00ster91> is anyone here on Ubuntu and installed LLVM 6.0.1?
<FromGitter> <proyb6> @Blacksmoke16
<FromGitter> <Blacksmoke16> Yes?
<FromGitter> <proyb6> I have no idea how to use Athena without example :( but Iโ€™m thinking if H2O (C) could be bind in Crystal since H2O.cr was proven in TechEmpower benchmark
<FromGitter> <proyb6> Especially Kazuho is working on QUIC
<FromGitter> <Blacksmoke16> did you checkout the docs?
jemc has joined #crystal-lang
<FromGitter> <proyb6> Great!
<FromGitter> <Blacksmoke16> np, any questions/feedback let me know
<jemc> does crystal spec have a "fail fast" mode akin to rspec's? https://relishapp.com/rspec/rspec-core/v/3-8/docs/configuration/fail-fast
<FromGitter> <Blacksmoke16> not that i know of
<jemc> when I make a mistake that affects a lot of tests in my test suite, it's really bothersome to have to scroll up past hundreds of failure messages to see any troubleshooting print statements that I added to the code
<jemc> maybe I can monkey-patch the spec library, I guess
<FromGitter> <Blacksmoke16> if you can find a way to tap into the error count, could maybe use a before each to call exit(1) if error count > x
<FromGitter> <Blacksmoke16> :shrug:
gangstacat has joined #crystal-lang
gangstacat has quit [Remote host closed the connection]
gangstacat has joined #crystal-lang
<FromGitter> <sdogruyol> @Blacksmoke16 I just checked athena, it looks really interesting ๐Ÿ‘ I especially like the typed parameters
<FromGitter> <Blacksmoke16> thanks man, the param conversion/route constraints are also pretty neat
<FromGitter> <sdogruyol> it's great to see annotations in action
<FromGitter> <sdogruyol> they're really powerful
<FromGitter> <Blacksmoke16> indeed, it worked quite well
<FromGitter> <sdogruyol> I'd like to give it a try when I have time :)
<FromGitter> <Blacksmoke16> sounds good :) any questions/issues let me know
fanta7531 has quit [Quit: fanta7531]
<FromGitter> <sdogruyol> Sure ๐Ÿ‘ Keep up the good work @Blacksmoke16
return0e has quit [Ping timeout: 272 seconds]
return0e has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> @r00ster91 I am on ubuntu but mine says LLVM 6.0.0
fanta7531 has joined #crystal-lang
jemc has quit [Ping timeout: 250 seconds]
jemc has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> do we have some sort of a standard Generator type or do you just have to make it from scratch?
livcd has quit [Ping timeout: 250 seconds]
<FromGitter> <r00ster91> @dscottboggs_gitlab Oh. I'm looking for someone who has LLVM 6.0.1 because then he might be able to tell me how he installed that version. Because you can't `make` your own Crystal with LLVM 6.0.0 because of a regression in that release.
<FromGitter> <dscottboggs_gitlab> oh I see...are you on 18.04 or 18.10?
<FromGitter> <r00ster91> 1) 04
<FromGitter> <dscottboggs_gitlab> just a sec
<FromGitter> <r00ster91> sure
<FromGitter> <bararchy> Our product just passed 60k LOC not incl shards
<FromGitter> <bararchy> ๐ŸŽ‰
<FromGitter> <dscottboggs_gitlab> both debian testing and ubuntu 18.10 moved on to llvm 7.0 rather than 6.0.1
<FromGitter> <dscottboggs_gitlab> @bararchy noice!! :D
<FromGitter> <r00ster91> But Crystal unfortunately doesn't support LLVM 7 or higher yet.
<FromGitter> <r00ster91> The highest is LLVM 6.0.1
<FromGitter> <dscottboggs_gitlab> oh man :(
<FromGitter> <j8r> @bararchy awesome! What it is, AI related I suppose?
jemc has quit [Ping timeout: 245 seconds]
<FromGitter> <bararchy> Its our main solution (Application Security Testing https://www.neuralegion.com)
<FromGitter> <dscottboggs_gitlab> oh that's awesome
<FromGitter> <bararchy> Thanks :)
<FromGitter> <r00ster91> i really like the background of that website
<mps> bararchy: I read your interview in "Programming Crystal" :)
<FromGitter> <bararchy> Cool :) tbh I didn't even knew it was there until @sdogruyol told me
<FromGitter> <bararchy> Hahaha
<FromGitter> <j8r> @bararchy I remember! Does NeuraLegion is a Crystal supporter? :)
<mps> you explained in fine words how crystal could be used, enjoyed reading it
<FromGitter> <bararchy> @j8r not yet officially unless you count the massive amount of open source shards we release. Its my aim for 2019 to start support Crystal via NeuraLegion
<FromGitter> <mavu> @r00ster91 do you mean using version 6.0.1 like this? โŽ crystal/crystal --version โŽ Crystal 0.27.0 (2019-01-20) โŽ โŽ LLVM: 6.0.1 ... [https://gitter.im/crystal-lang/crystal?at=5c4dea51454aad4df7afb64d]
<FromGitter> <r00ster91> yes!
<FromGitter> <r00ster91> just like this
<FromGitter> <r00ster91> or try `llvm-config --version`, should say the same
<FromGitter> <dscottboggs_gitlab> yeah my `crystal --version` says 4.0.0 so it might be different
<FromGitter> <mavu> pi@raspberrypi:~ $ llvm-config-3.9 --version โŽ โŽ 1) 9.0 โŽ pi@raspberrypi:~ $ llvm-config --version โŽ 2) 5.0 [https://gitter.im/crystal-lang/crystal?at=5c4deadb1b62f126505ac8b8]
<FromGitter> <mavu> hmm says somethig different
<FromGitter> <mavu> possibly because I cross compiled it on my main computer?
<FromGitter> <mavu> which has several llvm-configs, one of them says โŽ llvm-config-6.0 --version
<FromGitter> <r00ster91> hmmm that's weird
<FromGitter> <mavu> 1) 0.1
<FromGitter> <r00ster91> ooh
<FromGitter> <r00ster91> do you remember how you installed LLVM 6.0.1?
<FromGitter> <mavu> it is from debian package llvm-6.0
<FromGitter> <mavu> in testing
<FromGitter> <r00ster91> from https://apt.llvm.org you mean?
<FromGitter> <r00ster91> oh
<FromGitter> <mavu> APT-Sources: http://ftp.de.debian.org/debian testing/main amd64 Packages
Groogy has joined #crystal-lang
<FromGitter> <r00ster91> @mavu hmmm I installed it with `sudo apt-get install llvm-6.0` but `llvm-config-6.0 --version` gives me 6.0.0
<FromGitter> <r00ster91> oh in "testing"? Do you know how I could access that?
return0e has quit [Ping timeout: 244 seconds]
<FromGitter> <r00ster91> oooh but llvm-5.0 is also available on Debian! And that version is sufficient! Thank you so much, mavu
JuanMiguel has joined #crystal-lang
<FromGitter> <girng> @bararchy 60k loc? what's the compile time on that just curious
return0e has joined #crystal-lang
JuanMiguel has quit [Client Quit]
<FromGitter> <sam0x17> would it be possible using fibers to have a single-process crystal program that has clients connect and blocks for some arbitrary amount of time while still being able to serve other clients? or is that impossible without parallelism?
<FromGitter> <drum445> @bararchy awesome stuff, does it compile in a reasonable amount of time?
<FromGitter> <bararchy> @drum445 @girng I'll do benchmarks and will.let you know
<FromGitter> <mavu> @r00ster91 No problem , happty to help. In case you need 6.0.1, you need to add testing repository to your /etc/apt/xources.list. โŽ You can net it up in a way that your standard distribution has precedence, and only if you manually specify something else, like apt-get install -t testing whatever_package it will pull that from testing (in this case)
<FromGitter> <mavu> @sam0x17 Blocks how? I *think* if it blocks on waiting for IO, Crystal automagically lets other fibers run while one waits.
<FromGitter> <r00ster91> thank you sooo much! actually one error was left with 5.0.1 but now all the errors are fixed! you are my savior
<FromGitter> <mavu> You are welcome :)
jemc has joined #crystal-lang
ashirase has quit [Ping timeout: 246 seconds]
ashirase has joined #crystal-lang
<FromGitter> <sam0x17> @mavu blocks manually before responding to the request -- I'm developing a distributed lock daemon
<FromGitter> <sam0x17> so if a key is locked, other clients connecting trying to acquire a lock on that key will block until that key is released
<FromGitter> <sam0x17> what I'm picturing is like a do while loop with Fiber.yield in it that loops until the key is unlocked
<FromGitter> <mavu> @sam0x17 if you can yield, I don't see a problem with concurrency BUT I'm very much not an expert here. Please get some answers from people who actually know what they are saying , and not just throwing around educated guesses :)
<FromGitter> <sam0x17> the problem I'm running into is it seems like things like kemal will block incoming web requests until the current one is finished. I don't know if that is by design or because of limitations
<FromGitter> <sam0x17> and that's regardless of whether I Fiber.yield in a response
<FromGitter> <sam0x17> e.g. even if I do: โŽ โŽ ```code paste, see link``` โŽ โŽ no other requests will be served until ~10 seconds goes by once the "/" request starts [https://gitter.im/crystal-lang/crystal?at=5c4e0b1a975714406b4f964a]
<FromGitter> <domgetter> If I get a `UInt8*` from a C lib, what is the proper way of printing it out as a string?
<FromGitter> <ankush981> Hello, noob question. Given that we have properties like `property age` in a class, this allows us to mutate the instance properties as freely as in a dynamic language like PHP and Python. What's the advantage of all this trouble? ๐Ÿ˜•
<FromGitter> <Blacksmoke16> that is just syntax to define a getter/setter for an instance var of the given type
<FromGitter> <ankush981> So, the idea is that you use getters and setters on properties you want to be mutable from outside, and not on those that you don't?
<FromGitter> <ankush981> My question was, I guess, about the need for getters/setters
<FromGitter> <Blacksmoke16> well if you dont define a getter/setter it cant be accessed/set from the outside
<FromGitter> <Blacksmoke16> i.e. `@age : Int32`
<FromGitter> <ankush981> ah, I see, I see
<FromGitter> <ankush981> my bad
<FromGitter> <ankush981> no, hold on
<FromGitter> <Blacksmoke16> got a playground link?
<FromGitter> <ankush981> let me create on
<FromGitter> <ankush981> *one
jemc has quit [Ping timeout: 240 seconds]
fanta7531 has quit [Quit: fanta7531]
<FromGitter> <eliasjpr> Is there an equivalent of https://www.rubydoc.info/stdlib/core/Array%3Apack in crystal
<FromGitter> <eliasjpr> ?
<FromGitter> <sam0x17> so this works, I'm able to serve "fast" requests while still serving a "slow" request concurrently: โŽ โŽ ```code paste, see link``` โŽ โŽ I could probably do it with a channel too [https://gitter.im/crystal-lang/crystal?at=5c4e226413a2814df6d8c8e9]
DTZUZO_ has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> how do you bind to C++ functions?
<FromGitter> <dscottboggs_gitlab> or does crystal not interface with c++ stuff, only C?
<FromGitter> <j8r> it's possible, there are Qt bindings
<FromGitter> <dscottboggs_gitlab> I know that's what I'm looking at to try to figure it out but I think @Papierkorb did some weird stuff to get it to work
<FromGitter> <dscottboggs_gitlab> like what is this supposed to mean โŽ โŽ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c4e2fc09221b9382dd0adad]
<FromGitter> <dscottboggs_gitlab> oh...shit... โŽ โŽ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c4e301e93fe7d5ac0fe600f]
<FromGitter> <sam0x17> @j8r the easiest way is to write a C wrapper for the C++ and bind with the C wrapper imo
<FromGitter> <dscottboggs_gitlab> that's what it's looking like to me too
<FromGitter> <sam0x17> that's what I always did in ruby with FFI
<FromGitter> <dscottboggs_gitlab> something like โŽ โŽ ```code paste, see link``` โŽ โŽ ? [https://gitter.im/crystal-lang/crystal?at=5c4e31c1c2dba5382e9a8ff5]
bmcginty has quit [Quit: leaving]
<FromGitter> <j8r> TIL websockets are obsolete. With HTTP/2 we can use SSE (server sent events)
<oprypin> dscottboggs_gitlab: yes, it's not possible to support c++, it doesn't have a well defined binary interface. you have to go through C. perhaps a simpler example is https://github.com/oprypin/crsfml/tree/sources/voidcsfml
<FromGitter> <dscottboggs_gitlab> @oprypin yes, that is a good example of what I was thinking of.