[Nick Coghlan] > François Pinard wrote: > >I know that `string' and `socket' [modules] exist, despite `string' > >is evanescent, but they surely forced users at choosing other > >identifiers where `string' and `socket' would have been perfect. > I would suggest that bare type names are rarely appropriate for use a > variable names, except in toy examples. Or small enough functions. Small functions are not necessarily toys. > If I'm reading someone else's code, and they create a string or a > socket, I want to know what it is _for_, rather than the mere fact > this it is a string or a socket. If I write a function receiving a string as an argument, and the effect of the function being already documented, I see no point writing `parameter_string' or `the_argument_of_the_function' instead of `string', which is clear, clean and simple. Some people would write `s' instead, but for one, I stopped overly liking algebraic notation in programs after I left FORTRAN :-). When you speak to someone else about the argument of a simple function, don't you say "then the function takes the string, it massages the string this way, etc.". I like naming my variables the way I would speak about them! :-) > If the type is all that is important, then prepending some simple word > such as 'a_string' or 'the_string' or 'my_string' makes it clear to > the maintainer that the object doesn't really have any significant > semantic meaning beyond its type. Come on, be serious! :-) -- François Pinard http://www.iro.umontreal.ca/~pinard
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4