Dynamic vs. static sorted out (breaking change)

105 views
Skip to first unread message

Gustavo Niemeyer

unread,
Oct 2, 2013, 10:42:27 AM10/2/13
to go-...@googlegroups.com
The repository just got an incompatible update that sorts out the
dynamic vs. static situation in a way that gives us both power and
flexibility in a convenient API. This should help us evolving cleanly
once we decide to freeze the API, while allowing follow up extensions
that go beyond the functionality available to pure QML.

In practice, qml.Object is now an interface that is implemented by all
QML objects, and there's a concrete qml.Common type that implements
that interface and is used both by itself and as an anonymous member
of every QML object that is represented by a richer Go type.

As an example, qml.Window now also implements qml.Object, so besides
the static functionality available via its methods, it also exposes
the same dynamic behavior of every other QML object. This works, for
instance:

fmt.Println(window.Int("status"))

The API has changed relatively little, considering the impact
described, but will likely break existing code. Most visibly, any code
using *qml.Object should now use qml.Object, as it's an interface.

Please have a look at the API documentation to have a better idea of
how things are laid out:

http://godoc.org/github.com/niemeyer/qml


gustavo @ http://niemeyer.net
Reply all
Reply to author
Forward
0 new messages