Distinguish between pure and impure functions

168
Distinguish between pure and impure functions
  1. For every (possibly erased and/or context) function class


    XFunctionN, generate an alias ImpureXFunctionN in the Scala package defined as

    type ImpureXFunctionN[...] = {*} XFunctionN[...]
    
  2. Introduce -> and ?-> function operators, treated by default like => and ?=>.

  3. Under -Ycc treat -> and ?-> as immutable function types, whereas A => B


    is an alias of {*} A -> B and A ?=> B is an alias of {*} A ?-> B. For instance,


    A -> B maps to Function1[A, B] whereas A => B now maps to ImpureFunction1[A, B].

Closures are unaffected, we still use => for all closures whether they are pure or not.

Also: improve printing of capturing types, so that we use native capturing syntax instead of


explicit @retains under -Ycc even before phase cc.

Join the pack! Join 8000+ others registered users, and get chat, make groups, post updates and make friends around the world!
www.knowasiak.com/register/

Charlie Layers
WRITTEN BY

Charlie Layers

Fill your life with experiences so you always have a great story to tell