FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Numeric formating

 
Post new topic   Reply to topic     Forum Index -> Mango
View previous topic :: View next topic  
Author Message
John



Joined: 17 Jan 2006
Posts: 75

PostPosted: Thu Jan 19, 2006 12:07 pm    Post subject: Numeric formating Reply with quote

I've been working on a locale library which Kris is interested in adding to Mango. It'll include a number formatting module, using the selected locale's currency and numeric patterns. As potential stakeholders, I wanted to ask people which of the following forms you'd prefer to access these functions with:

Code:
char[] s = Number.format(1234, "N");


Or,

Code:
char[] s = formatNumber(1234, "N");


(Each of these prints "1,234.00" for UK/US, "1.234,00" for Germany, "1'234.00" for Switzerland and so on.)

The only difference is that the second style is a free function, while the first is a static member of an abstract, non-inheritable class. I'm not sure what the current preference is in Mango regarding static class v free methods, although Phobos tends towards the latter. I prefer the first form, and it is consistent with the rest of the package (where free functions aren't appropriate), so for that reason I'll probably depart from D's predominent style.

But what do you guys think? I could be persuaded to change my mind.

John.
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Thu Jan 19, 2006 12:30 pm    Post subject: Reply with quote

My tuppence ha'penny:

The first instance: Number.format()
Back to top
View user's profile Send private message
teqdruid



Joined: 11 May 2004
Posts: 390
Location: UMD

PostPosted: Fri Jan 20, 2006 8:36 am    Post subject: Reply with quote

The first one. Consistency with the rest of Mango is important.

~John Demme

(What is is about D that seems to attract people with the name John?)
Back to top
View user's profile Send private message Send e-mail AIM Address
John



Joined: 17 Jan 2006
Posts: 75

PostPosted: Fri Jan 20, 2006 9:46 am    Post subject: Reply with quote

Quote:
Consistency with the rest of Mango is important.


Yip, and it looks cute too.
Back to top
View user's profile Send private message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Fri Jan 20, 2006 3:16 pm    Post subject: Reply with quote

John and John, I'm just resigned to fact that this world is full of people bearing that name!

Reverently,

John
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Fri Jan 20, 2006 3:38 pm    Post subject: Reply with quote

Must be a western/northern hemisphere thing? In Australia, apparently everyone is called either Bruce! or Sheila!

What appear to be real Names (like Derek Parnell) are just clever nicknames instead, intended to confuse Pommies, Yanks, and various other lesser mortals Shocked
Back to top
View user's profile Send private message
John



Joined: 17 Jan 2006
Posts: 75

PostPosted: Fri Jan 20, 2006 10:30 pm    Post subject: Reply with quote

Surprisingly, John isn't the most common name in the English-speaking world. Nor even here in the UK. According to the Office of National Statistics, John started to fall out of favour in the 1960s, and lately others have taken over, with Jack, Joshua and Thomas being the top three. In 2005, John ranked a lowly 73rd, below even Harley and Alfie.

Parents aren't too creative when it comes to naming their offspring. But when they try, the results can be comic. In the US, Lexus has appeared in the top 1000 every year since 1993.

Then there are the parents who don't think of the consequences of the name they saddle their children with. Like mine, for example. Surely they weren't sober when they christened me with the rather feminine-sounding first name that led to all sorts of confusion (and puns on male genitalia) at school.

I've since switched my first and middle names, and hence am now a common (though not as common as you'd think) John.

John [second name withheld] C.
Back to top
View user's profile Send private message
larsivi
Site Admin


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Fri Jan 20, 2006 11:10 pm    Post subject: OT: Names Reply with quote

John wrote:

Parents aren't too creative when it comes to naming their offspring. But when they try, the results can be comic. In the US, Lexus has appeared in the top 1000 every year since 1993.


Well, I hear the british are among the worst here, as two families with last names Castle and Beer (!), called their sons, respectively, Windsor and Bottled.

My name has the same status in Norway as John in England, btw. Popular before, now only common.
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Mon Jan 23, 2006 3:10 am    Post subject: Re: OT: Names Reply with quote

larsivi wrote:
John wrote:

Parents aren't too creative when it comes to naming their offspring. But when they try, the results can be comic. In the US, Lexus has appeared in the top 1000 every year since 1993.


Well, I hear the british are among the worst here, as two families with last names Castle and Beer (!), called their sons, respectively, Windsor and Bottled.

My name has the same status in Norway as John in England, btw. Popular before, now only common.

And what about the guy who started the LearJet company (a certain Mr Lear) who called his daughter "Chanda" ?

Smile
Back to top
View user's profile Send private message
John



Joined: 17 Jan 2006
Posts: 75

PostPosted: Mon Jan 23, 2006 8:11 am    Post subject: Reply with quote

More from the department of funny names: the B-movie actor Rip Torn. And no discussion of this kind can pass without a mention of the legendary Thomas Crapper, who, contrary to popular myth, didn't invent the flushing toilet, nor does the profanity derive from his name (it was in use at least 400 years before his birth).

John C.
Back to top
View user's profile Send private message
gileadis



Joined: 04 Jan 2006
Posts: 5

PostPosted: Tue Jan 24, 2006 1:00 pm    Post subject: Re: OT: Names Reply with quote

kris wrote:
larsivi wrote:
John wrote:

Parents aren't too creative when it comes to naming their offspring. But when they try, the results can be comic. In the US, Lexus has appeared in the top 1000 every year since 1993.


Well, I hear the british are among the worst here, as two families with last names Castle and Beer (!), called their sons, respectively, Windsor and Bottled.

My name has the same status in Norway as John in England, btw. Popular before, now only common.

And what about the guy who started the LearJet company (a certain Mr Lear) who called his daughter "Chanda" ?

Smile


I had a friend who was a teacher. When reading the roll the first day, she got to "Shithead" and it took her a moment to work up the courage to call the name. "It's pronounced Shi-THADE!" shot back the irate student. Poor girl!
Back to top
View user's profile Send private message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Tue Jan 24, 2006 1:10 pm    Post subject: Reply with quote

Years ago I was on my way to talk with a therapist my HMO allocated to me. I followed the directions to the professional building, and went about looking up the doctor's name on the leger/index posted in the lobby; to make sure that I had the right place and room number.

While browsing past all the different companies and professionals, one stuck out like a sore thumb.

Harry Beaver, OBGYN.

I asked around, and learned that this wasn't a prank. The guy's legit.
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Tue Jan 24, 2006 1:46 pm    Post subject: Reply with quote

pragma wrote:
While browsing past all the different companies and professionals, one stuck out like a sore thumb ...

Laughing

I had a similar experience when going to a new Dentist in Aberdeen, Scotland ~ the sign on the wall noted one "Dr Pane" ~ luckily, that was the dentist next door to where I was going.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Mango All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group