Sitelet https://github.com/xp-framework/rfc/issues/337
Skip to content

iterable<T> / iterable<K, V> #337

Description

@thekid

Scope of Change

Two new generic types will be added to the XP type system: iterable<T> and iterable<K, V>, complementing the Type::$ITERABLE type union while making it more specific.

Rationale

A function returning iterable does not tell the user what to expect as values for the iteration.

Functionality

The simple one-component type iterable<T> will be mapped to lang.IterableType(key: null, value: T), while the two-component version iterable<K, V> will be represented to lang.IterableType(key: K, value: V) where T, K and V are lang.Type instances.

Security considerations

None

Speed impact

Slight impact of Type::forName() to check for the string "iterable".

Dependencies

XP Compiler support

Related documents

https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-iterable/

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions