From: "David A. Black" Date: 2004-02-20T20:54:31+09:00 Subject: Re: how to raise warning? Hi -- On Fri, 20 Feb 2004, Gavri Savio Fernandez wrote: > > From: Hal Fulton [mailto:hal9000@hypermetrics.com] > > Subject: Re: how to raise warning? > > > > 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). > > One of the main things I like about Ruby is that the names are so intuitive. [..] > Maybe there's a better way than Gavin's proposal (more mnemonic > names like 'warn_with_sourceinfo'. i know this name sucks but you > get the idea) but for now i prefer it his way: > warn "You didn't provide such and such" > warn "You didn't provide such and such", true I would love to see every case of boolean arguments (like "methods(true)") disappear from Ruby -- for exactly the reason you've given, namely that they're hard to understand and remember. I've always thought they should be split into separate methods. David -- David A. Black dblack@wobblini.net