March 07, 2012
Am 06.03.2012, 23:50 Uhr, schrieb James Miller <james@aatch.net>:

> On 7 March 2012 10:30, deadalnix <deadalnix@gmail.com> wrote:
>> Le 06/03/2012 21:00, Timon Gehr a écrit :
>>
>>> On 03/06/2012 07:13 PM, Alex Rønne Petersen wrote:
>>>>
>>>> (Also, seriously, I think you're over-dramatizing the Java variable
>>>> naming thing; I rarely see names that are as bad as you claim...)
>>>>
>>>
>>> It is not only about single names, but also about how many times you
>>> have to spell them out in short intervals.
>>>
>>> try{
>>> SqlConstraintViolatedExceptionFactoryWrapper
>>> sqlConstraintViolatedExceptionFactoryWrapper = new
>>> SqlConstraintViolatedExceptionFactoryWrapper(new
>>> SqlConstraintViolatedExceptionFactory(...));
>>> SqlConstraintViolatedException sqlConstraintViolatedException =
>>>
>>> sqlConstraintViolatedExceptionFactory.createSqlConstraintViolatedException(...);
>>>
>>> throw sqlConstraintViolatedException;
>>> }catch(SqlConstraintViolatedExceptionFactoryWrapperException e){
>>> // ...
>>> }catch(SqlConstraintViolatedExceptionFactoryException e){
>>> // ...
>>> }
>>>
>>> Deliberately over-dramatized.

I have used Java commercially in Eclipse and I have to make a point for the combination of IDE and language here. What you really *type* for that is (<cs> meaning ctrl+space):

SCVEFW<cs><↓><enter> <cs><↓><↓><↓><enter> = new <cs><enter>new <cs><enter><tab>;<ctrl+1><↓><enter><↑><end>
SCVE<cs><↓><enter> <cs><↓><↓><enter> = <cs><↓><↓><↓><enter>.<enter>;
throw <cs><↓><enter>;

resulting in the following code:

	try {
		SqlConstraintViolatedExceptionFactoryWrapper sqlConstraintViolatedExceptionFactoryWrapper = new SqlConstraintViolatedExceptionFactoryWrapper(new SqlConstraintViolatedExceptionFactory());
		SqlConstraintViolatedException sqlConstraintViolatedException = sqlConstraintViolatedExceptionFactoryWrapper.createSqlConstraintViolatedException();
		throw sqlConstraintViolatedException;
	} catch (SqlConstraintViolatedExceptionFactoryWrapperException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (SqlConstraintViolatedExceptionFactoryException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

That is 72 key strokes instead of 519. So the spelling (as in typing) itself is not a problem with camel-case auto-complete, variable name and type based parameter guessing.

> "dur" should be "duration" because its silly otherwise. Seconds should
> be either "secs" /or/ "seconds", but should be consistent, I'd say
> "secs" because it meshes well with the other, sub-second, times
> ("nsecs", "usecs" etc) and writing out "microseconds" is a bit
> verbose, especially when you're probably outputting them as "12 us"
> anyway...
>
> --
> James Miller

+1
I tried to use "secs", at least two times. It is one of these cases where a minor annoyance adds up until someone eventually starts a rant about it. And a lot of people realize that they found the situation odd as well, but not an issue. I can see the reasoning behind making templated functions short, as in "dur", but it is inconsistent with Duration and almost like foo() and bar() :)
March 07, 2012
P.S.: ... I don't need to repeat the negative aspects of verbose names, but the benefit is a consistent naming style. Considering ArrayBuffer and OutputStream, ArrayBufferOutputStream is a natural blend, whereas ArrBufOStr would be shorter, but difficult to remember.
March 07, 2012
Am 07.03.2012, 07:17 Uhr, schrieb Daniel Murphy <yebblies@nospamgmail.com>:

> "Derek" <ddparnell@bigpond.com> wrote in message
> news:op.warmsnem34mv3i@red-beast...
>> On Wed, 07 Mar 2012 03:38:09 +1100, Adam D. Ruppe
>> <destructionator@gmail.com> wrote:
>>
>>> Why aren't we using real words here? Real words are easier
>>> to remember and easier to type.
>>
>> Should we use American or English spelling? Color verses Colour, for
>> example?
>>
>>
>> --
>> Derek Parnell
>> Melbourne, Australia
>
> American.  Always.

Whatever Java uses.
March 07, 2012
On 3/7/12, Steven Schveighoffer <schveiguy@yahoo.com> wrote:
> I'll see if I can do a pull request.

For my own purposes what I did was wrap StopWatch in a custom struct and used alias this to overwrite some of its functions. It's one of the things that makes D so great, I can basically rewrite an external API with zero hit on performance.

In fact, maybe we should add a note of this capability to the http://en.wikipedia.org/wiki/Adapter_pattern page (e.g. a "compile-time adapter" section)
March 07, 2012
On Wed, 07 Mar 2012 08:47:48 -0500, Steven Schveighoffer <schveiguy@yahoo.com> wrote:

> I'll see if I can do a pull request.

Almost done, need to test:

https://github.com/schveiguy/druntime/commit/cf9d1ba4f5498c447d91497cb5edbd735d2b4c7e

Actually cleans up a lot of the template constraints too...

-Steve
March 07, 2012
On Wed, Mar 07, 2012 at 03:30:15PM +0100, Andrej Mitrovic wrote:
> On 3/7/12, Steven Schveighoffer <schveiguy@yahoo.com> wrote:
> > I'll see if I can do a pull request.
> 
> For my own purposes what I did was wrap StopWatch in a custom struct and used alias this to overwrite some of its functions. It's one of the things that makes D so great, I can basically rewrite an external API with zero hit on performance.

+1. And what makes D even greater, is that it can do this without stupid convoluted syntax that either looks like line noise (*ahem*C++template syntax*ahem*) or rewrites the entire language (*cough*Cmacros*ahem*).


> In fact, maybe we should add a note of this capability to the http://en.wikipedia.org/wiki/Adapter_pattern page (e.g. a "compile-time adapter" section)

Beware the deletionists, though, if you do it.


T

-- 
Let's call it an accidental feature. -- Larry Wall
March 07, 2012
"Marco Leise" <Marco.Leise@gmx.de> wrote in message news:op.waszojl09y6py2@marco-pc.local...
>
>I have used Java commercially in Eclipse and I have to make a point for the
>combination of IDE and language here. What you really *type* for that is
>(<cs>
>meaning ctrl+space):
>
>SCVEFW<cs><?><enter> <cs><?><?><?><enter> = new <cs><enter>new
><cs><enter><tab>;<ctrl+1><?><enter><?><end>
>SCVE<cs><?><enter> <cs><?><?><enter> = <cs><?><?><?><enter>.<enter>;
>throw <cs><?><enter>;
>
>resulting in the following code:
>
>try {
>SqlConstraintViolatedExceptionFactoryWrapper
>sqlConstraintViolatedExceptionFactoryWrapper = new
>SqlConstraintViolatedExceptionFactoryWrapper(new
>SqlConstraintViolatedExceptionFactory());
>SqlConstraintViolatedException sqlConstraintViolatedException =
>sqlConstraintViolatedExceptionFactoryWrapper.createSqlConstraintViolatedException
>();
>throw sqlConstraintViolatedException;
>} catch (SqlConstraintViolatedExceptionFactoryWrapperException e) {
>// TODO Auto-generated catch block
>e.printStackTrace();
>} catch (SqlConstraintViolatedExceptionFactoryException e) {
>// TODO Auto-generated catch block
>e.printStackTrace();
>}
>
>That is 72 key strokes instead of 519. So the spelling (as in typing)
>itself is not a
>problem with camel-case auto-complete, variable name and type based
>parameter guessing.

Yea, but it's still unreadable, though. And even regarding the typing, that's really only applicable to Java since Java's the only language which pretty much everyone uses with an Eclipse-style IDE. And the only reason why everyone does that is because Java's completely unusable without it. Neither of those are applicable to D or pretty much *anything* other than Java.

>I tried to use "secs", at least two times. It is one of these cases where a
>minor annoyance adds up until someone eventually starts a rant about it.
>And a lot of people realize that they found the situation odd as well, but
>not
>an issue. I can see the reasoning behind making templated functions short,
>as in "dur", but it is inconsistent with Duration and almost like foo() and
>bar) :)

My thoughts on "secs vs seconds":

1. I don't feel real strongly either way.

2. I like the suggestion someone had of allowing both "secs" and "seconds". Normally I'd be against accepting alternate names (except as a transitional phase leading up to the deprecation of one of them), but in this case I think it could work without causing too much trouble.

3. Jonathan pointed out that both "secs" and "seconds" are inconsistent with other durations. He said that "seconds" was chosen to be consistent with "minutes", "hours", etc., and that the rule is sub-second durations use "*secs". After thinking about that, I've come to the conclusion that it's more important for seconds to be consistent with seconds. Ie, Having "msecs" and "seconds" is a more major inconsistency than having "secs" and "minutes" because with the former you have two different spellings of the *same* word: seconds.


March 07, 2012
"Adam D. Ruppe" <destructionator@gmail.com> wrote in message news:sgmfyzmrfygshlmfqsdj@forum.dlang.org...
> On Tuesday, 6 March 2012 at 20:20:47 UTC, Derek wrote:
>> Should we use American or English spelling? Color verses Colour, for example?
>
> I can go either way. I lean toward English spelling
> though, simply because America is the exceptional
> country (in the world and on the newsgroup too) in
> this regard.
>

British English may be the more "official" English, with American English as a mere variation, but AIUI, the "de facto international language" is American English, not British English, as a result of the US being a long-time major economic superpower (for better or worse). England used to be a major superpower, but that was centuries ago, and from what I can tell, American English seems to be the preferred "de facto standard" English now.

'Course, I'm in the US, so I may simply be biased just because, as an american, I do,  for example, prefer "color" over "colour". (OTOH, I think the word "lorry" is awesome. Not sure if I spelled it right, though.)

Speaking of...do the British actually pronounce colour with a "u" sound? If not, I'd argue "color" really is a better spelling ;) (Not as good as "kulr", but whatever)

> But, either option is better than "Clr" or "Col".

"clr" is the verb "clear" and "col" is "column" :)


March 07, 2012
"Jacob Carlborg" <doob@me.com> wrote in message news:jj755f$r7u$1@digitalmars.com...
> On 2012-03-07 04:46, Nick Sabalausky wrote:
>> "Adam D. Ruppe"<destructionator@gmail.com>  wrote in message news:bwqkuqhyiygvgqswicvz@forum.dlang.org...
>>> On Wednesday, 7 March 2012 at 03:24:23 UTC, Jonathan M Davis wrote:
>>>> I don't understand this complaint at all. curr is an incredibly common abbreviation for current.
>>>
>>> Is it your *first* choice?
>>
>> In the general case, it frequently is for me. In the specific case of
>> Clock.curr(ent)?Time, I'm equally happy either way. Although I agree with
>> whoever it was (Brad?) that said "Clock.now()" would be even better.
>>
>>
>
> Yeah, Clock.now() would be good and Data.today() as well.
>

I dunno, on the second one, I think I'd prefer "Date.today()" ;)

(Nyuk nyuk nyuk)


March 07, 2012
On Wed, Mar 07, 2012 at 01:24:03PM -0500, Nick Sabalausky wrote: [...]
> My thoughts on "secs vs seconds":
> 
> 1. I don't feel real strongly either way.
> 
> 2. I like the suggestion someone had of allowing both "secs" and "seconds".  Normally I'd be against accepting alternate names (except as a transitional phase leading up to the deprecation of one of them), but in this case I think it could work without causing too much trouble.
> 
> 3. Jonathan pointed out that both "secs" and "seconds" are inconsistent with other durations. He said that "seconds" was chosen to be consistent with "minutes", "hours", etc., and that the rule is sub-second durations use "*secs". After thinking about that, I've come to the conclusion that it's more important for seconds to be consistent with seconds. Ie, Having "msecs" and "seconds" is a more major inconsistency than having "secs" and "minutes" because with the former you have two different spellings of the *same* word: seconds.
[...]

I agree. This is one example of what I said about consistency. If we're going to abbreviate "seconds" to "secs" at all, we should abbreviate *all* instances to "secs".

While I understand Jonathan's explanation of the rule of durations longer/shorter than seconds, that's not something that someone unfamiliar with the system would expect. Picking seconds as the boundary between spelling it "seconds" vs. "secs" seems arbitrary. Why not pick hours as the dividing line instead? Make it years, days, hours, mins, secs, msecs, ...  instead. Or why not days, since days can't be reasonably abbreviated?  Years, days, hrs, mins, secs, msecs, ....

I think the right thing to do is to consistently abbreviate seconds as secs. As a compromise with the current state of affairs, alias "seconds" to "secs", as Nick suggests above.


T

-- 
Don't get stuck in a closet---wear yourself out.