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
faustinoaq has quit [Quit: IRC client terminated!]
<crystal-gh> [crystal] larubujo reopened pull request #5456: Optimize String#to_json (master...opt-string-to-json) https://git.io/vb7hX
alex`` has quit [Quit: WeeChat 2.0.1]
faustinoaq has joined #crystal-lang
<crystal-gh> [crystal] MakeNowJust opened pull request #5491: Fix String#sub with negative index (master...fix/string/5490-sub-with-negative-index) https://git.io/vbAwk
sz0 has joined #crystal-lang
marius has joined #crystal-lang
<FromGitter> <bararchy> Morning all :)
<FromGitter> <bararchy> Morning all
<crystal-gh> [crystal] MakeNowJust opened pull request #5492: Fix formatting call arguments with trailing comments (master...fix/crystal-format/5489) https://git.io/vbAK6
faustinoaq has quit [Ping timeout: 268 seconds]
claudiuinberlin has joined #crystal-lang
faustinoaq has joined #crystal-lang
dragonkh has joined #crystal-lang
<dragonkh> hi - I'm using kemal-session-redis and trying to access the string I stored in the session from the websocket - but although the cookie is present - the session is empty - anyone got any idea about if it's possible to access the session string I store using an http post within the websocket stanza?
<FromGitter> <bararchy> dragonkh you can ask @sdogruyol or @crisward ⏎ better, you can use Kemel's channel
<FromGitter> <bararchy> sdogruyol/kemal
<dragonkh> ah I didn't realise kemal had a channel
<dragonkh> thanks
<FromGitter> <bararchy> no worries :)
<dragonkh> if I look at session.request - there is no cookie present - does that mean the browser is not sending the cookie for the websocket? I thought the browser would automatically send a cookie in the header of the websocket request
alex`` has joined #crystal-lang
<dragonkh> ok - got it working - my stupid mistake - I had the client set to ws://0.0.0.0:3000 instead of localhost:3000 and the cookie was on the localhost domain
Ven`` has joined #crystal-lang
Ven`` has quit [Client Quit]
Ven`` has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<RX14> lots of PRs recently
<FromGitter> <bararchy> seems so, Crystal is a busy repo
<FromGitter> <straight-shoota> Yeah and a quite long backlog... :/
<FromGitter> <straight-shoota> IIRC there were roughly 100 open PRs for the most part of the year, now it's 150
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RX14> lol
<RX14> go look at golang/go and rust-lang/rust
<RX14> oh nvm i was looking at issues
<FromGitter> <drosehn> I suspect the release of 0.24.x has triggered more activity. Or maybe it's just that we're in a holiday break.
jnyw has quit [Quit: WeeChat 2.0.1]
rohitpaulk has quit [Ping timeout: 265 seconds]
faustinoaq has quit [Read error: Connection reset by peer]
faustinoaq has joined #crystal-lang
Papierkorb has joined #crystal-lang
<FromGitter> <bararchy> I'm working on exporting some kind of visual output from SHAInet to text (or image, w\e is easier) ⏎ I want to do something like this https://gist.github.com/bararchy/3a0eb08ac6527c62cce7f8383c4a440a but automaticlly (dump corrent structure to visualize info)
<FromGitter> <bararchy> any ideas on how to do it? do we have a shard for it?
<FromGitter> <bararchy> maybe not even as text ⏎ Something that might allow for ⏎ ⏎ ```a = image.new_point ⏎ b = image.new_point ⏎ image.connect_arrow(a, b)``` [https://gitter.im/crystal-lang/crystal?at=5a48e3c629ec6ac311a1fbd0]
Ven`` has joined #crystal-lang
<FromGitter> <bararchy> ok, so it seems that the right? name is "graph"
<FromGitter> <bararchy> like here
<RX14> @bararchy generate graphviz
<RX14> Its a bit shit but slightly easier than rolling your own
<FromGitter> <bararchy> Oh, yes! it seems it's exactly what I want :)
<FromGitter> <bararchy> Thanks RX14
<RX14> Its an easy format to generate
<RX14> Then you just shell out to render to png
<RX14> A graphviz shard would be possible too
<RX14> Or svg
<RX14> No problem
<RX14> @bararchy graphviz is actually usable as a shared library so it might be more robust to go that route
<FromGitter> <bararchy> let me research it, TBH it might be a little selfish but right now if I can simply hack a quick "output_to_graph" using 10 lines of code I might prefer it
<RX14> At least the option is there
<RX14> If you can bring that up to date
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rohitpaulk has joined #crystal-lang
Ven`` has joined #crystal-lang
<crystal-gh> [crystal] straight-shoota opened pull request #5493: Remove unneeded parenthesis from calls in macro expression (master...jm-remove-macro-parens) https://git.io/vbAbZ
cremes has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter> <codenoid> win 7 is great for programming
<FromGitter> <codenoid> crystal must support this os
gewo has quit [Quit: WeeChat 1.6]
gewo has joined #crystal-lang
andrewzah has quit [Ping timeout: 248 seconds]
dannyAAM has quit [Ping timeout: 248 seconds]
early` has joined #crystal-lang
DTZUZU has quit [Ping timeout: 248 seconds]
bmcginty has quit [Ping timeout: 248 seconds]
early has quit [Ping timeout: 248 seconds]
claudiuinberlin has quit [Ping timeout: 248 seconds]
ua has quit [Ping timeout: 248 seconds]
dostoyevsky has quit [Ping timeout: 248 seconds]
A124 has quit [Ping timeout: 240 seconds]
DTZUZU has joined #crystal-lang
bmcginty has joined #crystal-lang
A124 has joined #crystal-lang
<Ven``> Hi, I'm wondering if the stdlib features a method like "Interval.every(...) { block }"? or is spawn + loop + sleep the way to go?
dannyAAM has joined #crystal-lang
andrewzah has joined #crystal-lang
dostoyevsky has joined #crystal-lang
ua has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<RX14> Ven``: I tried to get one in but it didn't happen
<RX14> Yes, you need to loop and sleep
<Ven``> ok! ty. do you have a link to your PR/issue that I could take a look at?
<RX14> Thing is its rather harder to get exactly right
<RX14> Because the work you do takes time too
<RX14> So you really want to record Time.now once
<RX14> Add some time to it every loop
<RX14> Then sleep until the time you calculate
<Ven``> the good ol' setTimeout recursively vs setInterval in JS :P.
<RX14> Yeah...
<RX14> We don't even have a sleep until time method I think
<RX14> Just a sleep for time
<FromGitter> <codenoid> okay, good night
<RX14> Ven``: I'll try and find it
<Ven``> thanks
<Ven``> RX14: oohh, I actually use DiscordCr, can I consider this API? :P
<RX14> Lol
<RX14> Yes
<RX14> Its not used internally
<RX14> Its there to be api
<RX14> Since we couldn't get it in the stdlib
<RX14> Its actually a bit of a bad implementation now, given we have monotonic time
<RX14> That method will probably die on leap seconds
<RX14> Hmmmm
<Ven``> that... doesn't really matter to me :-). I want a 5-minutes timer, tbh.
<Ven``> thanks!
<Ven``> RX14: why `loop do |i|` vs `loop` ?
<RX14> Well
<RX14> You don't need it
<RX14> loop do is enough
<RX14> Not sure why meew0 bothered to add the unused i argument
<RX14> Ven``: am I understanding your question correctly?
<Ven``> yeah
<RX14> Its just because meew0 made a mistake
<Ven``> can someone point out the difference between `i!=2` and `i != 2`?
sz0 has quit [Quit: Connection closed for inactivity]
<oprypin> Ven``, no difference at least in theory
<oprypin> in practice `!` can sometimes be part of an identifier's name and the parser might screw up
<Ven``> yah ok
<Ven``> i get it
<Ven``> this is why ruby doesn't allow ! and ? as part of variables names :c
<oprypin> crystal shouldnt either, this is a bug
<Ven``> are you sure?
<Ven``> oprypin: should I open an issue on github?
<oprypin> there's definitely already a related issue, wish i could find it
<oprypin> but the only keyword i have for it is that it possibly contains '!'
<Ven``> you fixed it :P.
<RX14> yeah ok
<oprypin> yay how did you find it
<RX14> I agree with oprypin
<Ven``> oprypin: i'm very used to github search :P years of triaging some big projects' trackers...
<oprypin> so this was for defining functions, now we're in variable territory
<Ven``> is that PR supposedly on the latest version?
<oprypin> yeah definitely. although play.crystal-lang.org doesnt have latest
<oprypin> i checked on latest and your example is still broken
<Ven``> i dont have the latest version
<Ven``> ah ok ty
<FromGitter> <drujensen> I kinda wish the ! instead of `.not_nil!` was available in crystal
<FromGitter> <drujensen> like swift
<RX14> who hosts carc.in? jhass?
<oprypin> yeah
<RX14> beep boop ping jhass
<RX14> @drujensen well ! is too short
<RX14> not_nil! is ugly
<RX14> and it should be
<RX14> it's ugly theoretically
<RX14> it's ugly to the user
<RX14> and so it should be ugly syntactically
<Ven``> 👏👏
<oprypin> it's basically a very specific assert but nobody will admit it
<RX14> yes oprypin
<RX14> thats what it is
<RX14> i never really thought about that
<RX14> well not in those words
<RX14> but I did think of it as a raise
<RX14> but most people seem to think of it as the effect
<RX14> of removing nil
<RX14> not how it does that
<oprypin> i'm still dreaming of an assert, which could double as .not_nil! if it returned its expression
<oprypin> and also i thought about that thing where it's optimized in release mode -- the compiler should be able to know when it's safe to remove the check (i.e. only when it's not a type check)
<RX14> too complex
<RX14> any assert that changes behaviour on release mode or not is bad
<RX14> well I'd argue against it at least
<RX14> assert is fantastic for specs
<RX14> but not so much for runtime
<FromGitter> <drujensen> @RX14 It’s definitely ugly, I will give you that. It’s pretty common to need to unwrap the nil from a union type.
<RX14> well i'd say I havent used that method in aages
<FromGitter> <drujensen> what is your recommendation?
<FromGitter> <drujensen> assigning to a local var?
<RX14> @drujensen depends on context
<RX14> nil is not a problem
<RX14> it simply represents something
<RX14> you need to work out your failure cases
<FromGitter> <drujensen> agree
<RX14> whether those cases are possible
<RX14> what to do in those cases
<RX14> and whether you can refactor your code to make the compiler agree better with you what is possible
<RX14> or more accurately
<RX14> or more often
<RX14> change your code to actually fix the bugs that the compiler says it has
<Ven``> is there an opposite to Object#try/Nil#try?
<Ven``> like, Object#recover. Basically T | Nil -> T -> T
<FromGitter> <drujensen> so you just avoid using `.not_nil!` on purpose?
<Ven``> (or T | Nil -> (-> T) -> T)
<RX14> @drujensen yeah ofc
<RX14> .not_nil! is a code smell
<RX14> if you can avoid it, avoid it
<FromGitter> <drujensen> If I know that the value is not nil, why wouldn’t I use it?
<FromGitter> <drujensen> why would that be a code smell?
<Ven``> because of the type is T | Nil, that means the value can be nil
<FromGitter> <bew> Ven``: Object#tap ? (Not sure)
<Ven``> FromGitter: nope, Object#tap returns self (plus Nil doesn't tap)
<FromGitter> Ven``, I'm a bot, *bleep, bloop*. I relay messages between here and https://gitter.im/crystal-lang/crystal
<Ven``> bew: nope, Object#tap returns self (plus Nil doesn't tap)
<RX14> Ven``, im confused at what you want
<FromGitter> <drujensen> I could unwrap the union type to remove Nil
<RX14> very confused
<Ven``> RX14: provide a "default value" to go from T | Nil to T
hello_ has joined #crystal-lang
<RX14> @drujensen because theres very few times where I write code where the compiler is wrong
<RX14> about what can be Ni;
<RX14> nil
<RX14> Ven``, value || default
<RX14> :)
<RX14> value ||= default is cool too
<Ven``> ah, crystal is not able to recover the type there
<RX14> it is
<Ven``> er, I meant (a || []) doesn't work
<RX14> it should
<RX14> can you give an example
<FromGitter> <drujensen> I guess it depends on context as you said.
<hello_> SDL (https://www.libsdl.org) is a graphics library made in C. Could I bind this in crystal somehow? because i mean crystal supports c bindings
<FromGitter> <drujensen> In most cases I wouldnt’ define the field with `?` if I can avoid it
<RX14> there are SDL bindings hello_
<hello_> but not for crystal
<RX14> yes
<hello_> ooh!
<RX14> Ven``, thats not a nil error
<Ven``> ..I didn't say it was?
<RX14> oh
<RX14> i misunderstood
<RX14> well what is [] an array of?
<RX14> [1, 2, 3] is an Array(Int32)
<RX14> but what is [] ?
<RX14> the compiler can;
<RX14> can't tell
<RX14> so you need to tell the compiler
<Ven``> my point is, it could recover it from ||'s left side
<Ven``> anyway it's not an issue I just didn't know
<RX14> use Array(Int32).new or [] of Int32 for empty arrays
<RX14> Ven``, the compiler used to do fancy stuff like that in 2013-2014
<RX14> it was too slow
<RX14> and it was removed for compiler performance
<Ven``> I think I remember something like this, yeah
hello_ has quit [Quit: Page closed]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jhass> >> Crystal::VERSION
<jhass> damn
<RX14> rip
DeBot has joined #crystal-lang
<jhass> >> Crystal::VERSION
<DeBot> jhass: # => "0.24.1" - https://carc.in/#/r/3beg
<RX14> yay
imnotold has joined #crystal-lang
<imnotold> how can I get an old version of crystal?
<RX14> imnotold, download it?
<imnotold> i normally do this: sudo apt-get install crystal
<RX14> cant downgrade
<RX14> the old packages are deleted
<RX14> well not the deb packages
<jhass> get one of the old tarballs, extract it somewhere, do alias crystalXX=/path/to/its/bin/crystal
<imnotold> its okay i will just give up
<imnotold> thats the easiest solution
<RX14> i raised this issue to manas but I didn't see much response
<RX14> why do you need an older compiler imnotold ?
<jhass> I don't think my solution is that much more complicated :P
<FromGitter> <LuckyChicken91_twitter> because of kemal
<FromGitter> <LuckyChicken91_twitter> kemal uses 0.22 crystal :/
<RX14> no..?
<FromGitter> <LuckyChicken91_twitter> huh no?
<RX14> the latest kemal tag is 0.24.0
<RX14> no
<FromGitter> <LuckyChicken91_twitter> but i get an error
<RX14> 0.23.1 at least
<RX14> 0.22.x is long dead
<RX14> @LuckyChicken91_twitter what error
<jhass> how about we try to get your error fixed?
<FromGitter> <LuckyChicken91_twitter> in lib/kemal/src/kemal/helpers/helpers.cr:137: undefined method 'open' for Flate::Writer:Class ⏎ ⏎ ``` Flate::Writer.open(env.response) do |deflate|``` [https://gitter.im/crystal-lang/crystal?at=5a49297268d092bb620bf7c7]
<RX14> did you run shards update
<RX14> after upgrading the kemal version
<FromGitter> <LuckyChicken91_twitter> ooh i did not know shards update exists
<RX14> depends how your shard.yml looks as to if it makes a difference
<FromGitter> <LuckyChicken91_twitter> i did it. the error is still alive
<FromGitter> <LuckyChicken91_twitter> its this: ⏎ name: mywebapp ⏎ version: 0.0.1 ⏎ ⏎ dependencies: ... [https://gitter.im/crystal-lang/crystal?at=5a4929c10163b02810998216]
<RX14> and what does shards update output?
<RX14> it should give some output
<FromGitter> <LuckyChicken91_twitter> Updating https://github.com/kemalcr/kemal.git ⏎ Updating https://github.com/luislavena/radix.git ⏎ Updating https://github.com/jeromegn/kilt.git ⏎ Using kemal (0.22.0) ⏎ Using radix (0.3.8) ... [https://gitter.im/crystal-lang/crystal?at=5a4929f4232e79134daef946]
<RX14> darn
<RX14> maybe kemal isn't properly updated
<RX14> @sdogruyol
<imnotold> oh
<RX14> that
<RX14> shouldnt
<RX14> happen?
<RX14> what??
<RX14> @LuckyChicken91_twitter what is your crystal -v
<RX14> because im not sure you're using 0.24.1
<FromGitter> <LuckyChicken91_twitter> its ⏎ Crystal 0.23.1 [e2a1389] (2017-07-13) LLVM 3.8.1
<FromGitter> <LuckyChicken91_twitter> ooh
<RX14> yeah uhh
<FromGitter> <LuckyChicken91_twitter> yes im not using it
<RX14> lol
<RX14> well there we go
Ven`` has joined #crystal-lang
<FromGitter> <LuckyChicken91_twitter> it works
rohitpaulk has quit [Ping timeout: 268 seconds]
<crystal-gh> [crystal] jhass opened pull request #5494: Move ECDHE key init to OpenSSL server context (master...move_ecdh_key_init) https://git.io/vbxfv
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jhass> RX14: ^ fyi that fixes the issue (the server I wanted to connect to only has a sec384r1 curve)
<jhass> we talked about earlier
<RX14> Huh
ashirase has quit [Ping timeout: 260 seconds]
ashirase has joined #crystal-lang
Ven`` has joined #crystal-lang
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
imnotold has quit [Ping timeout: 260 seconds]
<crystal-gh> [crystal] RX14 closed pull request #5494: Move ECDHE key init to OpenSSL server context (master...move_ecdh_key_init) https://git.io/vbxfv
<faustinoaq> Hi community, I'm trying to install crystal on raspberry pi 3 using http://public.portalier.com/raspbian/, but when I try `apt-get update` it fails
<faustinoaq> Currently I'm cross-compiling the object file and linking on RPi3
<faustinoaq> BTW, Happy new year! :)
marius has quit [Quit: marius]
illyohs has joined #crystal-lang
<RX14> @faustinoaq, need an error message to debug that
<travis-ci> crystal-lang/crystal#29488b0 (master - Move ECDHE key init to OpenSSL server context (#5494)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/323658145
<DeBot> https://github.com/crystal-lang/crystal/pull/5494 (Move ECDHE key init to OpenSSL server context)
aroaminggeek has joined #crystal-lang
aroaminggeek has quit [Ping timeout: 248 seconds]
aroaminggeek has joined #crystal-lang
aroaminggeek has quit [Read error: Connection reset by peer]
<FromGitter> <faustinoaq> ```code paste, see link``` ⏎ ⏎ @RX14 ^^ [https://gitter.im/crystal-lang/crystal?at=5a4952a6edd2230811f9f36d]
<RX14> oops
<RX14> @ysbaddaden
aroaminggeek has joined #crystal-lang
jnyw has joined #crystal-lang
cremes has quit [Quit: cremes]
relyks has joined #crystal-lang
marius has joined #crystal-lang
greengriminal has joined #crystal-lang
marius has quit [Quit: marius]