asterite changed the topic of #crystal-lang to: #crystal-lang The Crystal programming language | http://crystal-lang.org | Crystal 0.6.0 | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/manastech/crystal - Docs: http://crystal-lang.org/docs/ - API: http://crystal-lang.org/api/ - Logs: http://irclog.whitequark.org/crystal-lang
waj has joined #crystal-lang
knoopx has quit [Remote host closed the connection]
waj has quit [Quit: Leaving.]
waj has joined #crystal-lang
waj has quit [Client Quit]
_whitelogger has joined #crystal-lang
shama has quit [Remote host closed the connection]
shama has joined #crystal-lang
shama has quit [Ping timeout: 265 seconds]
weskinner_mac has joined #crystal-lang
weskinner_mac has quit [Client Quit]
bcardiff has joined #crystal-lang
havenwood has quit []
ponga has quit [Remote host closed the connection]
<gr33n7007h> does crystal support low level sockets eg. Socket.new(31,1,3)?
ponga has joined #crystal-lang
ponga has quit [Ping timeout: 264 seconds]
ponga has joined #crystal-lang
ponga has quit [Ping timeout: 245 seconds]
ponga has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
gr33n7007h has quit [Ping timeout: 245 seconds]
gr33n7007h has joined #crystal-lang
gr33n7007h has quit [Client Quit]
waj has joined #crystal-lang
waj has quit [Quit: Leaving.]
asterite has joined #crystal-lang
<asterite> >> [1, 2, 3][4]
<DeBot> asterite: IndexOutOfBounds: Index out of bounds
<jhass> >> a = [] of String; a[0] = "a"
<DeBot> jhass: IndexOutOfBounds: Index out of bounds
<asterite> Yes, that's intentional
<jhass> but not very convenient :P
<asterite> Ruby is the only language I know where you can assign to an arbitrary position
<asterite> Mmm… a = []; a[1_000_000] = 1
<asterite> Then you get like a huge array
<jhass> yah
<asterite> I mean, if you use an incorrect index by mistake, it works!
<asterite> and it will grow the array in the meantime :)
<asterite> Also… imagine this
<asterite> a = [] of Int32; a[100] = 1
<asterite> What would fill the rest?
<asterite> Can't be nil…
<jhass> yeah I know
<asterite> Could be zero, but… mmm… I don't like it
<jhass> >> a = Array(String).new(20); a[0] = ""
<DeBot> jhass: IndexOutOfBounds: Index out of bounds
<asterite> Yes, that just creates an array with that initial capacity, but empty
<asterite> I definitely need to document those methods :)
<asterite> (and everything, in general)
<jhass> it's a gotcha is all I'm saying I guess
<asterite> Yes…
<asterite> I particularily never programmed in that way in Ruby, but found many that do
<asterite> like, a = []; a[0] = 1; a[1] = 2; a[2] = 3
<asterite> instead of using push or <<
<asterite> Not yet :(
<asterite> By the way, that branch still gives me stack overflow
<asterite> in the `client` method
<asterite> The memory corruption happens near JSON::PullParser ?
<jhass> in this version, yeah
<jhass> if you keep the rescue below in, the exception there is corrupted instead
<jhass> can't repro the stack overflow though
<asterite> Ah, no, my mistake, it was the memory corruption
<asterite> I will need to reduce it, I'll do it some day with more time. For now, if in Notification.poll I assign the Array(Notification).from_json … to a variable and pp it, it crashes the compiler
<asterite> so that might have something to do, not sure
waj has joined #crystal-lang
bcardiff has quit [Quit: Leaving.]
weskinner_mac has joined #crystal-lang
weskinner_mac has quit [Quit: weskinner_mac]
bcardiff has joined #crystal-lang
weskinner_mac has joined #crystal-lang
weskinner_mac has quit [Quit: weskinner_mac]
weskinner_mac has joined #crystal-lang
havenwood has joined #crystal-lang
weskinner_work has joined #crystal-lang
waj has quit [Quit: Leaving.]
waj has joined #crystal-lang
waj has quit [Quit: Leaving.]
ismaelga has joined #crystal-lang
asterite has quit [Quit: Leaving.]
shama has joined #crystal-lang
waj has joined #crystal-lang
ponga has quit [Quit: Leaving...]
asterite has joined #crystal-lang
ponga has joined #crystal-lang
<weskinner_work> scoring and game over now working in weskinner/crystal-tetris :)
<jhass> <3
<jhass> next arrow keys please :P
<weskinner_work> next switching from weskinner/SDL2-crystal to weskinner/crystal-sdl2 which will fix the arrows :P
<jhass> lol
<weskinner_work> in the meantime you can practice your ambidexterity
<jhass> I just place the right hand on wasd
<weskinner_work> ha!
<jhass> but I think I realized now why I was so bad with the Gameboy version
<asterite> weskinner_work: it's working great here :)
<asterite> jhass: why?
<ponga> crystal tetris?
<ponga> must check out
<jhass> asterite: because my right hand is significantly better at tetris than my left hand
<ponga> haha
<ponga> jhass: black/white GB tetris?
<ponga> that grey screen
<jhass> yeah
<jhass> sadly lost it, no idea where it went :(
<ponga> we all lose old consoles
<ponga> wonder where they are all gone
<jhass> friend of me shopped like 5 broken snes from ebay a few years back and assembled a working one from it <3
<jhass> or even two I think
<ponga> cool
<ponga> Famicom
<jhass> nice
<asterite> And it would be "mentors winter of code", I guess…
<jhass> hehe
<asterite> Seriously, the words "summer" and "winter", as used in the top half part of the world, really strike me :)
asterite1 has joined #crystal-lang
asterite has quit [Ping timeout: 244 seconds]
<ytti> for longest time i thought winter is because of elliptical orbit around the sun
<ytti> but turns out, i'm closest to the sun during winter and farthest during summer
<jhass> I think it's the amount of sunlight per day? no idea actually, lol
panga has joined #crystal-lang
<ytti> yeah it's the declination, which part of the earth is angled towards earth, another part is then sort of shadowed by the other part
<ytti> i guess astronomically few million kilometer distance difference due to elliptical orbit is more or less meaningless
<jhass> I guess
<ytti> since where is energy gonna go, it's not like it'll dissipate meaningfully in space
ponga has quit [Ping timeout: 264 seconds]
<jhass> the habitable belt or what it was called is actually quite big I think
<ytti> in terms of it'll fit many many earths on it, sure
<ytti> but in astronomical terms, it's tiny
panga has quit [Quit: Leaving...]
ponga has joined #crystal-lang
weskinner_mac has joined #crystal-lang
asterite has joined #crystal-lang
asterite1 has quit [Read error: Connection reset by peer]
weskinner_mac has quit [Quit: weskinner_mac]
ismaelga has quit []
bcardiff has quit [Quit: Leaving.]
ismaelga has joined #crystal-lang
ismaelga has quit [Remote host closed the connection]
ismaelga has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 5 new commits to master: http://git.io/xihg
<crystal-gh> crystal/master 2770ae9 Ary Borenszweig: Fixed #432: Remove the "block argument 'x' shadows local variable 'x'" error
<crystal-gh> crystal/master c0fe31f Ary Borenszweig: Added StringLiteral#tr in macros
<crystal-gh> crystal/master 5189a95 Ary Borenszweig: Added StringLiteral#gsub(Regex, String) in macros
<jhass> \o/
ismaelga has quit [Ping timeout: 252 seconds]
asterite has quit [Quit: Leaving.]
<travis-ci> manastech/crystal#2074 (master - 965d695 : Ary Borenszweig): The build passed.
panga has joined #crystal-lang
ponga has quit [Read error: No route to host]
<weskinner_work> why doesn't "Pointer(MyLib::MyStruct).null != nil" sometimes?
<weskinner_work> why does**
<weskinner_work> maybe it never has and I just haven't noticed yet
<jhass> yeah, was asking about the "sometimes"
<jhass> it's interpreted as falsey I think but not equal to nil
<weskinner_work> ahh " SDL2.raise "Can't load bitmap from '#{filename}'" unless rw_ops"
<jhass> >> lib Fake; struct Foo; end; end; Pointer(Fake::Struct).null == nil
<DeBot> jhass: Error in line 3: undefined constant Fake::Struct
<jhass> >> lib Fake; struct Foo; end; end; Pointer(Fake::Foo).null == nil
<DeBot> jhass: false
<jhass> >> lib Fake; struct Foo; end; end; nil == Pointer(Fake::Foo).null
<DeBot> jhass: false
<weskinner_work> I need to use something like that and just check falsy instead of == nil
<jhass> :)
<weskinner_work> >> lib Fake; struct Foo; end; end; raise "BAD" unless Pointer(Fake::Foo).null
<DeBot> weskinner_work: Exception: BAD
knoopx has joined #crystal-lang
<jhass> mmh
<jhass> >> lib Fake; struct Foo; end; end; unless Pointer(Fake::Foo).null; raise "BAD"; end
<DeBot> jhass: Exception: BAD
<jhass> >> lib Fake; struct Foo; end; end; ptr = Pointer(Fake::Foo).null; unless ptr; raise "BAD"; end
<DeBot> jhass: Exception: BAD
* jhass shrug
<jhass> >> lib Fake; struct Foo; end; end; ptr = Pointer(Fake::Foo).null; unless ptr.null?; raise "BAD"; end
<DeBot> jhass: Error in line 3: undefined method 'null?' for Pointer(Fake::Foo)
<jhass> huh
<weskinner_work> that would be useful
<jhass> I was fairly certain it exists
<jhass> >> lib Fake; struct Foo; end; end; ptr = Pointer(Fake::Foo).null; if ptr; raise "BAD"; end
<DeBot> jhass: nil
<jhass> oh, right
<jhass> a null pointer is falsey, so unless null_pointer -> unless false -> if true
* jhass needs some sugar
asterite has joined #crystal-lang
asterite has quit [Client Quit]
ismaelga has joined #crystal-lang
havenwood has quit []
ismaelga has quit [Ping timeout: 250 seconds]
asterite has joined #crystal-lang
asterite has quit [Client Quit]
<weskinner_work> jhass: got your arrow keys working :P
<jhass> <3
<jhass> gotta explain foo &&= bar to a chap, then I'll try
leafybasil has joined #crystal-lang
<ytti> what's to explain assign if true
<jhass> I think it helps what it's doing with all the details
<jhass> to properly understand it
<jhass> like, why it's doing that
<jhass> weskinner_work: mmh, might want to add .deps to a .gitignore btw
<weskinner_work> u right, u right
<jhass> also I'd decrese the delay for fast down when pressing down :)
ismaelga has joined #crystal-lang
<weskinner_work> agreed
<weskinner_work> you can use "SPACE" for insta-drop
<jhass> ah, neat
<ytti> tetris is only game where i've gone into zone/flow, what ever you call it, where i don't even conciously understand how i'm able to do what i do
<ytti> almost like autopilot
<ytti> and even that was almost two decades ago
<ytti> in class at hp48g no less
waj has quit [Ping timeout: 272 seconds]
havenwood has joined #crystal-lang
<jhass> oh, score doesn't reset when you loose :D
ismaelga has quit [Remote host closed the connection]
<weskinner_work> was worried about that :)
asterite has joined #crystal-lang
<asterite> weskinner_work: jhass: you can use .nil? for Pointer, but it's true that comparing nil to a null pointer should give a correct result