org.erights.e.elib.prim
Class ScriptMaker

java.lang.Object
  |
  +--org.erights.e.elib.prim.ScriptMaker

public class ScriptMaker
extends Object

Untamed: From a Java class, obtain a corresponding Script enabling its tamed behavior to be invoked from ELib. XXX BUG: mutable static state. Fortunately, it's a semantics free cache, so it doesn't actually violate capability semantics. Unfortunately, it needs to be synchronized, and isn't yet.

Author:
Mark S. Miller

Field Summary
private  FlexMap myScripts
          maps java classes to scripts
private static String[][] Promotions
          All instances of the left hand (key) types act (in E) as if they are instances of the right hand (value) types.
private static String[][] Sugarings
          To the E programmer, the left hand (key) types seem to have methods according to this Java type, but as modified (sugared) by the right hand (value) types.
static ScriptMaker THE_ONE
          Enabled:
private static HashMap ThePromotions
          Maps fq class names to the fqn of the classes they promote to.
private static EMap TheSugars
          Maps fq class names to the fqn of the classes that sugar them.
 
Constructor Summary
private ScriptMaker()
           
 
Method Summary
private  void inherit(VTable vTable, Class donor, SafeJ safeJ)
           
 Script instanceScript(Class clazz)
          Enabled:
static Class OptPromotion(Class clazz)
          Enabled: Map a class to the class it promotes to, or null if none
static Class OptSugar(Class clazz)
          Enabled: Map a class to its sugaring class, or null if it doesn't have one
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Promotions

private static final String[][] Promotions
All instances of the left hand (key) types act (in E) as if they are instances of the right hand (value) types.

This often happens by converting them first.

This is much like the Simplifications in Equalizer, with some differences.


ThePromotions

private static HashMap ThePromotions
Maps fq class names to the fqn of the classes they promote to.

ThePromotions is initialized lazily in order to avoid possible circular static initialization dependencies. Uses legacy HashMap rather than EMap in order to avoid a circular dependency by way of the Equalizer.


Sugarings

private static final String[][] Sugarings
To the E programmer, the left hand (key) types seem to have methods according to this Java type, but as modified (sugared) by the right hand (value) types.


TheSugars

private static EMap TheSugars
Maps fq class names to the fqn of the classes that sugar them. TheSugars is initialized lazily in order to avoid possible circular static initialization dependencies.


THE_ONE

public static final ScriptMaker THE_ONE
Enabled:


myScripts

private final FlexMap myScripts
maps java classes to scripts

Constructor Detail

ScriptMaker

private ScriptMaker()
Method Detail

OptPromotion

public static Class OptPromotion(Class clazz)
Enabled: Map a class to the class it promotes to, or null if none


OptSugar

public static Class OptSugar(Class clazz)
Enabled: Map a class to its sugaring class, or null if it doesn't have one


inherit

private void inherit(VTable vTable,
                     Class donor,
                     SafeJ safeJ)

instanceScript

public Script instanceScript(Class clazz)
Enabled:



comments?