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

Syntax for polymorphic values. #54

Closed
wants to merge 3 commits into from

Commits on Jul 22, 2017

  1. Syntax for polymorphic values.

        ν[T].m[A, B[_], ...](e)
    
    is rewritten to
    
        new T { def m[A, B[_], ...] = e }
    
    (`ν` is the lowercase Greek letter "Nu" (/njuː/) and stands for `new`.)
    
    In case `m` has just one *-kinded type parameter that is
    is not referenced from `e`, it can be omitted:
    
        ν[T].m(e)
    
    is rewritten to
    
        new T { def m[A] = e }
    
    where `A` is a fresh name.
    
    If the method name is `apply`, it can be omitted:
    
        ν[T][A, B[_], ...](e)
    
    is rewritten to
    
        new T { def apply[A, B[_], ...] = e }
    
    The previous two shortcuts can be combined:
    
        ν[T](e)
    
    is rewritten to
    
        new T { def apply[A] = e }
    
    where `A` is a fresh name.
    TomasMikula committed Jul 22, 2017
    Configuration menu
    Copy the full SHA
    45cc31d View commit details
    Browse the repository at this point in the history
  2. Make ν rewrites opt-in.

    TomasMikula committed Jul 22, 2017
    Configuration menu
    Copy the full SHA
    3f0f156 View commit details
    Browse the repository at this point in the history
  3. Λ syntax for polymorphic values.

        Λ[A, B[_], ...](e) : T
    
    is rewritten to
    
        new T { def apply[A, B[_], ...] = e
    
    Note that explicit type `T` of the Λ-expression is required.
    TomasMikula committed Jul 22, 2017
    Configuration menu
    Copy the full SHA
    edbdff5 View commit details
    Browse the repository at this point in the history