[Mobile-sig] Experiments with Dalvik

David Boddie david at boddie.org.uk
Sat Jul 29 15:50:22 EDT 2017


Surfing the archives, I thought I'd update this old thread.

On Fri May 20 17:42:32 EDT 2016, I wrote:

> Thanks. I hoped the syntax annotations might make people think about how
> types are declared in Python, if you need to declare them. They are a bit
> like the slot declarations in PyQt and I would like them to be optional
> in the case where it should be obvious that a method is a reimplementation
> of a method in a base class or interface.

I eventually got round to making many method annotations optional, using the
assumption that if a method has no type declarations it either

 a) accepts no arguments, or just "self", and returns None, or
 b) overloads another method in a class or interface, in which case it must
    have the appropriate number of arguments.

Obviously, if an application is mostly implementing existing interfaces, a
lot of the declarations disappear, as in this simple example:

http://www.boddie.org.uk/david/Projects/Python/DUCK/Examples/Serpentine/Bitmaps/docs/bitmaps.html

So you really only need to annotate methods when you need to tell the VM
about the types they use. If that is already defined somewhere else then the
compiler can figure it out without involving the programmer. I suppose it's
a bit like autoclass in Pyjnius but without using reflection.

David


More information about the Mobile-sig mailing list