>>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:
Anonymous2005-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 ()
}
I call them according to the establised conventions of the language I use and the project I participate in.
Name:
Anonymous2005-12-08 18:17
exactly as the haskell gods demand of me... postStupidShit. thou shall have no other style but this style!
Name:
Anonymous2005-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.
>>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.
arguments, parameteres, constants, but certainly not variables!!!
unless you use unsafePerformIO
Name:
Anonymous2005-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
My bad. Arguing on the internet, what was I thinking
Name:
Anonymous2005-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.
>>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:
Anonymous2005-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.