From murdoch.duncan at gmail.com  Thu Apr 25 02:45:12 2013
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Wed, 24 Apr 2013 20:45:12 -0400
Subject: [Rd] Patch proposal for R style consistency (concerning
	deparse.c)
In-Reply-To: <51787400.7010305@fhcrc.org>
References: <CAErODj85saboM+8SaYKKVVDL6cPeX=LVR=PKwY+FZb2ky_cpBg@mail.gmail.com>
	<5478C197-76AB-481D-A1AA-64DB63D8D122@gmail.com>
	<CAErODj_N+FCjP1zt2H4VHv28o8RDU8sQ-W4qGONkx1gLvC33pg@mail.gmail.com>
	<CANROs4emmr=rGLKWpCQ6z_016mAk7O42=ttA1BLnc9zQ_DTzqQ@mail.gmail.com>
	<51787400.7010305@fhcrc.org>
Message-ID: <51787C98.2030106@gmail.com>

On 13-04-24 8:08 PM, Herv? Pag?s wrote:
> On 04/18/2013 11:41 AM, Yihui Xie wrote:
>> I second the change of "} else {".
>
> Me too. Note that print.function() will screw it only if you use
> useSource=FALSE:
>
>     > print.function(foo3, useSource=FALSE)
>     function ()
>     {
>       if (FALSE) {
>           letters
>       }
>       else {
>           LETTERS
>       }
>     }
>
> Otherwise, everything is fine:
>
>     > print.function(foo3)
>     function()
>     {
>       if (FALSE) {
>           letters  # some comment
>       } else {
>           LETTERS
>       }
>     }
>
> I can't see of any reason why useSource=FALSE would screw my nicely
> formatted 'if' statement though.

You asked it to reformat it, because you didn't like your original 
formatting.  Otherwise you wouldn't have said useSource=FALSE.

This formatting is ugly, unnecessarily
> uses 1 more line, and the 'if' statement cannot be copy/pasted into an
> interactive session anymore. So, in a way, you could even consider
> this is invalid code.

That's nonsense.

Duncan Murdoch

>
> Thanks,
> H.
>
>>
>> Regards,
>> Yihui
>> --
>> Yihui Xie <xieyihui at gmail.com>
>> Phone: 515-294-2465 Web: http://yihui.name
>> Department of Statistics, Iowa State University
>> 2215 Snedecor Hall, Ames, IA
>>
>>
>> On Thu, Apr 18, 2013 at 11:16 AM, Paul Johnson <pauljohn32 at gmail.com> wrote:
>>> OK, I concede that.
>>>
>>> Now, how about "} else {"
>>>
>>> I will provide patch that does only that change.
>>> ?
>>>
>>> On Thu, Apr 18, 2013 at 3:05 AM, peter dalgaard <pdalgd at gmail.com> wrote:
>>>>
>>>> On Apr 18, 2013, at 05:39 , Paul Johnson wrote:
>>>>
>>>>> 2 & 3. I want to omit space after if and for.   Since if and for are
>>>>> functions in R, not keywords, I suggest that there should not be a
>>>>> space before the opening parentheses.
>>>>
>>>> Wrong. They are part of language constructs (and they _are_ keywords, not names, that's why ?for won't work). The function calls are `if`(fee, {foo}, {fie}) and something rebarbative for `for`(....).
>>>>
>>>> Besides, both constructs are harder to read without the spaces.
>>>>
>>>> --
>>>> Peter Dalgaard, Professor
>>>> Center for Statistics, Copenhagen Business School
>>>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
>>>> Phone: (+45)38153501
>>>> Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com
>>>>
>>>
>>>
>>>
>>> --
>>> Paul E. Johnson
>>> Professor, Political Science      Assoc. Director
>>> 1541 Lilac Lane, Room 504      Center for Research Methods
>>> University of Kansas                 University of Kansas
>>> http://pj.freefaculty.org               http://quant.ku.edu
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>



[Rd] Patch proposal for R style consistency (concerning deparse.c)
Duncan Murdoch