Skip to content

Support protocols and typed arrays #31

Closed
@iccir

Description

@iccir

Add support for protocols (id<ProtocolName>) for method parameters, ivars, @properties, etc. This will be for documentation purposes at first. With the addition of union types in TypeScript, we could also possibly add this to the typechecker.

Additionally, the same parsing code can handle typed arrays: Array<String> for an Array of String objects.

I'm hesitant to add generics or expose TypeScript's generic types/functions, but I think making a one-time exception for Array is worth it. Since there is no way for an oj class to subclass the native Array type, the angle bracket syntax on Array will never indicate a protocol. This will need to be evaluated for Set in ECMAScript 6. Also, if type annotations make it into ECMAScript 7, we might need to support that syntax in addition for typed arrays.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions