From: Jim Cropcho Date: 2008-01-29T07:09:49+09:00 Subject: Re: a new kind of assertion ------=_Part_11190_32146985.1201558195824 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline @ Alex: I think that's exactly what we're talking about, although the scope (just assertions) is limited. I guess I didn't think about how succinct something like that could be :) Regardless, there would be benefits of standardization, were the functionality added to the core. On Jan 28, 2008 4:40 PM, Alex Young wrote: > Jim Cropcho wrote: > > +1 > > > > and... > > > > > Ruby might also need > > > the ability to make certain code disappear, efficiently, when > > "compiled in > > > release mode", or our equivalent. > > > > I've thought that would be cool, too. Perhaps it could be built in-part > > out of Logger, so that a line of code would conditionally execute based > > on levels like 'info', 'debug', etc. > > def runtime_assert_(&block) > if block_given? && $DEBUG # or whatever > assert_ &block > end > end > > ? > > -- > Alex > > ------=_Part_11190_32146985.1201558195824 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline @ Alex: I think that's exactly what we're talking about, although the scope (just assertions) is limited. I guess I didn't think about how succinct something like that could be :) Regardless, there would be benefits of standardization, were the functionality added to the core.

On Jan 28, 2008 4:40 PM, Alex Young <alex@blackkettle.org> wrote:
Jim Cropcho wrote:
> +1
>
> and...
>
>  > Ruby might also need
>  > the ability to make certain code disappear, efficiently, when
> "compiled in
>  > release mode", or our equivalent.
>
> I've thought that would be cool, too. Perhaps it could be built in-part
> out of Logger, so that a line of code would conditionally execute based
> on levels like 'info', 'debug', etc.

def runtime_assert_(&block)
  if block_given? && $DEBUG # or whatever
    assert_ &block
  end
end

?

--
Alex


------=_Part_11190_32146985.1201558195824--