R
Roedy Green
Java has a goofy two-tier typing system.
1. run time using inheritance.
2. compile time using generics.
yet for primitive, there is no typing at all.
It is easy for example to reverse two int arguments to a method, one
an offset in pixels and the other an index to an array.
Perhaps the next stage is a compile time typing system for primitives.
the stage after that is to start over with a unified type system that
works with the same syntax the same for everything, at least from the
programmers' perspective.
One way of looking at a typing system for primitives is that you are
assigning units of measure. That opens to door to automatic
conversion, e.g. from US to metric.
That would prevent all kinds of error that untyped ints allow.
IT would add no run time overhead.
so I might write something like this:
oranges o = 7;
apples a = 2;
apples c = 2* a; // legal
apples c = o + a; // illegal
pick( a );
pick( o );
where oranges and applets are subclasses of fruit.
pick ( fruit x )
You could invent a set of nesting names, just like classes.
The type system would also help in IDEs. Once you wrote the name of a
method invocation there would be very few possible ways of completing
it. You could write a lot of code by multiple choice rather than by
typing.
--
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm
Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
1. run time using inheritance.
2. compile time using generics.
yet for primitive, there is no typing at all.
It is easy for example to reverse two int arguments to a method, one
an offset in pixels and the other an index to an array.
Perhaps the next stage is a compile time typing system for primitives.
the stage after that is to start over with a unified type system that
works with the same syntax the same for everything, at least from the
programmers' perspective.
One way of looking at a typing system for primitives is that you are
assigning units of measure. That opens to door to automatic
conversion, e.g. from US to metric.
That would prevent all kinds of error that untyped ints allow.
IT would add no run time overhead.
so I might write something like this:
oranges o = 7;
apples a = 2;
apples c = 2* a; // legal
apples c = o + a; // illegal
pick( a );
pick( o );
where oranges and applets are subclasses of fruit.
pick ( fruit x )
You could invent a set of nesting names, just like classes.
The type system would also help in IDEs. Once you wrote the name of a
method invocation there would be very few possible ways of completing
it. You could write a lot of code by multiple choice rather than by
typing.
--
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm
Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes