Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type Annotations #39

Open
lfkeitel opened this issue Dec 30, 2023 · 0 comments
Open

Type Annotations #39

lfkeitel opened this issue Dec 30, 2023 · 0 comments
Labels
Language change Changes to the language syntax or runtime

Comments

@lfkeitel
Copy link
Collaborator

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 {}
@lfkeitel lfkeitel added the Language change Changes to the language syntax or runtime label Dec 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Language change Changes to the language syntax or runtime
Projects
None yet
Development

No branches or pull requests

1 participant