comp.lang.ada
 help / color / mirror / Atom feed
* a question of form
@ 2014-08-25 20:33 gdotone
  2014-08-25 20:56 ` Simon Clubley
  2014-08-26  7:04 ` Nasser M. Abbasi
  0 siblings, 2 replies; 17+ messages in thread
From: gdotone @ 2014-08-25 20:33 UTC (permalink / raw)


reading Ada 95 second edition, by feldman and koffman, the authors suggest that all reserve words be in caps and identifiers start with a capital letter, etc...

the authors do note that Ada is not case sensitive.

what is the general place in the real world of program form today?

g. 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: a question of form
  2014-08-25 20:33 a question of form gdotone
@ 2014-08-25 20:56 ` Simon Clubley
  2014-08-25 22:08   ` Ludovic Brenta
  2014-08-26  7:04 ` Nasser M. Abbasi
  1 sibling, 1 reply; 17+ messages in thread
From: Simon Clubley @ 2014-08-25 20:56 UTC (permalink / raw)


On 2014-08-25, gdotone@gmail.com <gdotone@gmail.com> wrote:
> reading Ada 95 second edition, by feldman and koffman, the authors
> suggest that all reserve words be in caps and identifiers start with a
> capital letter, etc...
>
> the authors do note that Ada is not case sensitive.
>
> what is the general place in the real world of program form today?
>

Upper case keywords are as ugly in Ada as they are in Oberon (it's one
of the things about Oberon I don't like.)

Lower case keywords for me and This_Is_An_Identifier or
this_is_an_identifier type identifiers but _never_ ThisIsAnIdentifier.
I regard the latter as not as easy to read as using underscores.

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: a question of form
  2014-08-25 20:56 ` Simon Clubley
@ 2014-08-25 22:08   ` Ludovic Brenta
  2014-08-26  1:06     ` gdotone
  0 siblings, 1 reply; 17+ messages in thread
From: Ludovic Brenta @ 2014-08-25 22:08 UTC (permalink / raw)


Simon Clubley writes on comp.lang.ada:
> On 2014-08-25, gdotone@gmail.com wrote:
>> reading Ada 95 second edition, by feldman and koffman, the authors
>> suggest that all reserve words be in caps and identifiers start with a
>> capital letter, etc...
>>
>> the authors do note that Ada is not case sensitive.
>>
>> what is the general place in the real world of program form today?
>>
>
> Upper case keywords are as ugly in Ada as they are in Oberon (it's one
> of the things about Oberon I don't like.)
>
> Lower case keywords for me and This_Is_An_Identifier or
> this_is_an_identifier type identifiers but _never_ ThisIsAnIdentifier.
> I regard the latter as not as easy to read as using underscores.

The Ada 95 Quality and Style Guide establishes the closest thing to a
standard as far as source text formatting goes.  I just noticed a new
and updated version on Wikibooks:

https://en.wikibooks.org/wiki/Ada_Style_Guide

Thanks to the authors of this Wikibook!

-- 
Ludovic Brenta.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: a question of form
  2014-08-25 22:08   ` Ludovic Brenta
@ 2014-08-26  1:06     ` gdotone
  0 siblings, 0 replies; 17+ messages in thread
From: gdotone @ 2014-08-26  1:06 UTC (permalink / raw)


On Monday, August 25, 2014 6:08:37 PM UTC-4, Ludovic Brenta wrote:

> The Ada 95 Quality and Style Guide establishes the closest thing to a
> standard as far as source text formatting goes.  I just noticed a new 
> and updated version on Wikibooks:
> 
> https://en.wikibooks.org/wiki/Ada_Style_Guide
> 
> Thanks to the authors of this Wikibook!
> -- 
> Ludovic Brenta.

thanks,
g.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: a question of form
  2014-08-25 20:33 a question of form gdotone
  2014-08-25 20:56 ` Simon Clubley
@ 2014-08-26  7:04 ` Nasser M. Abbasi
  2014-08-26 17:31   ` Jeffrey Carter
  1 sibling, 1 reply; 17+ messages in thread
From: Nasser M. Abbasi @ 2014-08-26  7:04 UTC (permalink / raw)


On 8/25/2014 3:33 PM, gdotone@gmail.com wrote:
> reading Ada 95 second edition, by feldman and koffman, the authors suggest
>that all reserve words be in caps and identifiers start with a capital letter, etc...
>
> the authors do note that Ada is not case sensitive.
>
> what is the general place in the real world of program form today?
>
> g.
>

lower case variables is best with _,

          like_this

I find using Upper_First_Letter not good for reading:

           Like_This

I like bold/daker font for keywords (but lower case), to distinguish
them from normal text and user variables.

Upper first letter case is best for package names
and classes, but not for user variables and
function names and type names.

my 2.5 cents
--Nasser

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: a question of form
  2014-08-26  7:04 ` Nasser M. Abbasi
@ 2014-08-26 17:31   ` Jeffrey Carter
  2014-08-27  5:00     ` Randy Brukardt
  0 siblings, 1 reply; 17+ messages in thread
From: Jeffrey Carter @ 2014-08-26 17:31 UTC (permalink / raw)


On 08/26/2014 12:04 AM, Nasser M. Abbasi wrote:
> 
> lower case variables is best with _,
> 
>          like_this
> 
> I find using Upper_First_Letter not good for reading:
> 
>           Like_This

I (and most others, it seems) find Initial_Caps easier to read for all identifiers.

If sharing code with others (here on c.l.a, for example), adhering to standard
formatting as used in the ARM or the Ada Quality and Style Guide will help
insure one's code is readable to the largest number of readers.

-- 
Jeff Carter
"Run away! Run away!"
Monty Python and the Holy Grail
58

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: a question of form
  2014-08-26 17:31   ` Jeffrey Carter
@ 2014-08-27  5:00     ` Randy Brukardt
  2014-08-27  7:17       ` AdaMagica
  0 siblings, 1 reply; 17+ messages in thread
From: Randy Brukardt @ 2014-08-27  5:00 UTC (permalink / raw)


"Jeffrey Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message 
news:ltig8o$8dl$2@dont-email.me...
> On 08/26/2014 12:04 AM, Nasser M. Abbasi wrote:
>>
>> lower case variables is best with _,
>>
>>          like_this
>>
>> I find using Upper_First_Letter not good for reading:
>>
>>           Like_This
>
> I (and most others, it seems) find Initial_Caps easier to read for all 
> identifiers.

I've always used title capitalization for identifiers. That is, capitalize 
them like a title (which is almost, but not quite the same as Initial_Caps). 
Thus, Good_and_Bad rather than Good_And_Bad. This gets me into trouble with 
the RM, because that requires capitalizing words that one *never* 
capitalizes in English. Personally, I think most people use all Initial_Caps 
because it does not require thinking (and thus it can be enforced with a 
simple tool -- although title case isn't hard to enforce with a tool, one 
just needs a list of the words that aren't capitalized [the Janus/Ada pretty 
printer supports title case identifiers that way]).

                                                                  Randy. 



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: a question of form
  2014-08-27  5:00     ` Randy Brukardt
@ 2014-08-27  7:17       ` AdaMagica
  2014-08-28 11:56         ` G.B.
  0 siblings, 1 reply; 17+ messages in thread
From: AdaMagica @ 2014-08-27  7:17 UTC (permalink / raw)


On Wednesday, August 27, 2014 7:00:47 AM UTC+2, Randy Brukardt wrote:
> I've always used title capitalization for identifiers. That is, capitalize 
> them like a title (which is almost, but not quite the same as Initial_Caps). 
> Thus, Good_and_Bad rather than Good_And_Bad. This gets me into trouble with 
> the RM, because that requires capitalizing words that one *never* 
> capitalizes in English.

I also like this style, and now I have a name for it.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: a question of form
  2014-08-27  7:17       ` AdaMagica
@ 2014-08-28 11:56         ` G.B.
  2014-08-28 13:23           ` Simon Wright
  2014-08-28 18:28           ` Jeffrey Carter
  0 siblings, 2 replies; 17+ messages in thread
From: G.B. @ 2014-08-28 11:56 UTC (permalink / raw)


On 27.08.14 09:17, AdaMagica wrote:
> On Wednesday, August 27, 2014 7:00:47 AM UTC+2, Randy Brukardt wrote:
>> I've always used title capitalization for identifiers. That is, capitalize
>> them like a title (which is almost, but not quite the same as Initial_Caps).
>> Thus, Good_and_Bad rather than Good_And_Bad. This gets me into trouble with
>> the RM, because that requires capitalizing words that one *never*
>> capitalizes in English.
>
> I also like this style, and now I have a name for it.

What will be the most wanted (and least controversial)
words for title case exception in English and other natural
languages?

(I'm collecting them for a patch of Ada mode for Emacs,
which makes Good_and_Bad appear automatically.)

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: a question of form
  2014-08-28 11:56         ` G.B.
@ 2014-08-28 13:23           ` Simon Wright
  2014-08-28 14:08             ` G.B.
  2014-08-28 19:26             ` Randy Brukardt
  2014-08-28 18:28           ` Jeffrey Carter
  1 sibling, 2 replies; 17+ messages in thread
From: Simon Wright @ 2014-08-28 13:23 UTC (permalink / raw)


"G.B." <bauhaus@futureapps.invalid> writes:

> On 27.08.14 09:17, AdaMagica wrote:
>> On Wednesday, August 27, 2014 7:00:47 AM UTC+2, Randy Brukardt wrote:
>>> I've always used title capitalization for identifiers. That is,
>>> capitalize them like a title (which is almost, but not quite the
>>> same as Initial_Caps).  Thus, Good_and_Bad rather than
>>> Good_And_Bad. This gets me into trouble with the RM, because that
>>> requires capitalizing words that one *never* capitalizes in English.
>>
>> I also like this style, and now I have a name for it.
>
> What will be the most wanted (and least controversial)
> words for title case exception in English and other natural
> languages?
>
> (I'm collecting them for a patch of Ada mode for Emacs,
> which makes Good_and_Bad appear automatically.)

The concept is quite close to "stop words" --
http://en.wikipedia.org/wiki/Stop_words

As it says in the article, not to be confused with safe words :-)

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: a question of form
  2014-08-28 13:23           ` Simon Wright
@ 2014-08-28 14:08             ` G.B.
  2014-08-28 19:26             ` Randy Brukardt
  1 sibling, 0 replies; 17+ messages in thread
From: G.B. @ 2014-08-28 14:08 UTC (permalink / raw)


On 28.08.14 15:23, Simon Wright wrote:
>> (I'm collecting them for a patch of Ada mode for Emacs,
>> which makes Good_and_Bad appear automatically.)

> The concept is quite close to "stop words" --
> http://en.wikipedia.org/wiki/Stop_words

Thanks, there's a lot of them, then. Perhaps the list of stop words
needs a vote of some sort.

I guess we don't require any safe words to stop flame wars
over what should be on the lists. ;-)

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: a question of form
  2014-08-28 11:56         ` G.B.
  2014-08-28 13:23           ` Simon Wright
@ 2014-08-28 18:28           ` Jeffrey Carter
  2014-08-28 19:35             ` Randy Brukardt
  1 sibling, 1 reply; 17+ messages in thread
From: Jeffrey Carter @ 2014-08-28 18:28 UTC (permalink / raw)


On 08/28/2014 04:56 AM, G.B. wrote:
> 
> What will be the most wanted (and least controversial)
> words for title case exception in English and other natural
> languages?
> 
> (I'm collecting them for a patch of Ada mode for Emacs,
> which makes Good_and_Bad appear automatically.)

In /The Elements of Grammar/ by Margaret Shertzer:

"Capitalize all principal words (that is, nouns, pronouns, adjectives, adverbs,
verbs, and first words) in titles"

The rule I learned is: Capitalize the first and last word of a title; capitalize
all other words except articles and short conjunctions and prepositions. "Short"
is usually defined as less than 4 letters.

-- 
Jeff Carter
"Since I strongly believe that overpopulation is by
far the greatest problem in the world, this [Soylent
Green] would be my only message movie."
Charleton Heston
123

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: a question of form
  2014-08-28 13:23           ` Simon Wright
  2014-08-28 14:08             ` G.B.
@ 2014-08-28 19:26             ` Randy Brukardt
  2014-08-28 20:19               ` Simon Wright
  1 sibling, 1 reply; 17+ messages in thread
From: Randy Brukardt @ 2014-08-28 19:26 UTC (permalink / raw)


"Simon Wright" <simon@pushface.org> wrote in message 
news:lyoav4iw91.fsf@pushface.org...
> "G.B." <bauhaus@futureapps.invalid> writes:
>
>> On 27.08.14 09:17, AdaMagica wrote:
>>> On Wednesday, August 27, 2014 7:00:47 AM UTC+2, Randy Brukardt wrote:
>>>> I've always used title capitalization for identifiers. That is,
>>>> capitalize them like a title (which is almost, but not quite the
>>>> same as Initial_Caps).  Thus, Good_and_Bad rather than
>>>> Good_And_Bad. This gets me into trouble with the RM, because that
>>>> requires capitalizing words that one *never* capitalizes in English.
>>>
>>> I also like this style, and now I have a name for it.
>>
>> What will be the most wanted (and least controversial)
>> words for title case exception in English and other natural
>> languages?
>>
>> (I'm collecting them for a patch of Ada mode for Emacs,
>> which makes Good_and_Bad appear automatically.)
>
> The concept is quite close to "stop words" --
> http://en.wikipedia.org/wiki/Stop_words
>
> As it says in the article, not to be confused with safe words :-)

Not really. "Stop words" are something that is invented to make search 
engine performance more tractable (indexing "the" would take a large amount 
of space and offer little value), while title case is something that is 
defined by the rules of English writing.

The Ada search engine uses a list of 124 stop words (we just called them 
"non-indexed words", never having heard of the term "stop words" -- a rather 
nonsensical term in any case, because what do they stop? Nothing, at least 
in our engine which can match them in quoted strings even though they're not 
in the index.)

The Janus/Ada pretty-printer uses a much shorter list of title words.

                           Randy.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: a question of form
  2014-08-28 18:28           ` Jeffrey Carter
@ 2014-08-28 19:35             ` Randy Brukardt
  2014-08-29 11:55               ` G.B.
  0 siblings, 1 reply; 17+ messages in thread
From: Randy Brukardt @ 2014-08-28 19:35 UTC (permalink / raw)


"Jeffrey Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message 
news:ltnsdb$jtn$2@dont-email.me...
> On 08/28/2014 04:56 AM, G.B. wrote:
>>
>> What will be the most wanted (and least controversial)
>> words for title case exception in English and other natural
>> languages?
>>
>> (I'm collecting them for a patch of Ada mode for Emacs,
>> which makes Good_and_Bad appear automatically.)
>
> In /The Elements of Grammar/ by Margaret Shertzer:
>
> "Capitalize all principal words (that is, nouns, pronouns, adjectives, 
> adverbs,
> verbs, and first words) in titles"
>
> The rule I learned is: Capitalize the first and last word of a title; 
> capitalize
> all other words except articles and short conjunctions and prepositions. 
> "Short"
> is usually defined as less than 4 letters.

That sounds about right.

I just looked at the code for handling title case in the Janus/Ada pretty 
printer. It uses a "minimal perfect hash" for these words, and in general 
seems a heck of a lot more complicated than seems necessary for something 
that requires a maximum of 4 compares per test (all of the words in the list 
are 4 characters or less long).

Anyway, here's the code that creates the list of words:

        Set_Small_Word ("a");
        Set_Small_Word ("an");
        Set_Small_Word ("and");
        Set_Small_Word ("as");
        Set_Small_Word ("at");
        Set_Small_Word ("but");
        Set_Small_Word ("by");
        Set_Small_Word ("for");
        Set_Small_Word ("from");
        Set_Small_Word ("if");
        Set_Small_Word ("in");
        Set_Small_Word ("into");
        Set_Small_Word ("nor");
        Set_Small_Word ("of");
        Set_Small_Word ("on");
        Set_Small_Word ("onto");
        Set_Small_Word ("or");
        Set_Small_Word ("than");
        Set_Small_Word ("the");
        Set_Small_Word ("to");
        Set_Small_Word ("with");

As far as a definitive list is concerned, I suspect that there always are 
going to be grey areas where the choice is not obvious. That's why we stuck 
to a minimal list.

                                              Randy.




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: a question of form
  2014-08-28 19:26             ` Randy Brukardt
@ 2014-08-28 20:19               ` Simon Wright
  2014-08-28 20:48                 ` Simon Wright
  0 siblings, 1 reply; 17+ messages in thread
From: Simon Wright @ 2014-08-28 20:19 UTC (permalink / raw)


"Randy Brukardt" <randy@rrsoftware.com> writes:

> Not really. "Stop words" are something that is invented to make search
> engine performance more tractable (indexing "the" would take a large
> amount of space and offer little value), while title case is something
> that is defined by the rules of English writing.

I agree with you about 'stop words' (though they've been used in
indexing from long before search engines!); but I don't thnk there is
one set of 'rules of English writing'.

I gather from browsing the Guardian style guide that the rules (not just
for headings) required all-caps for mentions of ministers of the Crown;
"the HOME SECRETARY stated that ...". Ugh.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: a question of form
  2014-08-28 20:19               ` Simon Wright
@ 2014-08-28 20:48                 ` Simon Wright
  0 siblings, 0 replies; 17+ messages in thread
From: Simon Wright @ 2014-08-28 20:48 UTC (permalink / raw)


Simon Wright <simon@pushface.org> writes:

> I gather from browsing the Guardian style guide that the rules (not
> just for headings) required all-caps for mentions of ministers of the
> Crown; "the HOME SECRETARY stated that ...". Ugh.

I should have said, that was in the dim-and-distant past.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: a question of form
  2014-08-28 19:35             ` Randy Brukardt
@ 2014-08-29 11:55               ` G.B.
  0 siblings, 0 replies; 17+ messages in thread
From: G.B. @ 2014-08-29 11:55 UTC (permalink / raw)


On 28.08.14 21:35, Randy Brukardt wrote:
> "Jeffrey Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message
> news:ltnsdb$jtn$2@dont-email.me...

>> In /The Elements of Grammar/ by Margaret Shertzer:
>>
>> "Capitalize all principal words (that is, nouns, pronouns, adjectives,
>> adverbs,
>> verbs, and first words) in titles"
>>
>> The rule I learned is: Capitalize the first and last word of a title;
>> capitalize
>> all other words except articles and short conjunctions and prepositions.
>> "Short"
>> is usually defined as less than 4 letters.

Thanks for the reference and list.

> Anyway, here's the code that creates the list of words:

> As far as a definitive list is concerned, I suspect that there always are
> going to be grey areas where the choice is not obvious. That's why we stuck
> to a minimal list.

It turns out that projects using Emacs Ada mode may register
a simple text file containing "partial words" such as those
in your list; these would have small letters automatically.

In addition, a conditional for excepting both the first and
last word of an identifier was easy to add to the mode's source.
The presence of this little patch or equivalent will, however,
be a matter of demand, I guess.

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-08-29 11:55 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-25 20:33 a question of form gdotone
2014-08-25 20:56 ` Simon Clubley
2014-08-25 22:08   ` Ludovic Brenta
2014-08-26  1:06     ` gdotone
2014-08-26  7:04 ` Nasser M. Abbasi
2014-08-26 17:31   ` Jeffrey Carter
2014-08-27  5:00     ` Randy Brukardt
2014-08-27  7:17       ` AdaMagica
2014-08-28 11:56         ` G.B.
2014-08-28 13:23           ` Simon Wright
2014-08-28 14:08             ` G.B.
2014-08-28 19:26             ` Randy Brukardt
2014-08-28 20:19               ` Simon Wright
2014-08-28 20:48                 ` Simon Wright
2014-08-28 18:28           ` Jeffrey Carter
2014-08-28 19:35             ` Randy Brukardt
2014-08-29 11:55               ` G.B.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox