Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: valid invalid syntax


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: valid invalid syntax
Date   Thu, 22 Apr 2004 15:34:00 +0100

Richard's comment is interesting. What's 
the history of this design decision? Could
it have been done his way? Perhaps only 
Bill Gould can say. 

There are at least three points of 
view here, that of the Stata user, the 
Stata programmer and the Stata developer. 
(Programmers write Stata programs; developers
(exclusively at StataCorp) write the executable, 
design the language, and write Stata programs.)  
Users have to accept the syntax as given, 
and in fact programmers have only a little
more freedom. 

As far as programmers are concerned, their main 
concern is with the -syntax- statement at the 
head of most programs they write. How 
Stata sorts out the syntax elements from a
command line is way beyond programmers' 
comprehension, as it is hidden in the executable, 
and the concern of the developers. 

Perhaps the main single point of the comma, 
so to speak, is to distinguish between variable 
names and option names. That should be clear. 
Without some distinction, chaos would ensue, 
as users would have to ensure that their 
variable names were never confusible with 
option names, and programmers would also 
get blamed for any such problem! The 
comma of course is not the only way to 
do this. Perl, for example, shows a very 
neat alternative. 

if ... and in ... are distinguished from 
variable names because -if- and -in- 
are reserved words. 

Weights are distinguished by their 
own syntax. 

But could they have been put after
the comma? 

I surmise that the choice made was not driven 
by syntax. It was, literally, a design choice. 
The idea was to make selections -if- and -in- 
and the use of weights seem central to the 
language. As said, that's a guess.  

Nick 
[email protected] 

Richard Williams

> if I was 
> writing Stata from scratch, I suspect I would have just made 
> the -if- and 
> -weight- parameters part of the options section of every 
> command; again that seems more natural to me.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index