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

Is and Isnt Syntax #90

Open
DavePearce opened this issue Mar 15, 2021 · 0 comments
Open

Is and Isnt Syntax #90

DavePearce opened this issue Mar 15, 2021 · 0 comments

Comments

@DavePearce
Copy link
Member

Consider the following:

type List is null | { int data, List next }

function len(List l) -> (int r):
    //
    int x = 0
    // iterate to the end
    while !(l is null):
        l = l.next
        x = x + 1
    //
    return x

This clarifies a pretty common pattern, where we don't want to explicitly name each bound of a union. Using !(l is null) is ugly and could be replaced with l isnt null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant