digitalmars.D - More naming conventions
- "Matthew Wilson" <admin.hat stlsoft.dot.org> Jul 16 2004
- Matthias Becker <Matthias_member pathlink.com> Jul 16 2004
- Matthias Becker <Matthias_member pathlink.com> Jul 16 2004
- Jason Mills <jmills cs.mun.ca> Jul 16 2004
- "Matthew Wilson" <admin.hat stlsoft.dot.org> Jul 16 2004
- Brad Anderson <brad sankaty.dot.com> Jul 16 2004
- "Matthew" <admin stlsoft.dot.dot.dot.dot.org> Jul 16 2004
[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.
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:So, basically, we use the suffixes of "_if" and "_with". Is that
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
A diet of too many languages. He he Sure, I mean sortWith and containsIf. :-)
Jul 16 2004
Matthew Wilson wrote:"Jason Mills" <jmills cs.mun.ca> wrote in message news:cd8eas$5bc$1 digitaldaemon.com...Matthew Wilson wrote:So, basically, we use the suffixes of "_if" and "_with". Is that
digestibleto 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
A diet of too many languages. He he
Lisp? Ruby?
Jul 16 2004
"Brad Anderson" <brad sankaty.dot.com> wrote in message news:cd8kuh$7me$1 digitaldaemon.com...Matthew Wilson wrote:"Jason Mills" <jmills cs.mun.ca> wrote in message news:cd8eas$5bc$1 digitaldaemon.com...Matthew Wilson wrote:So, basically, we use the suffixes of "_if" and "_with". Is that
digestibleto 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
A diet of too many languages. He he
Lisp? Ruby?
C++ first and foremost, but too much Ruby, Python, Perl of late as well. ;)
Jul 16 2004









Matthias Becker <Matthias_member pathlink.com> 