>>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.
SystemTimeToTzSpecificLocalTime()
//Actual Win32 function
Name:
Anonymous2005-12-27 17:18
Tz?
Name:
Anonymous2005-12-27 17:39
Time Zone
Name:
Anonymous2005-12-27 21:23
I wish it was called SystemTimeToTimeZoneSpecificLocalTime()
Name:
Anonymous2005-12-30 7:25
if(iagsf() == true){
fdija();
}
Name:
Anonymous2005-12-30 9:47
God I hate it when people compare expressions to true.
Name:
Anonymous2005-12-30 15:19
if(iagsf() != false){
fdija();
}
Name:
Anonymous2005-12-30 17:03
witty
Name:
Anonymous2005-12-30 17:57
if((iagsf() == true) and (iagsf() != false)){
fdija();
}
Name:
Anonymous2005-12-30 18:48
too far
Name:
Anonymous2005-12-30 18:50 (sage)
can be further..
Name:
Anonymous2005-12-30 22:58
fgsfds();
Name:
Anonymous2006-01-03 13:45
if i have to insert some code for debugging purposes or am writing some really worthless one-use stuff it usually looks like this:
fuck = shit*2;
while(faggots--) {
asshole(shit);
fuck += you;
}
print "suck a dick:" + fuck + "," + you;
Name:
Anonymous2006-01-03 16:01
i called one of my functions shitFuckingBlowsUp because it used unsafePerformIO... also sometimes i call my function tut, tutut, tututut,... when it gets too long I call them toot, toottoot,... and variations.
Name:
Anonymous2006-01-03 20:56
>>44
Your job position at maintenance is secured. We don't want it.
For debugging purposes I just use obfuscated code and vowel variables.
I did use swear words in some code, but it was something like
Remind me to never, ever, ever work with you or on any code you've written.
Name:
Anonymous2006-01-05 16:42
>>44
You dirty, dirty boy. Just wrap your crap in an IO monad like the rest of us do and stop having pretensions about doing computation when it's really I/O.
>>50
what is the difference between that and regular C? From my understanding OO concepts are not language dependant so why does objective C exist? I've also never used it and google doesn't work for me. Actually no, I'm just lazy to look it up.
Name:
Anonymous2006-01-07 13:46
>>51
Why does any language above assembler exist? Because it's easier to have the compiler and runtime do some of the grunt work for you.