public LithpPrimitive Cast(LithpType newType) { if (newType == LithpType()) { return(this); } return(cast(newType)); }
protected override LithpPrimitive cast(LithpType newType) { switch (newType) { case LithpBlunt.LithpType.STRING: return(value.ToString()); case LithpBlunt.LithpType.INTEGER: return(new LithpInteger(Convert.ToInt64(value))); default: throw new NotImplementedException(); } }
protected override LithpPrimitive cast(LithpType newType) { switch (newType) { case LithpBlunt.LithpType.STRING: return(value.ToString()); case LithpBlunt.LithpType.FLOAT: return(new LithpFloat(value.ToString())); default: throw new NotImplementedException(); } }
protected override LithpPrimitive cast(LithpType newType) { switch (newType) { case LithpBlunt.LithpType.INTEGER: return(new LithpInteger(Value)); case LithpBlunt.LithpType.FLOAT: return(new LithpFloat(Value)); case LithpBlunt.LithpType.ATOM: return(LithpAtom.Atom(Value)); default: throw new NotImplementedException(); } }
protected override LithpPrimitive cast(LithpType newType) { switch (newType) { case LithpBlunt.LithpType.STRING: return(Name); case LithpBlunt.LithpType.INTEGER: return(Id); case LithpBlunt.LithpType.FLOAT: return(new LithpFloat((double)Id)); default: throw new NotImplementedException(); } }
protected virtual LithpPrimitive cast(LithpType newType) { throw new NotImplementedException(); }