Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Brace Style/Position

Name: Anonymous 2011-10-15 6:05

Java convention states:

Open brace “{” appears at the end of the same line as the declaration statement.
The opening brace should be at the end of the line that begins the compound statement; the
closing brace should begin a line and be indented to the beginning of the compound
statement.

>Like this

public class Zelda {
   //statements
}

>NOT LIKE THIS

public class Zelda
{
   //statements
}

Fuck people, put the opening brace on the same line as declaration statement. Is it really so hard?

Source: http://www.oracle.com/technetwork/java/codeconventions-150003.pdf

Name: Anonymous 2011-10-15 6:07

green text fail

but true, opening braces should go on the same line

Name: Anonymous 2011-10-15 7:54

As if any 14 year old would read a paper with 24 pages or even care about it. Get real.

Name: Anonymous 2011-10-15 9:11

>>2
There is no green text on /prog/. Go back to imageboards.

Name: Anonymous 2011-10-15 10:40

'>O RLY

Name: Anonymous 2011-10-15 10:44

>>5
open("shit.txt", O_RLY)

Because C has no symbols.

Name: HAXUS THE GREAT 2011-10-15 11:59

>>1
I don't /prog/gram in fucking Java, so fuck your "like this" convention.
I prefer the "NOT LIKE THIS" way since its easy by far to fucking SEE where the opening an closing curly braces are, especially with vim's syntax highlighter.

Name: Anonymous 2011-10-15 16:36

>>7
No, its not proper.

Name: Anonymous 2011-10-15 16:57

Name: Anonymous 2011-10-15 16:59

>>9
hi reddit!

Name: Anonymous 2011-10-15 17:29

>>9
go back to reddit fag

>>1
+1 for opening brace on same line

Name: Anonymous 2011-10-15 17:37

I prefer the "not like this" version, because the extra whitespace emphasizes the structure. Classes are things, not statements.

It's 2011. We don't have to be on 80x24; screens are as close to paper as they've ever been. Thus, understanding and implementing the principles of typography helps everyone, especially when writing in such a potent shorthand, where one glyph of punctuation  could destroy the entire work.

Name: Anonymous 2011-10-15 19:03

I hate the half-on-half-off style. If you're going to put { on the same line, you should put } on the same line too.


public class Zelda {
  public void start() {
    doSomething(); } }


but that's ugly as fuck. So the only way to be both pretty and consistent is to put every { and } on its own line.

Name: Anonymous 2011-10-15 19:19

>>13

public class Zelda {
   public void start(){
      doSomething();
   }
}

Name: Anonymous 2011-10-15 19:20

>>14
fail

Name: Anonymous 2011-10-15 19:27

public class Zelda
{
public void start()
{
doSomething();
}
}

Name: sage 2011-10-15 19:46


public
class
Zelda
{
public
void
start()
{
doSomething(
);
}
}

Name: Anonymous 2011-10-15 20:00

>>17
no

Name: Anonymous 2011-10-15 20:00

>>16-17

this is not pythonic

Name: Anonymous 2011-10-15 22:57

>>13
Lisper detected.

>>12
The extra whitespace makes it easy to "get lost" in the code for me. It's like those people who post on forums with 1 sentence per line. I use only enough whitespace to make the limits of a block clear.

Name: Anonymous 2011-10-16 5:33

>>7
Nope.avi

Name: Anonymous 2011-10-16 9:02

--> This thread is shitty and all, but check'em dubz.

Name: Anonymous 2011-10-16 9:04

I use braces doggy style

Name: Anonymous 2011-10-16 23:28

>>20
I concur.

Name: Anonymous 2011-10-17 0:04

>>20
What's that? Is that some Rice-A-Roni between your cheeks?!?
Therefore, all of your arguments are completely incorrect, and I am the number one winner right this minuteness!

Name: Anonymous 2011-10-17 0:11

>>20
Lisper detected.

OH NO HE'S FIGURED OUT MY SECRET

god this board is shitty

Name: HAXUS THE GREAT 2011-10-17 0:38

>>26
god this board is shitty
Please leave and never return. Thanks!
- The Management -

Name: Anonymous 2011-10-17 0:45

>>27
hax my anus, onee-chan faggot

Name: Anonymous 2011-10-17 0:51

>>27
- The Management -
You're not MrVacBob-sama.

Name: Anonymous 2011-10-17 1:00

When you put the open brace on the same line as declaration, it sometimes promotes code sandwiching. The code will cascade into each other and it will look like slop.

I think both styles have the pros & cons though. Too much spacing makes your head dizzy.

Name: Anonymous 2011-10-17 1:09

If I wanted to weave another kilobyte of core then I'd put whitespace in my code. But really, why bother?

Name: Anonymous 2011-10-17 1:26

>>30-31
sage you shit posts, ``faggots''

Name: Anonymous 2011-10-17 1:29

>>31
Go back to sleep die, Frozenvoid.

Name: Anonymous 2011-10-17 5:15

>>33
FrozenVoid doesn't sleep() or die() thats defective Sepples-level shit.

Name: Anonymous 2011-10-17 8:38

>>21
yourmomsafaggotbecausesheboreachildwhocantjusttypeanormalresponseandinsteadstypesitoutasafilename.swf

Name: Anonymous 2011-10-17 8:39

Please try to ignore troll posts.

Name: Anonymous 2011-10-17 12:10

statement (input)
 {
    Code
 }
is The Right Way.

Name: Anonymous 2011-10-17 14:06

>>36
Then what's the point of this board?

Name: Anonymous 2011-10-17 14:22

public class Zelda{public void start(){doSomething();}}

Name: Anonymous 2011-10-17 14:27

>>38
Getting dubz.

Name: Anonymous 2011-10-17 14:43

>>38
Discussing the development of the following:
* Valeat Res Magis: FrozenVoid's Web Browser.
* /prog/OS: A revolutionary Common Lisp-based OS.
* Nordlige Project: A curtain fire shooting game featuring magical viking boys in the fantasy land of Asgard.

Name: Anonymous 2011-10-17 14:49


'>2011
'>Taking FrozenVoid seriously

Name: Anonymous 2011-10-17 20:39

>>41
Lisp sucks dicks.

Name: Anonymous 2011-10-17 20:55

class Anus {

    int width;

    void prepare() {
       
        width *= 2;
    }
}

Name: Anonymous 2011-10-17 21:06

>>44
+1

Name: Anonymous 2011-10-18 0:43

>>42
FV is worth taking just as seriously today as he had been years ago. On the other hand, he hasn't posted in years so I'm not sure what you're talking about.

Name: Anonymous 2011-10-18 1:08

class fuckOff // {
 {

   System.out.println("Is it really that big of a fucking deal");

 }

Name: Anonymous 2011-10-18 10:01

>>47
fail

Name: Anonymous 2011-10-18 11:09

newlines are for newfags only

Name: Anonymous 2011-10-18 14:54


#define { }
#define } {

function idk() } some code {;
function next()}

....

{

function nextnext()
}

....

{


}━━━━━━━(゜∀゜)━━━━━━━━{

Name: Anonymous 2011-10-18 14:55

>>50
I hate you.
Please die.

Name: Anonymous 2011-10-18 15:27

`>discussing bracing styles
`>citing the Java conventions
Just take your little "hello, world!" programs back to /g/, please !

Name: Anonymous 2011-10-18 15:34

>>52
And you take you're greentext back to the imageboards, ,,please''.

Name: Anonymous 2011-10-18 20:29

>>53
fuck you fagstorm

Name: Anonymous 2011-10-18 21:08

if (x) {
    y;
} else {
    z;
}


is the only correct style. Anything else is faggotry.

Name: Anonymous 2011-10-18 21:27

>>55
+1

Name: Anonymous 2011-10-18 21:48

I think you'll find this is the optimal curly-brace placement:


class Anus(Orifice):
    def __init__(self):
        self.occupant = None
   
    def insert(self, implement):
        assert self.occupant is None
        self.occupant = implement

>>> myAnus = Anus()
>>> myAnus.insert('}')
>>> myAnus.insert('{')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 6, in insert
ASSertionError

Name: Anonymous 2011-10-19 10:40

if x
    y
else
    z
end

The only way.

Name: Anonymous 2011-10-19 11:02

(if x
    y
    z)

Name: Anonymous 2011-10-19 12:04

>>55
Ucking Bufugly
Kid, you gots no steeze.

Name: Anonymous 2011-10-19 12:52

>>59

(if x y . z)

is superior. then you can nest them without more parentheses:


(if a
    b
 if c
    d
 .  e)


yfw everything in lisp could be this clean but lisp must insist that EVERY FORM EVER be potentially variatic.

Name: Anonymous 2011-10-19 13:08

>>61
(cond
    (a b)
    (c d)
    (else e))

Name: Anonymous 2011-10-19 13:11


A |> B :: C



cnd (A -> B
    ;y -> C)

Name: Anonymous 2011-10-19 13:13

>>61
yfw everything in lisp could be this clean but lisp must insist that EVERY FORM EVER be potentially variatic.
McCarthy designed Lisp as a backend for his Algol compiler. It was never intended to be used directly. So didnt cared about the amount of verbosity.

Name: Anonymous 2011-10-19 13:15

>>62
why not (cond a b c d e)?

Name: Anonymous 2011-10-19 14:12

>>61
Whom are you quoting?

>>65
b, d and e have implicit begins.
In Scheme (but it's of course possible in CL too), (cond (e => f) ...) means (let ((x e)) (if x (f x) ...), cond's syntax permits extensions such as (cond (e => guard f) ...) -> (let ((x e)) (if (g x) (f x) ...).
(cond a b c d e) can't be extended as easily as (cond (a b) (c d) (else e)) in a backwards compatible way.

Don't change these.
Name: Email:
Entire Thread Thread List