Skip to content

Instantly share code, notes, and snippets.

@trans
Last active August 29, 2015 14:05
Show Gist options
  • Save trans/08883c340ed53de116f4 to your computer and use it in GitHub Desktop.
Save trans/08883c340ed53de116f4 to your computer and use it in GitHub Desktop.
Another Look at Julia's Import/Module Syatem
# Notes: Notice there is no `module Gtk` at the top. b/c not the file _is_ the module.
#
# The term `use` was chosen just to differentiate from the others. It would
# probably be called `import` in the end.
#
# The complex imports for GLib are gone. Why does there need to be a separate
# and specific import just b/c a function is going to be extended. The same is
# true for Base.
#
# The arguments are just file names and could also be written, e.g. `("GLib/Glib")`.
# Which means it is also possible to use a dynamic arguments, as in `deps` below.
# Also, it assumes a `.jl` extension unless otherwise given.
use GLib/GLib
use GLib/MutableTypes
use Cairo
use Base/Graphics: width, height, getgc
use basic_exports
use long_exports
use long_leaf_exports
use joinpath("..","deps","ext.jl")
use interfaces
use boxes
use gtktypes
use gdk
use events
use container
use windows
use layout
use displays
use lists
use buttons
use input
use text
use menus
use selectors
use misc
use cairo
use builder
use toolbar
use theme
use gio
use application
if VERSION < v"0.3-"
QuoteNode(x) = Base.qn(x)
end
const suffix = :Leaf
typealias Index Union(Integer,AbstractVector{TypeVar(:I,Integer)})
module Gtk
const suffix = :Leaf
include("GLib/GLib.jl")
using .GLib
using .GLib.MutableTypes
using Cairo
import .GLib: setproperty!, getproperty, StringLike, bytestring
import .GLib:
signal_connect, signal_handler_disconnect,
signal_handler_block, signal_handler_unblock,
signal_emit
if VERSION < v"0.3-"
QuoteNode(x) = Base.qn(x)
end
import Base: convert, show, showall, run, size, resize!, length, getindex, setindex!,
insert!, push!, append!, unshift!, shift!, pop!, splice!, delete!,
start, next, done, parent, isempty, empty!, first, last, in,
eltype, copy, isvalid, string, sigatomic_begin, sigatomic_end
import Base.Graphics: width, height, getgc
import Cairo: destroy
typealias Index Union(Integer,AbstractVector{TypeVar(:I,Integer)})
include("basic_exports.jl")
include("long_exports.jl")
include("long_leaf_exports.jl")
include(joinpath("..","deps","ext.jl"))
include("interfaces.jl")
include("boxes.jl")
include("gtktypes.jl")
include("gdk.jl")
include("events.jl")
include("container.jl")
include("windows.jl")
include("layout.jl")
include("displays.jl")
include("lists.jl")
include("buttons.jl")
include("input.jl")
include("text.jl")
include("menus.jl")
include("selectors.jl")
include("misc.jl")
include("cairo.jl")
include("builder.jl")
include("toolbar.jl")
include("theme.jl")
include("gio.jl")
include("application.jl")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment