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

st: RE: RE: Comment indicator * produces error in Mata


From   "Jann, Ben" <ben.jann@soz.gess.ethz.ch>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Comment indicator * produces error in Mata
Date   Tue, 24 May 2005 15:40:11 +0200

Scott Merryman wrote:
> Within Mata * is monadic operator.  See, [M-2] Pointers

... and also a dyadic operator, depending on the context. See 
[M-2] op_arith.

However, my argument is that, whatever meaning * has in Mata, it is
unplesant that in one part of an ado file the * comment indicator
works as expected, but produces an error in another part (in
particular, because other comment indicators do not have this
problem). It is clear to me that given the definition of Mata's
syntax (see [M-2] Syntax) it would not be possible to distinguish
whether * at the beginning of a line is a pointer prefix or a comment
indicator and that therefore only one of the two can exist (pointer
prefix, in this case). Nontheless, it would be nice if documentation
would point out that the * comment indicator does not work with Mata.
Maybe it is obvious to C programmers, but sure not to others.

ben

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu 
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of 
> Scott Merryman
> Sent: Tuesday, May 24, 2005 12:09 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: RE: Comment indicator * produces error in Mata
> 
> 
> Within Mata * is monadic operator.  See, [M-2] Pointers
> 
> Scott
> 
> > -----Original Message-----
> > From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> > statalist@hsphsun2.harvard.edu] On Behalf Of Jann, Ben
> > Sent: Tuesday, May 24, 2005 4:35 AM
> > To: statalist@hsphsun2.harvard.edu
> > Subject: st: Comment indicator * produces error in Mata
> > 
> > Hi,
> > it appears that the * comment indicator, which may be used at
> > the beginning of a line to indicate that the line is to be
> > ignored (see -help comments-), cannot be used with Mata.
> > Example:
> > 
> >   : void somefunction()
> >   > {
> >   > *       display("some text")
> >   > }
> > 
> >   : somefunction()
> >   some text
> >             somefunction():  3257  nonpointer found where pointer
> > required
> >                    <istmt>:     -  function returned error
> >   (0 lines skipped)
> > 
> > The error also occurs if somefunction() is defined whithin an
> > ado file. Other comment indicators like // or /**/ work fine.
> > 
> > If one really thinks hard about how the different comment
> > indicators are handeled in Stata, it is not surprising that
> > the * comment indicator does not work in Mata. Nonetheless,
> > I think that this is bad news for people being accustomed to
> > using the * comment indicator.
> > 
> > Even more bad news is that the problem is not mentionned in the
> > documentation (at least not in places where one would look for it
> > such as -help comment-, [M-1] first, [M-1] ado, [U] 16.1.2, or
> > [U] 18.11.2). I hope that this will change in a future update.
> > 
> > grumble...
> > ben
> > 
> 
> 
> 
> *
> *   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/
> 

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index