2 ms·
At the risk of being that guy who always brings up rust: enum Process { Invalid, Terminated, Pid(libc::pid_t), } There would
by kelnos 2y ago
At the risk of being that guy who always brings up rust:
enum Process {
Invalid,
Terminated,
Pid(libc::pid_t),
}
There would be no way you could pass instances of the first two enum variants to kill(). Rust is of course not the only language where you can express something like this; e.g. in Scala2:
sealed trait Process
object Process (
case object Invalid extends Process
case object Terminated extends Process
case class Pid(pid: Int) extends Process
}
Does D have algebraic data types? Only allowing enums to be represented by integers is a language weakness.