using System.Text.Json.Serialization; namespace luaaaaah; [JsonDerivedType(typeof(Integer), typeDiscriminator: "int")] [JsonDerivedType(typeof(Float), typeDiscriminator: "float")] public interface INumeral { public class Integer(int value) : INumeral { public int value = value; public bool RawEqual(INumeral other) { if(other is Integer integer) { return integer.value == value; } // TODO: Check if this is actually doing what is expected return ((Float)other).value == value; } public override string ToString() { return $"Numeral Integer {value}"; } } public class Float(float value) : INumeral { public float value = value; public bool RawEqual(INumeral other) { if(other is Float float_val) { return float_val.value == value; } // TODO: Check if this is actually doing what is expected return ((Integer)other).value == value; } public override string ToString() { return $"Numeral Float {value}"; } } public bool RawEqual(INumeral other); }