From: Charles Comstock Date: 2004-02-21T08:09:52+09:00 Subject: Re: how to raise warning? Andrew Johnson wrote: > On Fri, 20 Feb 2004 17:25:17 +0900, Mark Hubbart wrote: > > >>I second that. Adding an optional boolean argument to the function to >>get different results doesn't quite seem rubyish to me. > > > Well, it's certainly not unprecedented in Ruby: > > Range.new(start, end, exclusive=false) > load(filename, wrap=false) > obj.respond_to?(symbol, include_private=false) > obj.private_methods(all=true) > obj.protected_methods(all=true) > obj.public_methods(all=true) > > > regards, > andrew > Right but not in things that print strings, the precedent there is not to use a boolean argument, since often you want to print multiple things. I like the warn! idea though. I would however say, that this is the classic use of a macro. Most other uses of macro's we can replace with a call to eval. But we lose the ability to do inplace code expansion which is so important for __LINE__ and things like that. That and there is a way in C that you can get something to print out the name of the variable. So you can have a macro that say: v = 5 but your macro just says DEBUGV(v); It seems like we might be able to do something like that with a symbol, but I haven't figured out how. Charlie