There is the .Properties class which allows one to load and query properties from a text file in the form of

   propName = propValue

Empty lines and lines starting with a line comment get ignored.

Entries in the form of:

   bSomeLogical = 1
   bSomeLogical = true
   bSomeLogical = 0
   bSomeLogical = false

and attempting to read them with: say props~getLogical("bSomeLogical") yields 
the following error:

   say props~getLogical("incorporateCSS", .false)
      Oooops ! ... try again.     Logical value not 0 or 1.
                                  Property logical value must be exactly "0", "1", "true", or 
"false"; found " 1".

Note the leading blank in the value " 1".

In Rexx leading and trailing blanks are ignored, hence expecting the same to be the case here, when a comparison is carried out. Yet, the Properties class does not behave like Rexx in this case.

Also, as this is ooRexx the environment symbols .true and .false should be honored, but yields a runtime error instead:

   ay props~getLogical("incorporateCSS", .false)
      Oooops ! ... try again.     Logical value not 0 or 1.
                                  Property logical value must be exactly "0", "1", "true", or 
"false"; found " .true".

The blanks after the assignment operator here serves the purpose to make the property file easier legible. At least for logical values leading and trailing blanks should be ignored as in Rexx when comparing.

(The blanks after the equal signs get preserved, i.e. become part of the 
property value.)

---

Also, being Rexx it should not matter which case is being used for a property name, it should get stored in uppercase letters, such that requesting it from the collection can be achieved by sending the name of a property as a message, which is intuitive if one realizes that the Properties class specializes the Directory class.

Distinguishing the case makes using the Properties class more cumbersome than needed (for Rexx and ooRexx programmers who would just send a message by the name of the property).

The usability would be enhanced if the property names would be retrievable case independently. This could be achieved by changing the Properties load method to uppercase the name of the property before using it as the index name.

---

The reason for posting this on the developer list first is to stir a short discussion whether the current implemented behaviour should be kept or be made more "Rexxish" and more "ooRexxish" (cf. .Directory, .TextTable) before taking the time and adding a RFE.

---rony

_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to