octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coding style: unary operators


From: Juan Pablo Carbajal
Subject: Re: Coding style: unary operators
Date: Sat, 8 Nov 2014 18:27:28 +0100

On Sat, Nov 8, 2014 at 4:07 PM, Philip Nienhuis <address@hidden> wrote:
> Juan Pablo Carbajal-2 wrote
>> Hi,
>>
>> Do we need to insert a blank after unary prefix operators?
>> That is,
>>
>>  if !flag
>>
>> should it be
>>
>>  if ! flag
>>
>> ?
>>
>> For me it doesn't make sense, other wise we would have to write "-1"
>> as "- 1". Does anybody do that?
>
> For me a space after "!" makes it easier to distinguish it from "l" (lower
> L) or "1" or "|" (vertical line).
> The core devs have decided this (space after !) to be the preferred style so
> I just adhere to it (uhm, I try to).
>
> "- 1" seems to work as well.
> But it can be argued that a minus sign actually belongs to the following
> number, just like a "+" sign would/could, rather than it being a unary
> operator. So I'd say it depends on the context:
>
> -<space><some complicated term>  would make perfect sense; "-" is clearly a
> unary operator there.
>
> -<space>3  would make less sense (to me), I'd perceive "-3" as just a number
> or quantity.
>
> Philip
>
>
>
>
> --
> View this message in context: 
> http://octave.1599824.n4.nabble.com/Coding-style-unary-operators-tp4667274p4667275.html
> Sent from the Octave - Maintainers mailing list archive at Nabble.com.
>

So the Chicago boys support my feeling that unary operators are more
often understood as a modification of the symbol next to it, rather
than an operator therefore the blank is not natural (under this view).
Do we stick to the Chicago style or we have our own, and I have to get
use to add blanks after unary operators?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]