!7 //!include #1010605 // WeakHashMap2 sclass Symbol { S text; *() {} *(S *text, bool dummy) {} // weird signature to prevent accidental calling public int hashCode() { ret hashCode(text); } } static new WeakHashMap symbolMap; static Symbol symbol(S s) { synchronized(symbolMap) { Symbol test = Symbol(s, true); //WeakHashMap2.Entry e = symbolMap.getEntry(test); //Symbol sym = e == null ? null : e.get(); O e = call(symbolMap, 'getEntry, test); Symbol sym = cast callOpt(e, 'get); if (sym == null) symbolMap.put(sym = test, Bool.TRUE); ret sym; } } p { Symbol a = symbol("a"); }