Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
July 16, 2004 More naming conventions | ||||
---|---|---|---|---|
| ||||
[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? |
July 16, 2004 Re: More naming conventions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | >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.
|
July 16, 2004 Re: More naming conventions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthias Becker | > >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? |
July 16, 2004 Re: More naming conventions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | 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
|
July 16, 2004 Re: More naming conventions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jason Mills | "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 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 A diet of too many languages. He he Sure, I mean sortWith and containsIf. :-) |
July 16, 2004 Re: More naming conventions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | 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
>
> 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
>
>
> A diet of too many languages. He he
Lisp? Ruby?
|
July 16, 2004 Re: More naming conventions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brad Anderson | "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 > > > > 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 > > > > > > A diet of too many languages. He he > > Lisp? Ruby? C++ first and foremost, but too much Ruby, Python, Perl of late as well. ;) |
Copyright © 1999-2021 by the D Language Foundation