Anonymous user
Sum data type: Difference between revisions
→{{header|zkl}}
m (→{{header|Rust}}: added zkl header) |
|||
Line 124:
=={{header|zkl}}==
zkl is untyped - it is up to the container to decide if it wants to deal with a type or not.
<lang zkl></lang>▼
<lang zkl>ip:=List(127,0,0,1);
addrs:=Dictionary("ip",ip);</lang>
fcn init(addr){
var ip = addr;
if(not List.isType(addr)) throw(Exception.TypeError);
}
}
ip:=Addr(List(127,0,0,1));
Addr(127,0,0,1); // TypeError : Invalid type
Addr(List("abc")); // doesn't fail, would need more error checking
ip.ip=L(192,168,1,1); // this doesn't type check either</lang>
|