pawnbox_ has quit [Remote host closed the connection]
kulelu88 has quit [Quit: Leaving]
pawnbox has joined #crystal-lang
snsei has quit [Remote host closed the connection]
pawnbox has quit [Ping timeout: 276 seconds]
SShrike has quit [Quit: SShrike]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
Philpax has quit [Ping timeout: 252 seconds]
Oliphaunte has quit [Remote host closed the connection]
ome has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
Oliphaunte has joined #crystal-lang
snsei has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 246 seconds]
Oliphaunte has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
akwiatkowski has joined #crystal-lang
pawnbox has quit [Ping timeout: 246 seconds]
Raimondi has quit [*.net *.split]
triangles has quit [*.net *.split]
pabs has quit [*.net *.split]
txdv has quit [*.net *.split]
grindhold has quit [*.net *.split]
Yxhuvud has quit [*.net *.split]
ome has quit [*.net *.split]
BlaXpirit has quit [*.net *.split]
p0nce has quit [*.net *.split]
j2k has quit [*.net *.split]
Liothen has quit [*.net *.split]
jokke has quit [*.net *.split]
danzilio has quit [*.net *.split]
maxpowa has quit [*.net *.split]
xaxes` has quit [*.net *.split]
joshcarter has quit [*.net *.split]
tliff has quit [*.net *.split]
guilleiguaran__ has quit [*.net *.split]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
akwiatkowski has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 252 seconds]
zodiak_ has joined #crystal-lang
zodiak has quit [Ping timeout: 246 seconds]
snsei has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
soveran has joined #crystal-lang
<FromGitter>
<sdogruyol> morning everyone
soveran has quit [Remote host closed the connection]
Raimondi has joined #crystal-lang
triangles has joined #crystal-lang
txdv has joined #crystal-lang
pabs has joined #crystal-lang
grindhold has joined #crystal-lang
Yxhuvud has joined #crystal-lang
BlaXpirit has joined #crystal-lang
j2k has joined #crystal-lang
p0nce has joined #crystal-lang
Liothen has joined #crystal-lang
jokke has joined #crystal-lang
xaxes` has joined #crystal-lang
maxpowa has joined #crystal-lang
joshcarter has joined #crystal-lang
danzilio has joined #crystal-lang
tliff has joined #crystal-lang
guilleiguaran__ has joined #crystal-lang
<FromGitter>
<hkochev> Morning Serdar :)
<FromGitter>
<alex-lairan> Hi @sdogruyol ! :)
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
<FromGitter>
<sdogruyol> how are you all doing :)
soveran has quit [Remote host closed the connection]
<FromGitter>
<alex-lairan> Fine and you? :)
<FromGitter>
<sdogruyol> great!
<FromGitter>
<alex-lairan> I have a little question :) how I can append a text to a file? I've done this https://github.com/Cruder/Opali/pull/6/files but it's destroy each time my file :/
<FromGitter>
<sdogruyol> ditching up Atom editor and switching back to Sublime Text <3
<FromGitter>
<sdogruyol> oh
<FromGitter>
<alex-lairan> Atom is realy cool with good addons
<FromGitter>
<sdogruyol> well it was cool not anymore
<FromGitter>
<sdogruyol> it's consuming shit loads of resources without any purpose..
<BlaXpirit>
it's OK as is but it does some unnecessary conversions due to the C layer, and that thing about not keeping references
<blassin>
so not sure what I'm doing here, but just wanted to load images once
<BlaXpirit>
blassin, it's probably about the place where you're using get_texture
snsei_ has joined #crystal-lang
<blassin>
yeah, Crystal's errors are really useless :D
<blassin>
but I gather as much
<blassin>
actually, if I comment the line inserting the image on the hash, it works
<blassin>
but OK, I'll just work around this
<BlaXpirit>
blassin, you must save references to textures. probably like you're doing with images
<BlaXpirit>
and actually don't need to save images if i were to guess
<blassin>
how do I save the references, then?
<BlaXpirit>
> like you're doing with images
<blassin>
I get the error if I do it
<blassin>
:/
<BlaXpirit>
well I can't guess without a full reproducing example
<blassin>
same error for images and textures
<blassin>
ok, lemme try something then
snsei has quit [Ping timeout: 252 seconds]
<blassin>
BlaXpirit: ok, so a standalone example works...
<blassin>
must be something else in my code
<blassin>
(I've updated the gist)
snsei_ has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<BlaXpirit>
blassin, well i'm saying, it's all about the place where you're using get_texture
pawnbox_ has quit [Remote host closed the connection]
<BlaXpirit>
if you apply the texture to something and forget about the texture, the texture is deleted and causes an error when something tries to use that
<blassin>
I have a draw loop that right now (inefficiently, trying stuff out) loads the texture from the tilemanager, and inspects it
<blassin>
on the next iteration of the draw loop, the reference is still on the TileManager class' cache, right?
<BlaXpirit>
blassin, appears correct
soveran has quit [Remote host closed the connection]
<BlaXpirit>
blassin, is the problem perhaps with .key?
<blassin>
the only difference between the test gist and the whole code is that I have a window in the whole thing
<BlaXpirit>
hm no
<blassin>
and call window.clear on the draw loop
<blassin>
would that cause it?
<BlaXpirit>
blassin, just give me any code that crashes
<blassin>
I've updated the gist - the 2nd file on it is the class that is calling TileManager now
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
snsei_ has joined #crystal-lang
<blassin>
I'll try to replicate the whole thing with a window, too
<BlaXpirit>
well i just wasted 5 minutes trying to make something of this code but it just does nothing
snsei has quit [Ping timeout: 276 seconds]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
<blassin>
BlaXpirit: sorry, will update it :|
<blassin>
BlaXpirit: gist updated, now fails like my main project
<blassin>
do you want the tile image I'm using too?
<blassin>
I just didn't want to clutter the initializer with a bunch of code
<BlaXpirit>
silly
<BlaXpirit>
blassin, please look at your init_artist
<BlaXpirit>
you must not use uninitialized
<blassin>
at all?
elomatreb has left #crystal-lang ["Leaving"]
<blassin>
I only access the variables after the init_ methods
<blassin>
doesn't that make a difference?
<blassin>
init_artist will contain more stuff (eventually)
<BlaXpirit>
blassin, yes but right now init_artist does nothing
<blassin>
ok, I just moved everything into the initializer and now it works :|
blassin has quit [Quit: Page closed]
blassin has joined #crystal-lang
<blassin>
sorry, got dropped :|
<blassin>
as I said, I don't get it if I only use the vars after initing them
<BlaXpirit>
blassin, look at your gist, @artist remains uninitialized
<blassin>
ahh, right
<BlaXpirit>
just shows that you definitely shouldn't do what you wanted there
<blassin>
updated the gist
<blassin>
I prefer this style of coding over having initializers with 20+ lines
<blassin>
but I guess that's a matter of taste ;)
<blassin>
thanks for all the help!
<BlaXpirit>
blassin, you can base initializers on pure functions, so to say
<blassin>
how so?
<BlaXpirit>
@artist = make_artist instead of @artist = unitialized; init_artist
<blassin>
yeah, that works too
<blassin>
but now I get "Can't infer the type of instance variable @artist..."
<blassin>
do I need to annotate make_artist?
snsei_ has quit [Remote host closed the connection]
<BlaXpirit>
blassin, need to annotate @artist
snsei has joined #crystal-lang
<BlaXpirit>
@artist : Artist = make_artist or do the annotation at the top of the class
<blassin>
hmmm it seems more logical to annotate the return of the method
<blassin>
but ok
<BlaXpirit>
blassin, seems more logical to me as well, unfortunately it will not help and it is not planned to change
<blassin>
really? that's really unfortunate
snsei_ has joined #crystal-lang
snsei_ has quit [Remote host closed the connection]
<blassin>
BlaXpirit: do you know in which issue this is discussed?
<BlaXpirit>
mostly IRC :|
snsei_ has joined #crystal-lang
<blassin>
I think I'll open an issue, then
kulelu88 has joined #crystal-lang
snsei has quit [Ping timeout: 276 seconds]
<BlaXpirit>
blassin, you would have to provide really strong arguments
kulelu88 has quit [Max SendQ exceeded]
<BlaXpirit>
the argument against it is inconsistency - one thing works without annotation and another thing doesn't work without annotation and it seems like there is no difference between them but the difference is in the annotation of some function hidden in some library
<blassin>
this gist has the annotation, but it doesn't work either
<blassin>
Can't infer the type of instance variable '@a' of A
<blassin>
Can't infer the type of instance variable '@var' of A
<BlaXpirit>
blassin, the code example you sent works just fine
<blassin>
oops, wrong folder on the terminal :D
<blassin>
so yeah, I guess opening the issue won't achieve much
<blassin>
my argument for it would be to have something already present in the language for other things (method annotations) to serve for this as well
<blassin>
lowers cognitive load
<blassin>
one less weird thing to learn about Crystal