On 22 April 2017 at 02:59, Matt Harden <matt.har...@gmail.com> wrote:
> a = ( b
>       + c
>       + d
>       * e
>       )

That doesn't work:
https://play.golang.org/p/z6HFDK3XRT

The usual Go idiom is to leave the operators at the end of the lines:

        a = b +
                c +
                d*
                        e

Note that extra-level of identation at the end - the original
expression is misleading - at a casual glance, you might
think that b+c+d is multiplied by e, but precedence rules means that
it doesn't.

        a = b +
                c +
                d +
                e

It's still almost as easy to add or remove a single line - with the exception
of the first and last lines.

It's kind of a pity that Go produces this an extra level of indent on
this though:

      a =
                b +
                        c +
                        d +
                        e

It would be nice if it produced:

        a =
                b +
                c +
                d +
                e

There's probably a good reason why it doesn't though, and
you can always work around it:

        a = 0 +
                b +
                c +
                d +
                e

  cheers,
    rog.

>
> On Thu, Apr 20, 2017 at 1:24 PM John McKown <john.archie.mck...@gmail.com>
> wrote:
>>
>> On Thu, Apr 20, 2017 at 12:20 PM, Michael Jones <michael.jo...@gmail.com>
>> wrote:
>>>
>>>
>>> On Thu, Apr 20, 2017 at 8:27 AM, <john.deig...@gmail.com> wrote:
>>>>
>>>> If I can't format my programs the way I want, and I much prefer putting
>>>> operators at the beginning of continuation lines for reasons mentioned on
>>>> this page, and "Perl Best Practices", I simply won't use the language - at
>>>> least not without implementing a pre-processor. Automatic semicolon
>>>> inserting is the worst thing about JavaScript. Please make it optional in
>>>> some way.
>>>
>>>
>>> The die has been cast. It usually takes two weeks for personal preference
>>> here to be forgotten. Hope you give it a good chance, as you'll have many
>>> positive benefits.
>>>
>>
>> I understand that it is oft-time better to approach a new language on its
>> own merits. Just like with a "human" language. You'll never learn language
>> ABC if you keep thinking in language DEF. I.e. think in DEF then translate
>> to ABC. You'll always end up doing something wrong because each language has
>> a different "mind set" or "world view".
>>
>> Having said the above, this "auto insertion" of a semi-colon is a bother
>> to me too. Mainly because I like to write C code something like:
>>
>> a = b
>>      + c
>>      + d
>>      * e
>>      ;
>>
>> So that I can easily insert or remove a single line. This may well be due
>> to my advanced age (64!) and the fact that my original language was FORTRAN
>> which was punched onto 80 column card stock. The above did waste cards, but
>> made program changes very easy. In today's world of "full screen" editors
>> which can reformat and even refactor code upon demand, it is a relic of a
>> bygone era.
>>
>>
>>
>> --
>> "Irrigation of the land with seawater desalinated by fusion power is
>> ancient. It's called 'rain'." -- Michael McClary, in alt.fusion
>>
>> Maranatha! <><
>> John McKown
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to golang-nuts+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to