vjovanov / papers

Papers of Vojin Jovanovic.
http://vjovanov.com
0 stars 0 forks source link

Desugaring #6

Open densh opened 9 years ago

densh commented 9 years ago

Class desugaring

class C[A](x: B) { val y = t }
--> 
[A] => (x: B) => { y = t }

Method desugaring

def f[A](x: B) = t
-->
[A] => (x: B) => t
vjovanov commented 9 years ago

Yes, I will close them both today.

densh commented 9 years ago

More detailed desugaring in tex:

\begin{figure}
  $ [[ let\ x: T_x = t_x\ in\ t ]] = \\ $
  $ ((x: T_x) \ra t)(t_x) \\ \\$
  $ [[ let\ type\ T_1 = T_2\ in\ t ]] = \\ $
  $ ([T_1 <: T_2] \ra t)[T_2] \\ \\ $
  $ [[ let\ class\ C[A](x: T_x) \{ def\ f[B](y: T_y) = t_f \}\ in\ t ]] = \\ $
  $ \ let\ type\  C = [A] \ra \{ x: T_x, f: [B] \ra T_y \ra T_f \}\ in \\ $
  $ \ let\ C: [A] \ra (x: T_x) \ra C[A] = [A] \ra (x: T_x) \ra \{ x = x, f = [B] \ra (y: T_y) \ra t_f \}\ in\ t$
\end{figure}