Dart Bindings: Breaking Changes.

19 views
Skip to first unread message

Zach Anderson

unread,
May 12, 2016, 6:43:13 PM5/12/16
to mojo...@chromium.org
Hello Mojoers,

If you don't use the Dart bindings you can stop reading now.

tl;dr: When using generated proxies: '.ptr.' -> '.', 'impl' -> 'ctrl', 'ProxyBase' -> 'Proxy', more name collisions avoided.

Following the discussion here [1], after the CL here [2] lands and a new mojo package is published to pub, users of the Dart bindings will need to update their application code. In particular:

1. The 'ptr' indirection on Proxy objects is no longer needed to reach the interface calls, so:

fooProxy.ptr.bar()

becomes simply

fooProxy.bar()

Rationale: 'ptr' was annoying to write, unidiomatic, and the name didn't make sense.

2. Functions manipulating the Proxy itself have been moved from a field named 'impl' to one named 'ctrl', so for example:

fooProxy.impl.isBound

becomes

fooProxy.ctrl.isBound

Rationale: The 'impl' name didn't make much sense. It was a field of type ProxyImpl, which wasn't really the implementation of the Proxy but rather more like the controller of the proxy. Therefore it has been renamed ProxyControl, and the field in the proxy has been renamed 'ctrl'.

3. The class hierarchy for generated Proxy classes is now simpler, so there is no more ProxyBase class. Instead, a class Proxy is now the base class extended by the generated Proxy classes. You should be able to safely replace uses of 'ProxyBase' in your code with 'Proxy'.

Rationale: Less generated code. Simpler class hierarchy.

4. More name collisions avoided: Names in mojom interfaces that we use internally are mangled by adding a trailing underscore. The full list will be in:

//mojo/public/tools/bindings/generators/mojom_dart_generator.py

For example, if you have a mojo interface containing a call Close(), the name in the Dart interface will be close_().

Rationale: Name collisions are annoying. Hopefully, the most commonly used names will continue to be unmangled.

I plan to land this change and push a new package to pub by the end of this week. Please let me know here on the list or in person if you have any concerns.

Cheers,
Zach


Reply all
Reply to author
Forward
0 new messages