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

How do you call your functions?

Name: Anonymous 2005-12-07 16:31

A) poststupidshit
B) post_stupid_shit
C) PostStupidShit
D) postStupidShit
E) pss lol
etc

I call them like PostStupidShit or XXX_PostStupidShit where XXX is a module's short name.

Name: Anonymous 2005-12-07 17:28

– completePathIntoString:caseSensitive:matchesIntoArray:filterTypes:

Name: Anonymous 2005-12-07 17:30

post_stupid_shit

Name: Anonymous 2005-12-07 17:35

pooooooooooooooooooooooooooooossssssssssssssssssssssssssssssstttttttttttttttttttt________________--------------___________________________stuuupoddddddddddd__________-----Shit

Name: Anonymous 2005-12-07 18:19

F) LikeMyBossTellsMeToo

Name: Anonymous 2005-12-07 18:41

I always disliked postStupidShit; why is the first letter lowercase? That's ugly.

Name: Anonymous 2005-12-07 19:13

>>6
because you're a stupid shit

Name: Anonymous 2005-12-07 19:54

in C, Assembler and T-SQL I call them post_stupid_shit or pss
in C++, C# and VB6 I call them PostStupidShit

Name: Anonymous 2005-12-07 20:30

>>7
I am offended because you've insulted me over the Internet.

Name: Anonymous 2005-12-08 3:55

A - hard to read
B - hard to write
C - is ok
D - perfect
C - is stupid

Name: Anonymous 2005-12-08 3:56

F) POST_STUPID_SHIT

Name: Anonymous 2005-12-08 10:22

>>11

I use that style for constants

Name: Anonymous 2005-12-08 13:09

>>6
Provided your editor doesn't autocomplete such things, you don't have to hold down Shift every time you write a function name, which is win. IIRC, in Cocoa and Smalltalk, the first part of the name also hints at the return type, if any.

Name: Anonymous 2005-12-08 14:52

I use:

#define CONSTANT lol
//This is a comment. I like comments.
/* This is a long comment, only for function headers
 * Lol
 */
type FunctionName(type arg, ...) {
    type variablename;
    PresButan();
    do { //Braces in the same line and separated with a space
        //Try to always use {} even for a single statement, it's useful when you insert code and less error prone
        PresButan(); //Parenthesis next to the name because it's a function
    } while (!(snacks = ReceevSnacks())); //Parenthesis separated because it's a statement
    return snacks; //Return is a statement, no ()
}


>>13
I don't speak Hungarian

Name: Anonymous 2005-12-08 17:31 (sage)

I call them according to the establised conventions of the language I use and the project I participate in.

Name: Anonymous 2005-12-08 18:17

exactly as the haskell gods demand of me... postStupidShit. thou shall have no other style but this style!

Name: Anonymous 2005-12-08 19:31

>>15
So do I, but what when you're in charge of deciding it, or when you're writing your own stuff.

>>16
postStupidShit sucks though, not only it's ugly and inconsistently cased, but what if the function is only one word? post. You can't tell the difference from a variable symbol.

Name: Anonymous 2005-12-09 1:06

>>17 in haskell, there are no variables

Name: Anonymous 2005-12-09 5:56

>>18
The term "variable" is certainly used in Haskell (examine the Report if you don't believe me). It just happens to be closer to the algebraic concept of a variable than in imperative languages.

Name: Anonymous 2005-12-09 6:29

Java style:

fooBar //a variable
fooBar() //a method
FooBar //a class
FOO_BAR //a constant

Name: Anonymous 2005-12-09 7:39 (sage)

postStupidShit, of course

Name: Anonymous 2005-12-09 16:17

>>19

arguments, parameteres, constants, but certainly not variables!!!

unless you use unsafePerformIO

Name: Anonymous 2005-12-09 18:03

>>22
You're using the terminology of imperative languages there. Let me say it more clearly: "variable" means a symbol bound to a value, it does not imply that the value can change in the middle of a function.

foo :: Num a => a -> a
foo x = let y = x*x in y*y

foo is a variable (which happens to be bound to a function \x -> let y = x*x in y*y)
x is a variable, bound to whatever you use as argument when calling its function
y is a variable, bound to x*x
a is a type variable, bound to whatever instance of the Num typeclass the argument has

http://haskell.org/definition/

Name: Anonymous 2005-12-10 2:10

those are clearly parameters, not variables

Name: Anonymous 2005-12-10 9:49 (sage)

My bad. Arguing on the internet, what was I thinking

Name: Anonymous 2005-12-10 18:13

>>15
I agree.  Java methods are always camel case, C# methods are always Pascal case, etc..  Even when writing on your own there is still a good chance you'll be using libraries and frameworks and they will all be using the proper casing.  So you'd end up mixing within the same code otherwise.

One neat thing I've encountered in naming, though, is that you can have ? and ! in Ruby method names.  ? is usually used when returning a boolean while ! is used when modifying an object.

Name: Anonymous 2005-12-10 18:19

>>20
Agree

Name: Anonymous 2005-12-11 7:20

>>26
One neat thing I've encountered in naming, though, is that you can have ? and ! in Ruby method names.  ? is usually used when returning a boolean while ! is used when modifying an object.

That's the Scheme convention.

Name: Anonymous 2005-12-22 19:59

Let's not have an indent/naming war here, OK?

That said, in C and C++ I use function_with_many_words(...), C# it's ClassName.ToString(...) (i.e. camel case), in Java it's methodWithManyWords(...). Goes with the language actually. Haskell, same as Java (with less punctuation of course).

Is there any other way to go in Lisp than function-with-many-words? Schemers need not apply -- that shit's gay.

Name: Anonymous 2005-12-26 17:10

if( yourFunctionHasMoreThanFourWords() ) {
   getABetterVocabulary();
}

Name: Anonymous 2005-12-27 14:15

SystemTimeToTzSpecificLocalTime()
//Actual Win32 function

Name: Anonymous 2005-12-27 17:18

Tz?

Name: Anonymous 2005-12-27 17:39

Time Zone

Name: Anonymous 2005-12-27 21:23

I wish it was called SystemTimeToTimeZoneSpecificLocalTime()

Name: Anonymous 2005-12-30 7:25

if(iagsf() == true){
  fdija();
}

Name: Anonymous 2005-12-30 9:47

God I hate it when people compare expressions to true.

Name: Anonymous 2005-12-30 15:19

if(iagsf() != false){
  fdija();
}

Name: Anonymous 2005-12-30 17:03

witty

Name: Anonymous 2005-12-30 17:57

if((iagsf() == true) and (iagsf() != false)){
  fdija();
}

Name: Anonymous 2005-12-30 18:48

too far

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