Skip to content

Add an AS Equivalent to Option in Rust to the AS Standard Library #1410

Closed

Description

@torch2424

One thing about AS is that basic types cannot be nullable. However, I've been designing some APIs that need some nullable Basic types, and I've been working around them. But I think it'd be cool just to write up a quick equivalent to C#'s Nullable or Rust's Option.

I could super easily add this myself. I personally like C#'s interface more, but I think it should be named Optional. That way, it doesn't conflict with our already exisiting idea of nullability in the docs.

What do y'all think @dcodeIO @MaxGraey @jtenner @sirwillem ? 😄

Activity

  1. self-assigned this
    on Jul 24, 2020
  2. jtenner commented on Jul 24, 2020

    @jtenner
    Contributor

    I believe that this feature requires multi-value returns, if I am not mistaken.

  3. MaxGraey commented on Jul 24, 2020

    @MaxGraey
    Member

    One thing about AS is that basic types cannot be nullable

    It's just temporary limitation. And as @jtenner mentioned it's depending on multi-value proposal

  4. willemneal commented on Jul 24, 2020

    @willemneal
    Contributor

    Here was what I made a year ago when I was working with WASI and wanted to get the result and the error:
    https://github.com/WebAssemblyOS/wasmos/blob/a454ec8bd5b39253557745747c5d9120e18b9049/packages/assemblyscript/assembly/wasa/index.ts

    As @jtenner points out multi-value means that we don't have to deal with an allocation each time, but that might be okay for now.

  5. torch2424 commented on Jul 25, 2020

    @torch2424
    ContributorAuthor

    Ahhhh that makes sense. I'll wait for that than, thanks everyone! 😄 👍

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions