package net.yak.stalk;

import java.util.HashMap;

import net.yak.stalk.Cls.JavMeth;
import net.yak.stalk.Pro.Obj;
import net.yak.stalk.Talk.Terp.Frame;

public class Usr extends Obj {

	HashMap<String, Pro> vars;

	public Usr(Cls cls) {
		super(cls);
		this.vars = new HashMap<String, Pro>();
	}
	public void visit(Visitor v) {
		v.visitUsr(this);
	}
	Usr asUsr() {
		return this;
	}

	static void addBuiltinMethodsForUsr(Terp terp) {
		terp.tUsrCls
				.addMethod(new JavMeth(terp.tUsrCls, "new", "",
						"Make a new instance.  (This message is inherited to any subclass of Usr.)") {
					public Pro apply(Frame f, Pro r, Pro[] args) {
						return new Usr(r.asCls());
					}
				});
	}
	
	public static class Tmp extends Usr {
	    Tmp(Terp t) {
	        super(t.tTmp);
	    }
	}
}