From: jrb3@... Date: 2004-02-21T02:02:11+09:00 Subject: Re: how to raise warning? >> I don't. A warning is often a user-level piece of information that does >> not warrant file and line information. >> >> Having a variant of 'warn' that displays that information would be nice >> IMO. >> >> warn "You didn't provide such and such", true > > Mmm. I would expect that just to print 'true' after the warning. > > The problem as I see it is that we use warnings in two ways: > 1. As Ruby does, to complain about something happening at a specific > place in the source -- a highly source-related message. In that > case, I'd want to see file/line info (as Ruby does when it says I > need to add parens or something). > 2. To complain about some general condition occurring at runtime that > doesn't warrant bailing out of the app. > > My suggestion: Two names. Call the first one "warning" (the kind of > warning that Ruby gives us) and the second one "warn" (a simple verb > that just prints to stderr). Well, I use 'fyi' for the second (acronym common in the United States standing for "For Your Information"). Since the application name tends to be more interesting than the file and line information for the end-user, I have the application name in the output. --- def fyi( *message ) puts( "#{}: FYI: " + message.join('\n\t') ) end fyi "Hi Mom!" "Love you much!" --> whatYouInvoked: FYI: Hi Mom! Love you much! --- If I really do want the file/line info, I add that into an exception, throw it, and catch it for display (or logging) elsewhere. Joseph Beckenbach lead XP tester, Eidogen Inc.