import unsafe store; (* from machineenv *)
let florian = tuple "Florian" 32 end;
store.fileExtern(florian "value.x");
let untypedValue = store.fileIntern("value.x");
let typedValue = unsafe.typeCast(untypedValue :Tuple :String :Int end);
Which errors could occur when this exchange mechanism is used?
Do you see any problems in the following statement?
let typedValue = unsafe.typeCast(untypedValue :Tuple :Int :String end);Try to exchange the value 'florian' in a type-safe manner using the module 'dynamic' (from stdenv). Is it possible to give this value the type 'Tuple :Int :String end'? Why (not)? Is it possible to give this value the type 'Tuple :String end'? Why (not)?
let printTupleFields(Dyn T <:Tuple end) = ...Test with:
printTupleFields(:Tuple name :String age :Int end); Let Person = Tuple name :String age :Int end; printTupleFields(Person);