Search the web
Sign In
New User? Sign Up
d_lab · D Lab
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Parameter's default values.   Message List  
Reply | Forward Message #158 of 169 |
Re: Parameter's default values.

--- In d_lab@yahoogroups.com, "Mariano" <rotoshi@...> wrote:
>
> I was cheking some examples at http://jcc_7.tripod.com/d/tutor/ by
> jccalvarese, and saw that that in the currency example he doesn't
> make use of the parameter's default values (probably not yet
> implemented in D by that time).
>
> The first 3 functions could be expressed with only one:
>
> char[] toStringFromDouble(double i, int decPlaces=2, char[] sep=".")
> {
> int whole;
> .
> .
> .
>
>
> Mariano.

Thanks for bringing this to my attention.

I looked at this example
(http://jcc_7.tripod.com/d/tutor/currency.html) and you're exactly
right that using default
values is a much more elegant means of a solution. In fact, many
aspects of D have changed/improved since I wrote this example. For
instance, toString didn't use to handle doubles (thus the whole
toStringFromDouble function is obsolete and broken).

I'm phasing out that particular website (the pop-ups are really
driving me crazy), so I don't know if I'll update the code there, but
my newer tutorial efforts are hosted by dsource, such as this newly
updated version of the currency example:
http://www.dsource.org/projects/tutorials/wiki/CurrencyExample

(I guess I need to either add links to the new versions of the
examples on my tripod site or remove them completely.)





Mon Nov 6, 2006 6:30 pm

jccalvarese
Offline Offline
Send Email Send Email

Forward
Message #158 of 169 |
Expand Messages Author Sort by Date

I was cheking some examples at http://jcc_7.tripod.com/d/tutor/ by jccalvarese, and saw that that in the currency example he doesn't make use of the...
Mariano
rotoshi
Online Now Send Email
Nov 6, 2006
2:35 pm

... Thanks for bringing this to my attention. I looked at this example (http://jcc_7.tripod.com/d/tutor/currency.html) and you're exactly right that using...
J C Calvarese
jccalvarese
Offline Send Email
Nov 6, 2006
6:36 pm

... No problem. BTW, I'm working in some little things not worthy of an entry in dsource, such as a command line parameter function, but since I'm new to D I...
Mariano
rotoshi
Online Now Send Email
Nov 7, 2006
2:02 pm

... If you're worried that someone will mind that you've posted code there, it's fine. Everyone has permission to post code on Wiki4D. If you're worried that...
J C Calvarese
jccalvarese
Offline Send Email
Nov 7, 2006
7:04 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help