What is your preferred pseudosyntax?
2 28 Dec 2016 18:54 by u/lmkevin
Pseudosyntax (or style some may call it), yes a made up word that means any detail of the code that does not effect lexical compilation results or processing efficiency of a program such as variable names, indent style, whitespace usage, newline placement, multi-line string concatenation and comment style. It's syntax that's not enforced by the compiler rather than the human's belief.
Now with the monikers established some basic questions could be
- Allman or K&R indent?
- When to use /* */ or //? x = 5 or x=5?
- my_variable, myVariable, or MyVariable?
- And above all why do you use any of those options compared to their alternatives?
What makes your pseudosyntax different?
4 comments
1 u/lmkevin [OP] 28 Dec 2016 19:01
I myself like Allman, K&R looks clunky and clustered. I can't even read K&R code without having to newline all the brackets. I typically only use '//' when it's the comment contains optional or non-important information and /* */ when it's describing multiple lines of code.
Variable naming usually depends on the language and what the language maker prefers. But if I could enforce one across the globe it would be the no caps and underscore (Linux/GNU) syntax. Because I spend less time on the shift key as I only ever need to use it with a single character. And best of all
1 u/saintPirelli 28 Dec 2016 21:42
I'd like to take this opportunity to say that I have no opinion on this matter whatsoever.
1 u/betadynamique 30 Dec 2016 11:08
All I can tell you is that if my program includes a function like fnAdd(x,y) the fn prefix doesn't necessarily stand for function, more likely f---ing where it's like in my mind I'm thinking "just fn add the damn numbers, and don't give me no grief about it".
0 u/ghost_marauder 29 Dec 2016 01:41
1.) I prefer to keep my operands in an uncurried state unless it makes logical since that they should be curried (like representing points)
2.) I prefer to call pure functions from an IO monad with the left arrow return $ because it keeps my return values on the left and easy to see.
3.) I prefer where clauses over let statements (actually I really hate the let statement, even through sometimes it's hard to avoid).
4.) I hate that the compiler gives me a warning about a tab instead of 8 spaces. I will always use a tab. It does not drive me as crazy.
5.) although not shown here, I prefer | over case every day of the week. Don't care if it's slower, it looks better to me.