digitalmars.D - More naming conventions
- Matthew Wilson (29/29) Jul 16 2004 [btw, sorry for the stream-of-consciousness blitzkrieg of posts, but DTL...
- Matthias Becker (6/32) Jul 16 2004 hmm
- Matthias Becker (6/13) Jul 16 2004 Oops. It's
- Jason Mills (8/10) Jul 16 2004 I'm curious why you would use _if and _with, rather than the normal
- Matthew Wilson (5/15) Jul 16 2004 digestible
- Brad Anderson (2/26) Jul 16 2004 Lisp? Ruby?
- Matthew (3/29) Jul 16 2004 C++ first and foremost, but too much Ruby, Python, Perl of late as well....
[btw, sorry for the stream-of-consciousness blitzkrieg of posts, but DTL'll do that to ya. :)] Here's a thought: Currently we cannot have overloads of member template functions. That's not a massive hindrence, and I can live with it if providing it would be a significant problem for compilation. However, it does leave us with a few issues. I'd like to suggest another naming convention, for collection members. Any (constructive) thoughts on the following are welcome: Container { bool contains(value_type value) { . . . } template contains_if(F) { bool contains_if(F f) { . . . }} <result-set> sort() { . . . } template sort_with(F) { <result-set> sort_with(F f) { . . . }} So, basically, we use the suffixes of "_if" and "_with". Is that digestible to you good people?
Jul 16 2004
Currently we cannot have overloads of member template functions. That's not a massive hindrence, and I can live with it if providing it would be a significant problem for compilation. However, it does leave us with a few issues. I'd like to suggest another naming convention, for collection members. Any (constructive) thoughts on the following are welcome: Container { bool contains(value_type value) { . . . } template contains_if(F) { bool contains_if(F f) { . . . }} <result-set> sort() { . . . } template sort_with(F) { <result-set> sort_with(F f) { . . . }} So, basically, we use the suffixes of "_if" and "_with". Is that digestible to you good people?hmm result = foo.sort_with (delegate bool (Bar x, Bar y) { return x > y; }); .. if (foo.contains_if (delegate bool (Bar x) { return x % 2 == 0; })) .. OK. I can live with that.
Jul 16 2004
hmm result = foo.sort_with (delegate bool (Bar x, Bar y) { return x > y; }); .. if (foo.contains_if (delegate bool (Bar x) { return x % 2 == 0; })) .. OK. I can live with that.Oops. It's result = foo.sort_with!(delegate bool (Bar x, Bar y)) (delegate bool (Bar x, Bar y) { return x > y; }); ..if (foo.contains_if!(delegate bool (Bar x) ) (delegate bool (Bar x) { return x % 2 == 0; })).. Well, naming is still ok, but this doesn't look too good, does it?
Jul 16 2004
Matthew Wilson wrote:So, basically, we use the suffixes of "_if" and "_with". Is that digestible to you good people?I'm curious why you would use _if and _with, rather than the normal convention of separating words with capitals, like xxxIf, xxxWith? sort_with() contains_if() sortWith() containsIf() Jason
Jul 16 2004
"Jason Mills" <jmills cs.mun.ca> wrote in message news:cd8eas$5bc$1 digitaldaemon.com...Matthew Wilson wrote:digestibleSo, basically, we use the suffixes of "_if" and "_with". Is thatA diet of too many languages. He he Sure, I mean sortWith and containsIf. :-)to you good people?I'm curious why you would use _if and _with, rather than the normal convention of separating words with capitals, like xxxIf, xxxWith? sort_with() contains_if() sortWith() containsIf() Jason
Jul 16 2004
Matthew Wilson wrote:"Jason Mills" <jmills cs.mun.ca> wrote in message news:cd8eas$5bc$1 digitaldaemon.com...Lisp? Ruby?Matthew Wilson wrote:digestibleSo, basically, we use the suffixes of "_if" and "_with". Is thatA diet of too many languages. He heto you good people?I'm curious why you would use _if and _with, rather than the normal convention of separating words with capitals, like xxxIf, xxxWith? sort_with() contains_if() sortWith() containsIf() Jason
Jul 16 2004
"Brad Anderson" <brad sankaty.dot.com> wrote in message news:cd8kuh$7me$1 digitaldaemon.com...Matthew Wilson wrote:C++ first and foremost, but too much Ruby, Python, Perl of late as well. ;)"Jason Mills" <jmills cs.mun.ca> wrote in message news:cd8eas$5bc$1 digitaldaemon.com...Lisp? Ruby?Matthew Wilson wrote:digestibleSo, basically, we use the suffixes of "_if" and "_with". Is thatA diet of too many languages. He heto you good people?I'm curious why you would use _if and _with, rather than the normal convention of separating words with capitals, like xxxIf, xxxWith? sort_with() contains_if() sortWith() containsIf() Jason
Jul 16 2004