Kaba class Any ed

Can store an arbitrary value.

Syntax ed

class Any
    var data: void*

    # constructors
    func mut __init__()

    # functions
    func mut add(a: Any)
    func selfref as_dict() -> Any{}*
    func selfref as_list() -> Any[]*
    func mut clear()
    func mut drop(key: string)
    func pure has(key: string) -> bool
    func pure is_empty() -> bool
    func pure keys() -> string[]
    func type() -> Class&
    func unwrap(var: void&, type: Class&)
    func static parse(s: string) -> Any

    # operators
    func mut __assign__(a: Any)          # Any = Any
    func pure __length__() -> i32        # len(Any) -> i32
    func selfref __get__(key: string) -> Any* # Any[string] -> Any*
    func mut __set__(key: string, value: Any) # Any[string] = string
    func selfref __get__(index: i32) -> Any* # Any[i32] -> Any*
    func mut __set__(index: i32, value: Any) # Any[i32] = i32
    func pure __bool__() -> bool         # bool(Any) -> bool
    func pure __i32__() -> i32           # i32(Any) -> i32
    func pure __i64__() -> i32           # i64(Any) -> i32
    func pure __f32__() -> f32           # f32(Any) -> f32
    func pure __f64__() -> f64           # f64(Any) -> f64
    func pure __str__() -> string        # str(Any) -> string
    func pure __repr__() -> string       # repr(Any) -> string
    func mut __iadd__(b: Any)            # Any += Any
    func mut __isub__(b: Any)            # Any -= Any

Functions ed

func mut add(a: Any)
...

func selfref as_dict() -> Any{}*
...

func selfref as_list() -> Any[]*
...

func mut clear()
Clear or drop the stored value.

func mut drop(key: string)
Drop an entry from a map.

func pure has(key: string) -> bool
Checks, if a map contains an entry.

func pure is_empty() -> bool
...

func pure keys() -> string[]
...

func type() -> Class&
...

func unwrap(var: void&, type: Class&)
...

func static parse(s: string) -> Any
...

Elements ed

var data: void*
...