<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?
<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
<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>
<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>
@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