-
Hi, I'm a physicist collaborating with people around the universe.
We are currently investigating the validity of the relation
E = mc2. My collaborators supply me the values of m
and c measured in their lab. As you know each place uses its own units.
I have values of m in milligrams, quintals, etc. The values of c are
in cubits per picosecond, miles per microsecond, etc.
I want to plugin the original experimental figures in the original units
in my program. But I want the calculated E to be in Joules.
Can your language do all the conversions for me? How do I
specify the different units and some of their relations (1 mile = 1482m)
in the program?
This is a simple example which should get you started. There is a
single formula but the inputs can be in different units.
- Hi, I'm running a supermarket. The new law want me to prove that
there are no strong gravitational fields in my store. So I have to calculate
the gravitational attraction between different objects in the store. The
formula is simple: F = Gm1m2/R2. As
you know the items in the store have their weights specified in a
bewildering variety of units. Some of them are liquids and they have
only their volumes specified. I can get the density (weight for unit volume)
figures from different labs but these are again in a variety of units.
The programmers are inexperienced. So I want automatic detection of
errors.
I heard that you are developing a language to solve this type of problems.
How do I solve this problem in your language?
This problem uses arrays. What is your array syntax? Can a single array
hold weights and volumes?
-
Hi, I'm running an online auction store. As you know different folks bid
in different currencies. To make matters worse, I should specify the current
highest bid to each participant in their own currency. I heard that you are
developing a new language ...
In this case the numbers come in at runtime. And you should identify the unit
at runtime and print some other value in the same unit.
-
Hi, I do weather modeling. I have a very good model which given today's
rainfall, pressure, temperature, wind velocity and direction, etc. predicts
tomorrow's tempreature. I want to distribute a program which does the
calculations. This program is meant to be used worldwide.
Each country in the world has its own way of measuring these
quantities. I want the pressure input, for example, to my program to be
in Pascal. (No,
not the computer language, but a unit for pressure.) But people
typically measure this in mm (of mercury). I don't want the user of the
program to go through the conversion process since it is error prone.
I heard that ...
This can be implemented as a function. The programmer specifies that
the pressure input is in Pascal and does the calculations. The user
of the function can supply the pressure in mm. The conversion should
be automatic.
You should give your function definition and function call
syntax. There can be unit mismatches between definition and call, but
the conversions have to be done automatically.
Is it possible to capture the
semantics of units through the language syntax with compliler and runtime
support? One of the deep, often unstated, beliefs in PL design is that
"If you take care of
syntax, the semantics takes care of itself." Another version of this is:
"If the program compiles then it is correct." For this the language
should have robust syntax. How true is this with: machine language
(oops, no compilation), assembly language, C, Java, and ML? The challenge PL
is to design a