Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Fix remaining deprecations #358

Open
tknopp opened this issue Aug 9, 2018 · 7 comments
Open

Fix remaining deprecations #358

tknopp opened this issue Aug 9, 2018 · 7 comments

Comments

@tknopp
Copy link
Collaborator

tknopp commented Aug 9, 2018

Gtk master now passes test on Julia 0.7 but there are remaining things:

  • the current_module deprecations cannot be replaced by @__MODULE__ since it says that Gtk is not defined

  • the remaining cfunction replacements do not work, because the depend on local scope

@vtjnash: I definitely need help on the remaining cfunction deprecations. Would be wonderful if you could have a look.

@tknopp
Copy link
Collaborator Author

tknopp commented Aug 10, 2018

I fixed the cfunction issue by using a direct call into libjulia:

cfunction_(f, r, a::Tuple) = cfunction_(f, r, Tuple{a...})
@noinline function cfunction_(f, r, a)
    @nospecialize(f, r, a)
    return ccall((:jl_function_ptr,:libjulia), Ptr{Cvoid}, (Any, Any, Any), f, r, a)
end

Is that ok for now @vtjnash? Otherwise we need a fix for @cfunction in local scope.

The module thing has been worked around by

curr_module() = ccall((:jl_get_current_module,:libjulia), Ref{Module}, ())

That certainly is not ok, since that function is not present in 1.0 anymore. @vtjnash or @JeffBezanson: I would be very thankful for a fix. I don't fully get the interaction between GLib and Gtk and this is your code @vtjnash. When this is done Gtk should be deprecation free and work on 1.0. This is important for depending packages.

@vtjnash
Copy link
Contributor

vtjnash commented Aug 10, 2018

No, this function is supposed to be deleted. That function call usages should be replaced with a macro to create the function pointer of the correct type at each use site.

@tknopp
Copy link
Collaborator Author

tknopp commented Aug 10, 2018

Then I need you help. The @cfunctiondepends on local scope:
https://github.com/JuliaGraphics/Gtk.jl/blob/master/src/GLib/signals.jl#L11
cb is local scope.

@tknopp
Copy link
Collaborator Author

tknopp commented Aug 10, 2018

The other ones are here:

cb = cfunction_(move_cb, Cint, (Ptr{GObject}, Ptr{GdkEventMotion}, T))

So its these 3 cfunctions that I was not able to replace by @cfunction

@vtjnash
Copy link
Contributor

vtjnash commented Aug 10, 2018

Yes, signal_connect should also be made a macro, so it can access the types for the cfunction method signature at compile time.

@vtjnash
Copy link
Contributor

vtjnash commented Aug 10, 2018

Those other ones can just be deleted (optionally keep the Ref version, or delete those too). It's a primitive implementation of FunctionWrappers.jl (from long before that existed), but it is not really necessary.

@tknopp
Copy link
Collaborator Author

tknopp commented Aug 10, 2018

No, this function is supposed to be deleted.

Are the deleted in Julia 1.0? Or not. If it is still there my "hotfix" is probably ok and we can redesign signal_connect in the second step?

Yes, signal_connect should also be made a macro, so it can access the types for the cfunction method signature at compile time.

I understand this, but doesn't this mean that one cannot apply closures anymore to the function? What about all those on_* functions, these in turn all need to go right? I actually don't know how to redesign the file
https://github.com/JuliaGraphics/Gtk.jl/blob/master/src/events.jl
then.

What is with the simple signal_connect that is used in do expressions:
https://github.com/JuliaGraphics/Gtk.jl/blob/master/src/GLib/signals.jl#L26
This is ok, since it does not compile a cfunction?!

So in summary, we will have @signal_connect for the compiled version and signal_connect for the runtime version, is this correct Jameson? And I don't know what we do with events.jl

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants