type safety - What does it mean for a language to be statically typed?

My understanding is that it means that one can potentially write a program to formally prove that a program written in a statically typed language will be free of a certain (small) subset of defects.My problem with this is as follows:Assume that we have two turing complete languages, A and B. A is presumed to be 'type safe' and 'B' is presumed not to be. Suppose I am given a program L to check the correctness of any program written in A. What is to stop me from translating any program written in B to A, applying L. If P translates from A to B t...Read more

How to constraint input type and output type to be the same?

I am going through Type driven development with Idris from Manning. An example is given that teaches how to restrict a function to a given type in a family of types. We have Vehicle type that uses PowerSource that is either Pedal or Petrol and we need to write a function refill that typechecks only for vehicles that use petrol as their powersource.The below code works, but does not guarantee that refilling a Car will produce a Car and not a Bus. How do I need to change the signature of the refill function to only allow producing Car when given ...Read more

Potential type-safety issues on object parsing function in DXL

I have inherited the maintenance of a DXL script (for IBM Doors).In this, I came across various examples of stuff that make me scratch my head. Take this example:int key = 3print keyRunning this in Doors, results in the expected output: 3.However, in the documentation, we see that key is also the name of a function.Object ofor o in numberCache do { // must cast the key command. int i = (int key numberCache) print i}While even the reference docs are full of examples declaring stuff like string key, Item key and so on, my concern is abou...Read more