shama has quit [Remote host closed the connection]
shama has joined #crystal-lang
knoopx has joined #crystal-lang
knoopx has quit [Remote host closed the connection]
knoopx has joined #crystal-lang
bcardiff has quit [Quit: Leaving.]
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
waj has quit [Quit: Leaving.]
knoopx has quit [Remote host closed the connection]
ismaelga has quit [Remote host closed the connection]
weskinner_mac has joined #crystal-lang
weskinner_mac has quit [Quit: weskinner_mac]
canhtak has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
canhtak has quit [Quit: canhtak]
leafybasil has joined #crystal-lang
waj has joined #crystal-lang
<crystal-gh>
[crystal] asterite pushed 2 new commits to master: http://git.io/AqI6
<crystal-gh>
crystal/master 6a26913 Ary Borenszweig: Added a DayOfWeek enum, and made Time#day_of_week return that type. Also added Time#monday? and other methods for convenience.
<crystal-gh>
crystal/master a5c22f9 Ary Borenszweig: Allow getting a type's constants in macros
<travis-ci>
manastech/crystal#2022 (master - a5c22f9 : Ary Borenszweig): The build was fixed.
<jhass>
why not call the compiler with a different prelude?
<jhass>
anyway, maybe load does currently, but I'd remove that ability from require/load and move it to its own directive to make the distinction clear, for both sides
<asterite>
Well, I think in that case you have to do the check
<asterite>
if callback.closure? …
<jhass>
yeah, well, do what then?
<jhass>
it works if I declare c_handler as Void* btw
<jhass>
(well, sort of, something segfaults then, but I had it working like that)
<jhass>
yeah, segfault seems unrelated
<asterite>
raise "can't send closure to C" if callback.closure?
<asterite>
Oh, I see what you mean
<jhass>
but I can!
<asterite>
You can try doing Callback.new(callback.pointer, Pointer(Void).null)
<asterite>
and passing that
<asterite>
maybe?
<jhass>
ah, looks interesting, let me try
<jhass>
yup, looks like that works, thanks!
<asterite>
\o/
<jhass>
now on to see how I introduced a segfault in Gtk::Window@Gtk::Container#add<Gtk::Window, Gtk::Widget>:Void (in /home/jhass/projects/crystal-gobject/gtk_hello_world) ;D
leafybasil has quit [Remote host closed the connection]
bcardiff has quit [Quit: Leaving.]
<jhass>
mmh, is there a way to see the code a macro generates?
leafybasil has joined #crystal-lang
<jhass>
asterite: can't cast (Pointer(LibGtk::Builder) | Pointer(LibGObject::Object)) to Pointer(LibGtk::Builder) you should add a trace for where either comes from to that
<jhass>
if possible
<jhass>
mmh, I think I broke type interference there
<asterite>
:o
<asterite>
You can see what a macro generates
<asterite>
Just put `1 + ` before the end of it ;)
<jhass>
heh :P
<jhass>
I just called to_unsafe.foo to get a trace for the last one :P
<jhass>
but I only get one for Pointer(LibGtk::Builder) :/
<jhass>
can't figure out where the Pointer(LibGObject::Object) comes from :/
<asterite>
Well, then that's something we definitely need to improve
<asterite>
Can you add an issue so I don't forget?
<asterite>
You can try restricting methods with types, until you find the place where you create that type
bcardiff has joined #crystal-lang
<jhass>
I'm trying
<jhass>
somehow I do inherit the other constructor that still allows it
<jhass>
or I really broke type interference
<asterite>
If you are inheriting, the instance variables types are shared across the hierarchy
<asterite>
Well, they are shared between ancestors, not between siblings (unless the parent has that same instance var)
<jhass>
ah, that might be it :/
<jhass>
will a generic module help?
<asterite>
I don't know without knowing that the code looks like
<jhass>
I'll try
<asterite>
but I guess you have some base GObject and a Builder < GObject ?
<jhass>
not quite, I'm trying to extract the common stuff like constructor & to_unsafe into a module. Currently I include the module if the type has no parent
<jhass>
so Gtk::Builder inherits GObject::Object which includes WrappedType which defines the constructor and to_unsafe
<jhass>
but defining those via the included & inherited macro's makes no difference
<jhass>
I guess I need to completely generate those for each class independently and randomize the instance variable name :/
<jhass>
asterite: what exactly is @type in the included macro? can I call identify on it?
<jhass>
ah, .name.identify.id works
<asterite>
@type is a TypeNode, it's a fake ast node that has a linked type
<asterite>
You can ask the name, instance vars, constants… for now
<asterite>
Ah, subclasses too
<jhass>
kay, I progressed from compile time to run time error :P
<jhass>
managed to generate "Expected GObject::Object but got GObject::Object" ...
<asterite>
:o
<jhass>
it's what you get for nesting macro inherited into macro included :P
<jhass>
and forget to escape the {{@type}}
<asterite>
lol
<asterite>
I think… you are abusing macros
<asterite>
Maybe we should remove them from the language :D
<asterite>
It works for java just fine
<jhass>
heh, at least I generate you some few klocs of code that actually puts the compiler to a bit stress :P
<jhass>
Java has reflection
<asterite>
True. But how can you avoid the `int getFoo() { return foo; }` ?
<asterite>
Um, `public int getFoo() { return foo; }`
<jhass>
dunno and don't care much
<jhass>
not using java has its reasons :P
asterite has quit [Quit: Leaving.]
waj has quit [Quit: Leaving.]
waj has joined #crystal-lang
<weskinner_>
trying to run an http server in evented mode but seem to have the wrong libgc installed:
<weskinner_>
main_module:(.text+0x597): undefined reference to `GC_get_push_other_roots'
<weskinner_>
main_module:(.text+0x601): undefined reference to `GC_set_push_other_roots'
<weskinner_>
main_module:(.text+0x606): undefined reference to `co_thread_init'
<weskinner_>
sudo apt-get install libgc-dev says I already have it installed
<weskinner_>
I guess I've got an old / different version of libpcl too
waj has quit [Quit: Leaving.]
<jhass>
Travis should run Ubuntu too iirc, check the .travis.yml in the repo