jhass / crystal-gobject

gobject-introspection for Crystal
BSD 3-Clause "New" or "Revised" License
127 stars 13 forks source link

Avoid renaming to `new_internal` #4

Closed vaartis closed 8 years ago

vaartis commented 8 years ago
button=Gtk::Entry.new
Error in ./efinder.cr:8: wrong number of arguments for 'Gtk::Entry#initialize' (given 0, expected 1)
Overloads are:
 - Gtk::Entry#initialize(gtk_entry)

entry=Gtk::Entry.new()

But where can i find gtk_entry?

jhass commented 8 years ago

The above commit should make your code work.

I renamed new to new_internal in order to avoid clashes with the actually internal constructor of the wrapper taking the underlying struct. The above avoids doing that when there are no arguments, so the two constructors overload. With the next Crystal version instance variables will need mandatory type annotations, so the wrapper might need some redesign, in any case overloading the constructor should then become possible in any case and I'll tackle this issue in full then.

vaartis commented 8 years ago

Yep, works fine now