Thread overview | ||||||
---|---|---|---|---|---|---|
|
August 20, 2010 [phobos] readf for the novice | ||||
---|---|---|---|---|
| ||||
There was a newsgroup post on this subject the beginning of this week and it didn't get much feedback, other than a couple "sounds good to me" http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=115470 I offered to clean up my implementation. There are some things I need to experiment with and choose what would be best. And most importantly I need to find out if it would be considered a good addition to Phobos. The below code is an example of the functions and their usage: import std.interact; void main() { auto age = userInput!int("Please Enter you age"); if(userInput!bool("Do you want to continue?")) { auto outputFolder = pathLocation("Where you do want to place the output?"); auto color = menu!string("What color would you like to use?", ["Blue", "Green"]); } auto num = require!(int, "a > 0 && a <= 10")("Enter a number from 1 to 10"); } Opinions? -- Liberty means responsibility. That is why most men dread it. ? - George Bernard Shaw |
September 11, 2010 [phobos] readf for the novice | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | There was a newsgroup post on this subject the beginning of this month and it didn't get much feedback, other than a couple "sounds good to me" http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=115470 I offered to clean up my implementation. There are some things I need to experiment with and choose what would be best. And most importantly I need to find out if it would be considered a good addition to Phobos. The below code is an example of the functions and their usage: import std.interact; void main() { ? ?auto age = userInput!int("Please Enter you age"); ? ?if(userInput!bool("Do you want to continue?")) ? ?{ ? ? ? ?auto outputFolder = pathLocation("Where you do want to place the output?"); ? ? ? ?auto color = menu!string("What color would you like to use?", ["Blue", "Green"]); ? ?} ? ?auto num = require!(int, "a > 0 && a <= 10")("Enter a number from 1 to 10"); } Opinions? -- Liberty means responsibility. That is why most men dread it. ? - George Bernard Shaw -------------- next part -------------- A non-text attachment was scrubbed... Name: interact.d Type: text/x-dsrc Size: 4963 bytes Desc: not available URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20100911/8ff084c6/attachment.d> |
September 14, 2010 [phobos] readf for the novice | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | I think that's useful functionality, but it doesn't strike me as an API belonging to the standard library.
Andrei
On 09/11/2010 04:41 PM, Jesse Phillips wrote:
> There was a newsgroup post on this subject the beginning of this month and it didn't get much feedback, other than a couple "sounds good to me"
>
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=115470
>
> I offered to clean up my implementation. There are some things I need to experiment with and choose what would be best. And most importantly I need to find out if it would be considered a good addition to Phobos. The below code is an example of the functions and their usage:
>
> import std.interact;
>
> void main() {
> auto age = userInput!int("Please Enter you age");
>
> if(userInput!bool("Do you want to continue?"))
> {
> auto outputFolder = pathLocation("Where you do want to place
> the output?");
> auto color = menu!string("What color would you like to use?",
> ["Blue", "Green"]);
> }
>
> auto num = require!(int, "a> 0&& a<= 10")("Enter a number from 1 to 10");
> }
>
> Opinions?
>
>
>
>
>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
|
September 14, 2010 [phobos] readf for the novice | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | Thank you for the response and I can understand leaving it out of Phobos. I'd like to claim that it is similar in manner to getopt, but there is actually a standard for passing parameters to a program so... On Tue, Sep 14, 2010 at 7:29 AM, Andrei Alexandrescu <andrei at erdani.com>wrote: > I think that's useful functionality, but it doesn't strike me as an API belonging to the standard library. > > Andrei > > > On 09/11/2010 04:41 PM, Jesse Phillips wrote: > >> There was a newsgroup post on this subject the beginning of this month and it didn't get much feedback, other than a couple "sounds good to me" >> >> >> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=115470 >> >> I offered to clean up my implementation. There are some things I need to experiment with and choose what would be best. And most importantly I need to find out if it would be considered a good addition to Phobos. The below code is an example of the functions and their usage: >> >> import std.interact; >> >> void main() { >> auto age = userInput!int("Please Enter you age"); >> >> if(userInput!bool("Do you want to continue?")) >> { >> auto outputFolder = pathLocation("Where you do want to place >> the output?"); >> auto color = menu!string("What color would you like to use?", >> ["Blue", "Green"]); >> } >> >> auto num = require!(int, "a> 0&& a<= 10")("Enter a number from 1 to >> 10"); >> } >> >> Opinions? >> >> >> >> >> >> _______________________________________________ >> phobos mailing list >> phobos at puremagic.com >> http://lists.puremagic.com/mailman/listinfo/phobos >> > _______________________________________________ > phobos mailing list > phobos at puremagic.com > http://lists.puremagic.com/mailman/listinfo/phobos > -- Liberty means responsibility. That is why most men dread it. - George Bernard Shaw -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20100914/6d1dbf09/attachment.html> |
Copyright © 1999-2021 by the D Language Foundation