Guy Steele | 4 Jun 21:49
Picon
Favicon

Using all-uppercase names for types and variables


On Jun 4, 2008, at 3:00 PM, Sorin Miklós Zsejki wrote:

> Indeed, I've seen a big improvement in error messages since I've first
> tried out Fortress. My point with that post was not to criticize the
> error message, but that I was surprised that I couldn't change the
> name of a trait, let's say, from Xml to XML.

Yep.  Would you consider using the ASCII name  XML_ ?
When rendered it will look like "XML" in roman type,
without the underscore.

On May 30, 2008, at 2:41 AM, dmitrey wrote:
>
>
> for example I have a set of names (Python class constructors) "NLP",  
> "LP", "QP" etc (that are well-known names of optimization problems  
> classes), and using upper-case makes code more readable and  
> understandable than "nlp", "lp", etc (and, of course, much better  
> than _NLP_, NLP_ etc)

If you are wanting to use "NLP", etc., as trait or object names,
would you consider using  NLP_  ?  This will set "NLP" in roman type,
according to the usual Fortress convention for type names.
I agree, not quite as nice as plain "NLP" in ASCII code, but only one
extra character, and a visually unobtrusive one.

If you want to use it as an ordinary variable name *and* want
it to be set in italic type rather than roman type when rendered,
then right now there is no good solution in Fortress as it
stands.  But in the next generation of the rendering tool,
I am considering allowing one to write  italic_NLP  as a way
to force the use of italic type.

The general principle is that we are trying to make a lot of
common cases very easy to type, some of the less common
cases fairly easy to type, and then an all-purpose mechanism
that nearly always succeeds in letting you do what you want
but may be more verbose.

--Guy


Gmane