Skip to content

Type Annotations #39

@lfkeitel

Description

@lfkeitel

Allow functions to specify types for parameters. Types will be checked at compile time as much as possible. Types that can't be checked then will be checked at runtime. This will reduce the amount of runtime overhead as much as possible. The type checking step can be done with the AST as it specifies internal object types. Any parameter or return value not specified will default to the Any type.

The following types can be supported:

  • Primitives (ints, strings, floats, etc.)
  • Classes
  • Interfaces

Syntax

fn example(s: string, i: int): bool {}

interface SomeInterface {
  fn method(s: string): string
}

fn example2(obj: SomeInterface): void {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Language changeChanges to the language syntax or runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions