[#14696] Inconsistency in rescuability of "return" — Charles Oliver Nutter <charles.nutter@...>

Why can you not rescue return, break, etc when they are within

21 messages 2008/01/02
[#14699] Re: Inconsistency in rescuability of "return" — Gary Wright <gwtmp01@...> 2008/01/02

[#14738] Enumerable#zip Needs Love — James Gray <james@...>

The community has been building a Ruby 1.9 compatibility tip list on

15 messages 2008/01/03
[#14755] Re: Enumerable#zip Needs Love — Martin Duerst <duerst@...> 2008/01/04

Hello James,

[#14772] Manual Memory Management — Pramukta Kumar <prak@...>

I was thinking it would be nice to be able to free large objects at

36 messages 2008/01/04
[#14788] Re: Manual Memory Management — Marcin Raczkowski <mailing.mr@...> 2008/01/05

I would only like to add that RMgick for example provides free method to

[#14824] Re: Manual Memory Management — MenTaLguY <mental@...> 2008/01/07

On Sat, 5 Jan 2008 15:49:30 +0900, Marcin Raczkowski <mailing.mr@gmail.com> wrote:

[#14825] Re: Manual Memory Management — "Evan Weaver" <evan@...> 2008/01/07

Python supports 'del reference', which decrements the reference

[#14838] Re: Manual Memory Management — Marcin Raczkowski <mailing.mr@...> 2008/01/08

Evan Weaver wrote:

[#14911] Draft of some pages about encoding in Ruby 1.9 — Dave Thomas <dave@...>

Folks:

24 messages 2008/01/10

[#14976] nil encoding as synonym for binary encoding — David Flanagan <david@...>

The following just appeared in the ChangeLog

37 messages 2008/01/11
[#14977] Re: nil encoding as synonym for binary encoding — Yukihiro Matsumoto <matz@...> 2008/01/11

Hi,

[#14978] Re: nil encoding as synonym for binary encoding — Dave Thomas <dave@...> 2008/01/11

[#14979] Re: nil encoding as synonym for binary encoding — David Flanagan <david@...> 2008/01/11

Dave Thomas wrote:

[#14993] Re: nil encoding as synonym for binary encoding — Dave Thomas <dave@...> 2008/01/11

[#14980] Re: nil encoding as synonym for binary encoding — Gary Wright <gwtmp01@...> 2008/01/11

[#14981] Re: nil encoding as synonym for binary encoding — Yukihiro Matsumoto <matz@...> 2008/01/11

Hi,

[#14995] Re: nil encoding as synonym for binary encoding — David Flanagan <david@...> 2008/01/11

Yukihiro Matsumoto writes:

[#15050] how to "borrow" the RDoc::RubyParser and HTMLGenerator — Phlip <phlip2005@...>

Core Rubies:

17 messages 2008/01/13
[#15060] Re: how to "borrow" the RDoc::RubyParser and HTMLGenerator — Eric Hodel <drbrain@...7.net> 2008/01/14

On Jan 13, 2008, at 08:54 AM, Phlip wrote:

[#15062] Re: how to "borrow" the RDoc::RubyParser and HTMLGenerator — Phlip <phlip2005@...> 2008/01/14

Eric Hodel wrote:

[#15073] Re: how to "borrow" the RDoc::RubyParser and HTMLGenerator — Eric Hodel <drbrain@...7.net> 2008/01/14

On Jan 13, 2008, at 20:35 PM, Phlip wrote:

[#15185] Friendlier methods to compare two Time objects — "Jim Cropcho" <jim.cropcho@...>

Hello,

10 messages 2008/01/22

[#15194] Can large scale projects be successful implemented around a dynamic programming language? — Jordi <mumismo@...>

A good article I have found (may have been linked by slashdot, don't know)

8 messages 2008/01/24

[#15248] Symbol#empty? ? — "David A. Black" <dblack@...>

Hi --

24 messages 2008/01/28
[#15250] Re: Symbol#empty? ? — Yukihiro Matsumoto <matz@...> 2008/01/28

Hi,

line event weirdness on if statements. Program to show trace event lines

From: "Rocky Bernstein" <rocky.bernstein@...>
Date: 2008-01-27 12:29:20 UTC
List: ruby-core #15231
Recently I've been working on a module which will show all the trace event
line calls in a Ruby program. This is useful  in a debugger to determine if
it makes sense to set a breakpoint on a line. It may also be helpful in
other programs like rcov which is trying to figure out if all traceable
lines are executed.

In testing things, I came across the following weirdness. (Or is it a bug?)
I've long noticed that on conditional statements like "if", "until" or
"while", the line event gets called twice on somewhere in the condition. I
had sort of rationalized it as a call before the condition got executed and
a call afterwards. However this doesn't seem to be true as the following
example shows:

  x=2
  x=3 if x='a' or
    true

If you debug this there are two stops on the line with "true".  The first
surprise I have is why there is no stop on the line with x=3. But the second
surprise is that even after the first line event on that statement and
before the second line event, the value of x still is what it was before: 2.
So therefore one wonders what the value is of having two line events here
is.

I'd be happy to try to patch the code (presumably eval.c) if it is desired
to change this behavior.

In Ruby 1.9 when I try this I don't get any trace lines listed at all using
tracer.rb even though I get call/return event lines. I thought it might have
something to do with optimizing the condition, but then I don't get a trace
line for x=2 either and I've tried modifying the condition using more
dynamic variables. I may have made a mistake here; I don't have
1.9installed am running out of a compiled source tree. I'd appreciate
it if
others with 1.9 try this and let me know how 1.9 handles line number trace
events on conditional statements.

- - -
I could use some help finding bugs in  the code to list a Ruby program's
trace event line numbers. To check out the code:
svn checkout
svn://rubyforge.org/var/svn/rocky-hacks/linecache/linecache/trunk<http://rubyforge.org/projects/rocky-hacks/>

(Sorry no home page yet.) The above example in a slightly different form is
test/data/if5.rb

After building the code you can pick your favorite Ruby program to try and
use lnum-diag.rb to show output and
compare. Here's a run on that data/if5.rb program;

./lnum-diag.rb -P data/if5.rb
data/if5.rb
================================================================================
# [2, 4, 4]
x=2
x=3 if x='a' or
  false
# What's weird here is we get two stops on line 4 and both times x is
# 4. In Ruby 1.9 we don't get *any* line traces.

================================================================================
./data/if5.rb:3: warning: found = in conditional, should be ==
#0:./data/if5.rb:2::-: x=2
#0:./data/if5.rb:4::-:   false
#0:./data/if5.rb:4::-:   false
(numbers_for_str):3: warning: found = in conditional, should be ==
expecting: [2, 4, 4]
--------------------------------------------------------------------------------
Got what was expected.

lnum_diag.rb has options to turn on or off some of the output below. See
it's --help for those options.

Thanks.

In This Thread

Prev Next