Sujet : Re: OpenVMS system programming language
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.os.vmsDate : 25. Feb 2025, 03:22:06
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vpj9ge$1hqif$2@dont-email.me>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Pan/0.162 (Pokrosvk)
On Mon, 24 Feb 2025 20:33:07 -0500, Arne Vajhøj wrote:
But I think it is good code.
I think it is bloody long-winded code.
In C++ I could write things like
typedef std::map<std::string /*section*/, SectionParams>
SectionTable;
typedef std::pair<std::string, SectionParams>
SectionTablePair;
typedef SectionTable::const_iterator
SectionTableLister;
but Java doesn’t give you the option.
And then there’s the long-windedness of code like
static final java.util.Map<Integer, String> TypeNames;
/* mapping from sensor type codes to symbolic names */
static
{
TypeNames = new java.util.HashMap<Integer, String>();
TypeNames.put(Sensor.TYPE_ACCELEROMETER, "accelerometer");
TypeNames.put(Sensor.TYPE_AMBIENT_TEMPERATURE, "ambient temperature");
TypeNames.put(Sensor.TYPE_GRAVITY, "gravity");
TypeNames.put(Sensor.TYPE_GYROSCOPE, "gyroscope");
TypeNames.put(Sensor.TYPE_LIGHT, "light");
TypeNames.put(Sensor.TYPE_LINEAR_ACCELERATION, "linear accel");
TypeNames.put(Sensor.TYPE_MAGNETIC_FIELD, "magnetic");
TypeNames.put(Sensor.TYPE_ORIENTATION, "orientation");
TypeNames.put(Sensor.TYPE_PRESSURE, "pressure");
TypeNames.put(Sensor.TYPE_PROXIMITY, "proximity");
TypeNames.put(Sensor.TYPE_RELATIVE_HUMIDITY, "relative humidity");
TypeNames.put(Sensor.TYPE_ROTATION_VECTOR, "rotation");
TypeNames.put(Sensor.TYPE_TEMPERATURE, "temperature");
} /*static*/
because the language doesn’t provide expressions that evaluate to
common structure types like dictionaries/maps.