(no subject)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

(no subject)

Brian Northan
Hi List

Johannes recently pointed me to the formatting and cleanup styles of the top level imagej project (https://github.com/imagej/imagej/tree/master/config).

They work great.  Though one thing I've noticed is that it seems to handle the curly braces of functions with a multi-line declaration differently then those with one line.  What I mean is.

short declaration gets formatted like this...

public int sillyFunction1(final boolean b) {
        return 0;
    }

but if the declaration wraps to the next line the curly brace goes to another line

public int sillyFunction2(final boolean b, final int someInteger,
        final long... dims)
    {
        return 0;
    }

Does anybody else notice this??  Is it an intended part of the style??  I've noticed this pattern in a few places in the imagej-ops code.  Sometimes the curly braces for a function (or class declaration) are on the same line, sometimes on a new line.  Seems to depend on the length of the function/class declaration.

Brian








 





_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel
Reply | Threaded
Open this post in threaded view
|

Re: (no subject)

Curtis Rueden
Hi Brian,

> Is it an intended part of the style??

Yep, it's intended. It is a style I have used for many years. My reasoning is that once things wrap to a new line, the indentation becomes very misleading, and the "{" on its own line helps readability. But I acknowledge it's a bit weird.

Lately I've been a little weary of the verbosity of Java -- maybe I'll give Scala a spin some time...

Regards,
Curtis


On Mon, Aug 18, 2014 at 2:26 PM, Brian Northan <[hidden email]> wrote:
Hi List

Johannes recently pointed me to the formatting and cleanup styles of the top level imagej project (https://github.com/imagej/imagej/tree/master/config).

They work great.  Though one thing I've noticed is that it seems to handle the curly braces of functions with a multi-line declaration differently then those with one line.  What I mean is.

short declaration gets formatted like this...

public int sillyFunction1(final boolean b) {
        return 0;
    }

but if the declaration wraps to the next line the curly brace goes to another line

public int sillyFunction2(final boolean b, final int someInteger,
        final long... dims)
    {
        return 0;
    }

Does anybody else notice this??  Is it an intended part of the style??  I've noticed this pattern in a few places in the imagej-ops code.  Sometimes the curly braces for a function (or class declaration) are on the same line, sometimes on a new line.  Seems to depend on the length of the function/class declaration.

Brian








 





_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel



_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel
Reply | Threaded
Open this post in threaded view
|

Re: (no subject)

Brian Northan
Hi Curtis

Thanks for clarifying.   I was a bit confused by the fact that after autoformat sometimes the "{" was on the same line, and other time it was on a different line.  It took me a while to figure out the pattern. 

Brian


On Thu, Aug 21, 2014 at 4:30 PM, Curtis Rueden <[hidden email]> wrote:
Hi Brian,

> Is it an intended part of the style??

Yep, it's intended. It is a style I have used for many years. My reasoning is that once things wrap to a new line, the indentation becomes very misleading, and the "{" on its own line helps readability. But I acknowledge it's a bit weird.

Lately I've been a little weary of the verbosity of Java -- maybe I'll give Scala a spin some time...

Regards,
Curtis


On Mon, Aug 18, 2014 at 2:26 PM, Brian Northan <[hidden email]> wrote:
Hi List

Johannes recently pointed me to the formatting and cleanup styles of the top level imagej project (https://github.com/imagej/imagej/tree/master/config).

They work great.  Though one thing I've noticed is that it seems to handle the curly braces of functions with a multi-line declaration differently then those with one line.  What I mean is.

short declaration gets formatted like this...

public int sillyFunction1(final boolean b) {
        return 0;
    }

but if the declaration wraps to the next line the curly brace goes to another line

public int sillyFunction2(final boolean b, final int someInteger,
        final long... dims)
    {
        return 0;
    }

Does anybody else notice this??  Is it an intended part of the style??  I've noticed this pattern in a few places in the imagej-ops code.  Sometimes the curly braces for a function (or class declaration) are on the same line, sometimes on a new line.  Seems to depend on the length of the function/class declaration.

Brian








 





_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel




_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel