January 23, 2011
"so" <so@so.do> wrote in message news:op.vpqi7ngy7dtt59@so-pc...
>> I'm the same way. Plus, I find it really awkward to constantly type a
>> bunch
>> of underscores. It feels less like "typing" and more like "finger
>> acobatics."
>
> It is worse for camelCase,

Don't see how. "iT" vs "i_t":

iT:
[i] [hold shift] [t] [release shift]

i_t:
[i] [hold shift] [reach over to -] [release shift] [t]

> at least you can bind "_" to another key.

I already use all my other keys.


January 23, 2011
That's why they invented the concept of rebinding the keys. And why Vim is a modal editor. Etc etc etc..
January 23, 2011
On 01/23/2011 12:03 AM, Ali Çehreli wrote:
> Jonathan M Davis wrote:
>> On Friday, January 21, 2011 13:30:11 Ali Çehreli wrote:
>>> Andrei Alexandrescu wrote:
>>> > iswhite
>>>
>>> I like separating is with an underscore, like most coding styles do:
>>>
>>> is_whitespace
>>>
>>> Warm and fuzzy... :)
>>
>> Most? I've never dealt with a coding style that had underscores.
>
> Sorry for being unclear. My comment was only in the context of is_. I
> like separating "is" with an underscore. Probably because "is" is not
> part of the name. It operates at a different linguistic level.
>
>  > It's generally
>> camelcase, though I get the impression that using underscores in C
>> code is more common (I've mostly used C++ and Java).
>
> Same here: always camelcase, except in our C libraries. Now I like
> underscore more than before. :)
>
>  > Regardless however, Phobos' coding style
>> uses camelcase, not underscores. And this whole thread was started to
>> try and find better names for functions which need new names, because
>> they don't currently follow Phobos' naming conventions.
>
> I am aware of that. Then half seriously, let's change the standard to
> use underscore after "is". Also when parts of a camelcased name are too
> loosely related.
>
> For example, when NodeReader is an interface and when we already have a
> LovelyDb, we may have a class named LovelyDb_NodeReader.
>
> Ali

Nice & sensible way of mixing both conventions :-) Sounds similar to using whitespace for visual grouping like in
	a*b + c*d
or
	[ [1,2,3] , [4,5,6] ]

But may be a bit too complicated for a public, free-willing, style, don't you think? Rather for an enforced project or corporate one, I'd say...

Denis
_________________
vita es estrany
spir.wikidot.com

January 23, 2011
On 01/23/2011 02:39 AM, Nick Sabalausky wrote:
> "so"<so@so.do>  wrote in message news:op.vpqi7ngy7dtt59@so-pc...
>>> I'm the same way. Plus, I find it really awkward to constantly type a
>>> bunch
>>> of underscores. It feels less like "typing" and more like "finger
>>> acobatics."
>>
>> It is worse for camelCase,
>
> Don't see how. "iT" vs "i_t":
>
> iT:
> [i] [hold shift] [t] [release shift]
>
> i_t:
> [i] [hold shift] [reach over to -] [release shift] [t]

Depends on your keyboard, Nick: '_' does not require shift, on mine (don't ask why). But '[' & ']' require AltGr :-( Think they are directly accessible on US keyboards, aren't they? This would explain they massive use in PLs.

denis
_________________
vita es estrany
spir.wikidot.com

January 23, 2011
spir wrote:
> On 01/23/2011 12:03 AM, Ali Çehreli wrote:

> Sounds similar to
> using whitespace for visual grouping like in
>     a*b + c*d
> or
>     [ [1,2,3] , [4,5,6] ]
>
> But may be a bit too complicated for a public, free-willing, style,
> don't you think? Rather for an enforced project or corporate one, I'd
> say...

Agreed, but I will keep using an underscore after "is". Another reason why I do so is, when used with camelcase, that little "is" capitalizes the next word just to be consistent with the camelcase part of the naming conventions. When we have an attribute of an object named 'ready', 'isReady()' doesn't match because 'ready' doesn't match 'Ready'. An underscore makes it stay lowercased:

    is_ready();

The attribute can follow the camelcase rule and be consistent with the rest of the names:

    is_lastItem();

Ali
January 23, 2011
On 01/23/2011 09:13 AM, Ali Çehreli wrote:
> Agreed, but I will keep using an underscore after "is". Another reason why I do
> so is, when used with camelcase, that little "is" capitalizes the next word
> just to be consistent with the camelcase part of the naming conventions. When
> we have an attribute of an object named 'ready', 'isReady()' doesn't match
> because 'ready' doesn't match 'Ready'. An underscore makes it stay lowercased:
>
>      is_ready();
>
> The attribute can follow the camelcase rule and be consistent with the rest of
> the names:
>
>      is_lastItem();

You're right, it's a nice convention.
Deins
-- 
_________________
vita es estrany
spir.wikidot.com

January 23, 2011
On 2011-01-21, Jonathan M Davis <jmdavisProg@gmx.com> wrote:
> tr? The name means nothing to me. I haven't a clue where the name comes from, so I can't really give a better version of the same name. As it is, tr seems fine to me, particularly since tR just seems stupid. It should probably get a more descriptive name though. replaceChars?

Just for everyone's info.

tr is a standard unix command; been around forever,
and it is a mnemonic for 'translate'.

It's also in perl.

tr A-Z a-z   # convert to lower-case
Perl: $ph =~ tr/0-9/cd # get only the digits from a phone number entry field.
January 23, 2011
On Sunday 23 January 2011 07:12:16 Brad wrote:
> On 2011-01-21, Jonathan M Davis <jmdavisProg@gmx.com> wrote:
> > tr? The name means nothing to me. I haven't a clue where the name comes from, so I can't really give a better version of the same name. As it is, tr seems fine to me, particularly since tR just seems stupid. It should probably get a more descriptive name though. replaceChars?
> 
> Just for everyone's info.
> 
> tr is a standard unix command; been around forever,
> and it is a mnemonic for 'translate'.
> 
> It's also in perl.
> 
> tr A-Z a-z   # convert to lower-case
> Perl: $ph =~ tr/0-9/cd # get only the digits from a phone number entry
> field.

Good to know. I know a number of unix/linux commands, but there always seems to be more of them... Not that that's a bad thing.

- Jonathan M Davis
February 04, 2011
On 22/01/2011 00:16, Andrei Alexandrescu wrote:
>
> Ever since I worked with STL, I fell in love with
> names_with_underscores. I can't explain it, but my feeling is that code
> using that convention is calm and levelheaded.
>

The explanation for that could very well be some form of Pavlovian reinforcement/conditioning. :)

-- 
Bruno Medeiros - Software Engineer
February 04, 2011
Am 04.02.2011 15:11, schrieb Bruno Medeiros:
> On 22/01/2011 00:16, Andrei Alexandrescu wrote:
>>
>> Ever since I worked with STL, I fell in love with
>> names_with_underscores. I can't explain it, but my feeling is that code
>> using that convention is calm and levelheaded.
>>
>
> The explanation for that could very well be some form of Pavlovian
> reinforcement/conditioning. :)
>
I would say it's the Stockholm syndrom :)

Mafi
1 2 3 4 5
Next ›   Last »