<FromGitter>
<cptaffe> Is there a way to say a type is a union of all possible Foo(T) instead of just pasting the giant union from the compiler error?
snsei has quit [Ping timeout: 264 seconds]
<FromGitter>
<cptaffe> Well, that's incorrect. I have a function that returns a number of Foo(T) from a hash, and the compiler has figured out the union of which ones. I guess there's no way to omit the type for things like JSON.mapping
<Groogy>
Alright Papierkorb I have the crash in Valgrind now, what specifically you want me to look after?
<Groogy>
the Invalid read size before the crash is about where the crash happens so? it's that?
<Groogy>
oh wait yeah this is no new info :/
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DTZUZU has joined #crystal-lang
jnyw has joined #crystal-lang
snsei has joined #crystal-lang
illyohs has quit [Ping timeout: 268 seconds]
qard has joined #crystal-lang
<Papierkorb>
Groogy: It tells you that the issue happened right in or at #absolute_position, which isn't part of the crashing stack. Maybe that's useful, or maybe it's not.
<Papierkorb>
In either case, I guess the Widget reference is broken.
<Papierkorb>
Groogy: from outside or inside Widget, in a call path leading to the crash, `puts widget.object_id.to_s(16)`
<Papierkorb>
Is that null? A reasonable pointer? Or an "probably illegal" pointer?
<Papierkorb>
If it's a "reasonable" pointer, you can output the object_id e.g. from within the constructor of Widget, and then later compare. If one of them matches, it's good. If not, then you know the GC isn't deleting the Widget under you.
<Papierkorb>
you shouldn't hit that one as you don't store the reference inside a C lib
<Papierkorb>
You can still verify it by adding a #finalize which prints its object_id, but probably not necessary for this
LastWhisper____ has joined #crystal-lang
qard has quit [Quit: qard]
qard has joined #crystal-lang
qard has quit [Client Quit]
vivus has quit [Quit: Leaving]
greengriminal has quit [Quit: This computer has gone to sleep]
sz0_ has joined #crystal-lang
sz0_ is now known as sz0
greengriminal has joined #crystal-lang
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 265 seconds]
greengriminal has quit [Ping timeout: 256 seconds]
greengriminal has joined #crystal-lang
hightower4 has quit [Ping timeout: 255 seconds]
snsei has joined #crystal-lang
qard has joined #crystal-lang
qard has quit [Client Quit]
cremes has joined #crystal-lang
<FromGitter>
<Dillybob1992> is there a shard like npm's supervisor? where it'll reload crystal if any files r changed (saves CTRL+S, while developing)
<FromGitter>
<Dillybob1992> ohhh starred , that is cool
greengriminal has quit [Quit: Leaving]
<FromGitter>
<faustinoaq> Hi RX14, WDYT about a REPL for crystal using something like Ruby-Marshal (https://github.com/derekddecker/crystal-ruby-marshal)? So we could dump objects in temp files and then loading objects eventually from those files. Still has some limitations, but maybe could work. Perhaps we can dump objects to memory using a master process. ⏎ Are my thoughts imposible for a compiled language like crystal? 😅
sz0 has quit [Quit: Connection closed for inactivity]
snsei has quit [Remote host closed the connection]
Groogy has quit [Read error: Connection reset by peer]
snsei has joined #crystal-lang
sz0 has joined #crystal-lang
hightower4 has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<RX14>
@faustinoaq the difficult things will be enumerating all objects and dealing with system resources like file descriptors. Seems like a pain to me.
Groogy has joined #crystal-lang
snsei has quit [Ping timeout: 276 seconds]
<Groogy>
Morning! o/
<FromGitter>
<Dillybob1992> Morning o/
jnyw has quit [Quit: WeeChat 2.0.1]
A124 has joined #crystal-lang
<FromGitter>
<Dillybob1992> Wow, GOT IT! So it was the bit field.
<Groogy>
what was the macro to create a var_name? method?
<RX14>
getter?
<Groogy>
no so it ends with a question mark
<Groogy>
remember it was a seperate macro
<RX14>
yes
<RX14>
getter?
<RX14>
thats not a question
<Groogy>
aaah
<RX14>
lol
<Groogy>
dang it xD
<RX14>
`getter? var_name`
snsei has joined #crystal-lang
<Groogy>
yeah
<Groogy>
also would be nice if I could do that all my setters also call "state_change.emit" :/ Right now I have to define those setters myself
<RX14>
then there's getter! which defines var_name which raises on nil and var_name? which doesn't
<RX14>
Groogy, create a custom setter macro?
<Groogy>
yeah probably chould
<Groogy>
are macros visibility inherited? I.e so if I define that helper macro in Widget, will Label be able to use it?
<RX14>
uhh, i think so?
<RX14>
try it
snsei has quit [Ping timeout: 256 seconds]
alex`` has joined #crystal-lang
<Groogy>
doesn't seem like it
<RX14>
It works for included modules...
<RX14>
I'm sure
snsei has joined #crystal-lang
<Groogy>
yeah I know it does, hmm :/
<Groogy>
maybe its order of read or something
<Groogy>
widget is read last since it starts on W
<Groogy>
yeah it is
<Groogy>
if I rename widget.cr to 0_widget.cr
<Groogy>
it works
snsei has quit [Ping timeout: 276 seconds]
<RX14>
Groogy, just `require "./file_with_macros"; require "./*"` or whatever
<Groogy>
yeah moved it out to a helper.cr that defines specifically that in Widget and then kept the rest in widget.cr
<Groogy>
Well because the variable has the type, not the literal? I mean you could just as well have var : Type = obj.some_method
<Groogy>
then it would have been var = obj.some_method : Type
<Groogy>
which meakes little sense in the syntax
<Groogy>
you get an ambiguity of are you defining the return type of the method? the variable? both?
<FromGitter>
<faustinoaq> @j8r Maybe because that way you can use chain methods for value nicely: `var : Type = value.map(&.to_s).select(..).first`, just like Groogy said ⏎ ⏎ > the difficult things will be enumerating all objects and dealing with system resources like file descriptors. Seems like a pain to me. ⏎ ⏎ Ok, Thank for your comment! so, Is a JIT compiler a theoretical solution for a REPL?
<Groogy>
multi-line auto-wrapped textboxes done* to be exact
<FromGitter>
<j8r> nice 👍
<Groogy>
though when I did the line spacing stuff some stuff have gotten a bit off I'll have to figure out how to fix :/
<FromGitter>
<j8r> what technologies do you use?
<Groogy>
You mean like OpenGL?
<FromGitter>
<j8r> Yep, which libraries/frameworks? none?
<Groogy>
OpenGL, GLFW, Freeimage, FreeType
<Groogy>
GLFW -> open a OpenGL context -> freeimage parse image data -> freetype to parse truetype fonts
<Groogy>
besides that everything is Crystal
<Groogy>
there's some more libraries than that but those are the ones which are not
<FromGitter>
<j8r> Why not to have chosen Vulkan vs. OpenGL?
<FromGitter>
<j8r> I guess you have generated bindings so
<Groogy>
Because Vulkan and OpenGL have two different purposes
<Groogy>
haven't we had this discussion once before already?
<FromGitter>
<j8r> not with me, Vulakn is lower level
<Groogy>
Yes, it doesn't do a lot of things for you, like for instance managing the command queue which you now have to write manuallay yourself
<FromGitter>
<j8r> nVidia and others are building OpenGL like, higher level frameworks based on Vulkan. But not mature yet, OpenGL have lots of libraries I see 😲
<Groogy>
eh most probably what its going to be is that the gfx manufactures will remap opengl calls to go through the drivers vulkan api instead
<Groogy>
but OpenGL won't die within the next 10 years or so
<Groogy>
OpenGL 4.0 was supposed to be what Vulkan is, that was.... 8 years ago soon so. These things do not move fast
<Groogy>
took a long time before glNext actually became Vulkan
<FromGitter>
<j8r> They say OpenGL 4.5 is the last before Vulkan, but there is 4.6.
<FromGitter>
<j8r> For DirectX, have you an experience with it?
<Groogy>
yeah, not DirectX 12 though
<Groogy>
There's only Wolfenstein II that is a AAA product supporting Vulkan... it would be weird if OpenGL didn't keep getting new features
<Groogy>
especially since its the same people between Vulkan and OpenGL
<FromGitter>
<j8r> I've searched some vs. before on the web, DirectX vs OpenGL, but that's hard to have a good doc explaining their pros and cons with no biased opinons.
<Groogy>
DirectX is based on the antiquated COM framework
<Groogy>
OpenGL is a horrible C state-machine interface
<Groogy>
both are bad
<Groogy>
but they are both better than writing to the driver directly yourself :P
<FromGitter>
<j8r> On the web side, WebGL is a superset of OpenGL ES? They are announcing the 2nd version
<Groogy>
DirectX has better investment in it, better integration to tools etc. But like if you want stuff to work on several platforms I recommend OpenGL
<Groogy>
except if you want to support Xbox because it only supports DirectX
<Groogy>
WebGL or OpenGL ES?
<FromGitter>
<j8r> By the way nowadays there are nice frameworks like Godot that simplify our lives :)
<FromGitter>
<bararchy> is `digits` really being used by someone ?
cremes has joined #crystal-lang
snsei has joined #crystal-lang
cremes has quit [Quit: cremes]
snsei has quit [Ping timeout: 276 seconds]
cremes has joined #crystal-lang
cremes has quit [Client Quit]
<FromGitter>
<drujensen> hey, so I’m hitting something weird. I’m initializing an `Array(Array(Bool))` to false. When I try setting one of the values to true, it sets the whole row to true.
<FromGitter>
<drujensen> I think I’m initializing all of the rows to point to the same instance
<FromGitter>
<drujensen> Is there a better way to initialize the arrays to false?
<crystal-gh>
[crystal] S-YOU opened pull request #5616: Use slice instead of StaticArray for String::CHAR_TO_DIGIT (master...chore_char_to_digit) https://git.io/vNgmr
<FromGitter>
<drujensen> yeah, way nicer but its looks like it is still setting the whole row to true
<FromGitter>
<imonmyown> oops
<FromGitter>
<drujensen> looks like I will need to loop and create new instances for each
<FromGitter>
<drujensen> let me see if that fixes it
<FromGitter>
<f-mer> Hi! It's setting the same instance for each row ;)
<FromGitter>
<drujensen> yeah, ok. I think I know how to fix it. Thx! @imonmyown thanks for the cleaner code as well. 👍
<FromGitter>
<imonmyown> @drujensen np, cool that you found it useful :)
<FromGitter>
<f-mer> Someone knows how i can close an IO that is blocking on read? So basically I have a streaming http response an proxying it down to another reponse. When the downstream closes I would like to close the blocking read to the upstream.
<RX14>
just close the io
<RX14>
and the read will return
<RX14>
i'm assuming if you're proxying you have 2 fibers
<RX14>
for each direction
<RX14>
actually, closing the IO actually isn't what you want until both sides are EOF, hmm
<FromGitter>
<f-mer> I have one for streaming the data from the upstream to the downstream, and another for sending perodical messages to the downstream to get an Errno when the requesting client went away. The later is running inside the fiber of the HTTP::Server response I guess, so the connection is kept open.
<FromGitter>
<f-mer> The thing is the upstream just streams events endlessly.
<FromGitter>
<f-mer> It may never close.
<RX14>
but when the client goes away you'll get an errno when you try to write again?
<RX14>
on either fiber
<RX14>
so I don't see the problem
<FromGitter>
<f-mer> The thing is i placed a puts statement after the blocking io an it seems to never get executed and the server seems to hang after some requests.
<RX14>
can you show me code please?
<RX14>
I don't think I quite understand the problem
<RX14>
because the fiber isn't blocked by writing to `io`
<RX14>
it's blocked reading from `res`
<RX14>
no, the other way around
<RX14>
yay
<FromGitter>
<f-mer> @Groogy Wow this looks cool :)
<FromGitter>
<f-mer> Yep its blocked by reading from `lock_res`
<FromGitter>
<f-mer> *`log_res`
<RX14>
yep
<FromGitter>
<f-mer> And therefore only close if the upstream would send something?
<RX14>
well
<RX14>
if there is a message, then it'll close out then
<RX14>
but it should close out eventually
<RX14>
unless there's never a message on /logs again
<RX14>
if you want to close it right away though, yes you need to close `r`
<FromGitter>
<f-mer> And then line 11 is executed after something is received from /logs otherwise it hangs infinietly?
<RX14>
line 11 would be executed after 5 seconds of the client going away
<RX14>
either way
<RX14>
I would think
<FromGitter>
<f-mer> Thats sadly not the case
<RX14>
so what do you observe?
<RX14>
what errors come when
<RX14>
because when there's a heartbeat, and the client goes away, there must be an exeption
<FromGitter>
<f-mer> Yep the ensure block is executed, but i expect the read in the fiber should unblock immediately and the puts be executed or an error thrown but there is nothing.
<FromGitter>
<marksiemers> Should it be considered a bug if `Indexable#last` throws an error on an empty collection: `Index out of bounds (IndexError)`