ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | 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
<FromGitter> <mattrberry> Is there an issue open to track type narrowing like this? ⏎ ⏎ ```Error: no overload matches 'Float64#+' with type (Float64 | String)``` ⏎ ⏎ In this case we know left and right are either both float or both string, but the crystal type checker can't distinguish that. I imagine this is likely tricky to narrow [https://gitter.im/crystal-lang/crystal?at=61f9d55751bd8b580c821036]
<FromGitter> <Blacksmoke16> wonder if you could use a case
<FromGitter> <Daniel-Worrall> Tuple with case yeah
<FromGitter> <mattrberry> Yeah I guess I can use a case with two `when` branches, which is effectively equivalent to an `if` with two branches. My point was more that it *should* be possible with just the one branch
<FromGitter> <moe:busyloop.net> hm. it definitely is. makes me curious, are there languages that can do it already? i feel like crystal will get there, but probably not during 1.x.
<FromGitter> <mattrberry> I'm not aware of any languages that support this. I figured Crystal might since it's pretty advanced with its type narrowing, but it's definitely a bit more complicated once you start adding &&s and ||s to the picture :p
ur5us has quit [Ping timeout: 260 seconds]
<FromGitter> <moe:busyloop.net> a bit 😬
ur5us has joined #crystal-lang
brw has quit [*.net *.split]
HumanG33k has quit [*.net *.split]
pusewic|away__ has quit [*.net *.split]
antoszka has quit [*.net *.split]
f1refly has quit [*.net *.split]
sorcus has quit [*.net *.split]
kevinsjoberg has quit [*.net *.split]
ur5us has quit [*.net *.split]
mikko has quit [*.net *.split]
maxpowa has quit [*.net *.split]
spuun has quit [*.net *.split]
jhass has quit [*.net *.split]
dannyAAM has quit [*.net *.split]
ua__ has quit [*.net *.split]
riza has quit [*.net *.split]
kiwiroy has quit [*.net *.split]
peer has quit [*.net *.split]
FromGitter has quit [*.net *.split]
jrayhawk has quit [*.net *.split]
yxhuvud has quit [*.net *.split]
mookie has quit [*.net *.split]
fifr_ has quit [*.net *.split]
dostoyevsky2 has quit [*.net *.split]
wolfshappen has quit [*.net *.split]
Peter0x44 has quit [*.net *.split]
Flipez has quit [*.net *.split]
dom96 has quit [*.net *.split]
mattt2 has quit [*.net *.split]
notzmv has quit [*.net *.split]
adam12 has quit [*.net *.split]
holst has quit [*.net *.split]
xybre has quit [*.net *.split]
pixel has quit [*.net *.split]
repo has quit [*.net *.split]
avane has quit [*.net *.split]
antoni has quit [*.net *.split]
olbat__ has quit [*.net *.split]
frojnd has quit [*.net *.split]
Liothen has quit [*.net *.split]
void09 has quit [*.net *.split]
lanodan has quit [*.net *.split]
markmarkmark has quit [*.net *.split]
SamantazFox has quit [*.net *.split]
Elouin has quit [*.net *.split]
[R] has quit [*.net *.split]
Stephie has quit [*.net *.split]
straight-shoota has quit [*.net *.split]
oz has quit [*.net *.split]
mookie has joined #crystal-lang
sorcus has joined #crystal-lang
dannyAAM has joined #crystal-lang
spuun has joined #crystal-lang
riza has joined #crystal-lang
olbat__ has joined #crystal-lang
Liothen has joined #crystal-lang
HumanG33k has joined #crystal-lang
Elouin has joined #crystal-lang
SamantazFox has joined #crystal-lang
ur5us has joined #crystal-lang
brw has joined #crystal-lang
pusewic|away__ has joined #crystal-lang
antoszka has joined #crystal-lang
mikko has joined #crystal-lang
f1refly has joined #crystal-lang
adam12 has joined #crystal-lang
maxpowa has joined #crystal-lang
Peter0x44 has joined #crystal-lang
dostoyevsky2 has joined #crystal-lang
fifr_ has joined #crystal-lang
yxhuvud has joined #crystal-lang
avane has joined #crystal-lang
FromGitter has joined #crystal-lang
jrayhawk has joined #crystal-lang
ua__ has joined #crystal-lang
kiwiroy has joined #crystal-lang
holst has joined #crystal-lang
kevinsjoberg has joined #crystal-lang
void09 has joined #crystal-lang
frojnd has joined #crystal-lang
jhass has joined #crystal-lang
antoni has joined #crystal-lang
wolfshappen has joined #crystal-lang
dom96 has joined #crystal-lang
repo has joined #crystal-lang
peer has joined #crystal-lang
xybre has joined #crystal-lang
pixel has joined #crystal-lang
mattt2 has joined #crystal-lang
Flipez has joined #crystal-lang
markmarkmark has joined #crystal-lang
lanodan has joined #crystal-lang
Stephie has joined #crystal-lang
straight-shoota has joined #crystal-lang
[R] has joined #crystal-lang
oz has joined #crystal-lang
r0bby has quit [Ping timeout: 250 seconds]
r0bby has joined #crystal-lang
ur5us has quit [Ping timeout: 245 seconds]
notzmv has joined #crystal-lang
<FromGitter> <kingsleyh> I have a method that is recursive and returns either an Array or Array(Array) - but it doesn't understnand the type for the body - but since it's recursive if I put Array(Array) then it wants Array(Array(Array))) - any idea what to do here ?
<FromGitter> <kingsleyh> is there some kind of Type signature to represent this recursive nature
<FromGitter> <kingsleyh> like Array(String | Array(String)+)
ur5us has joined #crystal-lang
<FromGitter> <kingsleyh> ah Maybe I have to make a Struct to hold it - with a type that references itself in the Type list
<FromGitter> <kingsleyh> this worked: alias X = Nil | Bool | Float64 | String | Array(X)
<FromGitter> <nfesselet> Hello everybody. I’m trying to use ysbaddaden's sdl bindings but I’m getting core dumps as soon as I’m trying to poll events with SDL::Event.poll. ⏎ `Invalid memory access (signal 11) at address 0xe0 ⏎ [0x561e3796d8f6] *Exception::CallStack::print_backtrace:Nil +118 ` ⏎ I have no idea how to debbug the problem. Could anybody give me a hint ? [https://gitter.
<FromGitter> ... im/crystal-lang/crystal?at=61fa3f78708e9c3dd75b1004]
ur5us has quit [Ping timeout: 256 seconds]
<FromGitter> <nfesselet> I read an old message about native SDL bindings that should be disabled in the compiler, is that still the case ?
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 260 seconds]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 252 seconds]
ejjfunky has joined #crystal-lang
sagax has joined #crystal-lang
<FromGitter> <mattrberry> I use those SDL bindings a without an issue https://github.com/mattrberry/crab ⏎ ⏎ Are you sure you're initializing SDL properly?
<FromGitter> <asterite> @mattrberry I don't think that's possible to do, at least not without dramatically changing the language. Right now the compiler knows to restrict the type of one variable, but it can't restrict the type of one variable with respect to another one. In that branch the possibilities are both left and right are Float64, or both left and right are String, so what's the type of just `left`? There's no answer. I
<FromGitter> ... think that given that this is a pretty rare case, and that you can write it in other ways which involve slightly more redundant code (repeating the branch, which in this case is just `left + right`) I think it's an acceptable compromise
<FromGitter> <mattrberry> Oh yeah, I definitely agree it's an acceptable compromise! I was just thinking that of the languages I use regularly, Crystal would be the most likely to support something like that so I figured I'd ask :)
ejjfunky has quit [Remote host closed the connection]
Guest54 has joined #crystal-lang
Guest54 has quit [Client Quit]
yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
yxhuvud has joined #crystal-lang
ur5us has joined #crystal-lang
oz has quit [*.net *.split]
[R] has quit [*.net *.split]
Stephie has quit [*.net *.split]
straight-shoota has quit [*.net *.split]
SamantazFox has quit [*.net *.split]
Elouin has quit [*.net *.split]
r0bby has quit [*.net *.split]
brw has quit [*.net *.split]
HumanG33k has quit [*.net *.split]
antoszka has quit [*.net *.split]
pusewic|away__ has quit [*.net *.split]
f1refly has quit [*.net *.split]
sorcus has quit [*.net *.split]
kevinsjoberg has quit [*.net *.split]
mikko has quit [*.net *.split]
maxpowa has quit [*.net *.split]
spuun has quit [*.net *.split]
jhass has quit [*.net *.split]
dannyAAM has quit [*.net *.split]
ua__ has quit [*.net *.split]
riza has quit [*.net *.split]
kiwiroy has quit [*.net *.split]
peer has quit [*.net *.split]
FromGitter has quit [*.net *.split]
jrayhawk has quit [*.net *.split]
mookie has quit [*.net *.split]
dostoyevsky2 has quit [*.net *.split]
fifr_ has quit [*.net *.split]
wolfshappen has quit [*.net *.split]
Peter0x44 has quit [*.net *.split]
dom96 has quit [*.net *.split]
Flipez has quit [*.net *.split]
mattt2 has quit [*.net *.split]
adam12 has quit [*.net *.split]
holst has quit [*.net *.split]
xybre has quit [*.net *.split]
sagax has quit [*.net *.split]
pixel has quit [*.net *.split]
notzmv has quit [*.net *.split]
repo has quit [*.net *.split]
ur5us has quit [*.net *.split]
avane has quit [*.net *.split]
antoni has quit [*.net *.split]
frojnd has quit [*.net *.split]
olbat__ has quit [*.net *.split]
Liothen has quit [*.net *.split]
void09 has quit [*.net *.split]
lanodan has quit [*.net *.split]
markmarkmark has quit [*.net *.split]
r0bby has joined #crystal-lang
FromGitter has joined #crystal-lang
jrayhawk has joined #crystal-lang
fifr_ has joined #crystal-lang
Stephie has joined #crystal-lang
[R] has joined #crystal-lang
f1refly has joined #crystal-lang
kevinsjoberg has joined #crystal-lang
antoszka has joined #crystal-lang
pusewic|away__ has joined #crystal-lang
HumanG33k has joined #crystal-lang
brw has joined #crystal-lang
markmarkmark has joined #crystal-lang
lanodan has joined #crystal-lang
Liothen has joined #crystal-lang
olbat__ has joined #crystal-lang
void09 has joined #crystal-lang
frojnd has joined #crystal-lang
SamantazFox has joined #crystal-lang
avane has joined #crystal-lang
antoni has joined #crystal-lang
Elouin has joined #crystal-lang
ua__ has joined #crystal-lang
Peter0x44 has joined #crystal-lang
riza has joined #crystal-lang
mookie has joined #crystal-lang
dostoyevsky2 has joined #crystal-lang
notzmv has joined #crystal-lang
kiwiroy has joined #crystal-lang
sagax has joined #crystal-lang
peer has joined #crystal-lang
ur5us has joined #crystal-lang
jhass has joined #crystal-lang
dannyAAM has joined #crystal-lang
repo has joined #crystal-lang
straight-shoota has joined #crystal-lang
wolfshappen has joined #crystal-lang
dostoyevsky2 has quit [Max SendQ exceeded]
dostoyevsky2 has joined #crystal-lang
mikko has joined #crystal-lang
maxpowa has joined #crystal-lang
spuun has joined #crystal-lang
mattt2 has joined #crystal-lang
dom96 has joined #crystal-lang
Flipez has joined #crystal-lang
oz has joined #crystal-lang
adam12 has joined #crystal-lang
xybre has joined #crystal-lang
pixel has joined #crystal-lang
holst has joined #crystal-lang
dostoyevsky2 has quit [Client Quit]
dostoyevsky2 has joined #crystal-lang
dostoyevsky2 has quit [Client Quit]
dostoyevsky2 has joined #crystal-lang
sorcus has joined #crystal-lang
dostoyevsky2 has quit [Quit: leaving]
dostoyevsky2 has joined #crystal-lang
sorcus has quit [Ping timeout: 250 seconds]
sorcus has joined #crystal-lang
hightower2 has joined #crystal-lang
ur5us has quit [Remote host closed the connection]
ur5us has joined #crystal-lang
ur5us has quit [Remote host closed the connection]