Sunday, October 26, 2008

How to improve Curl

One terrific thing about Curl as a language is that the compiler directives are able to help ensure coding standards as code evolves to production quality.

One vexing thing in Curl code is to find {field } expressions occurring willy-nilly within a {define-class }.

I propose an option for {define-class } such that the expression {attributes } is the one-and-only set of fields declared as follows:
{attributes
my-i-attr1:int
my-f-attr2:float
|| etc
}
In such a class definition the {field } expression may not occur when compiler-directives include
rational? = true ||humor

I would further propose the declaration grouping
{class
}
to replace and preclude the use of
{define-proc }
within a class declaration.

For the instance-side of a class, I would propose the use of the method grouping expressions
{public
and
{private
and
{protected
and that where such expressions occur, that no
{method
be permitted to be free-standing within that class definition when rational? = true and that only one occurrence of each grouping be permitted. A further restriction might require that public precede protected which must precede private.

The {class } expression would also permit some class-side procedures to be declared as final, sealed or open.

The compiler-directive rational? = true would be stronger than stringent?, i.e., classes compiled in a rational? package would be thereby also stringent?

To take a page from another language, within these method groupings, a blank line would separate method declarations and only method declarations.

One further option is to have {i-attributes } and {d-attributes}. No default values are declared for the former as they must be initialized in a factory/constructor method whereas the latter need not.

Clean code is readable code and readable code may be maintainable code.

No comments: