JoshCheek / seeing_is_believing

Displays the results of every line of code in your file
1.3k stars 54 forks source link

Incorrect output (prob b/c I modified $/) #144

Closed JoshCheek closed 5 years ago

JoshCheek commented 5 years ago

Three "the roof" in SiB's output, but only 2 in Ruby's. Prob SiB uses $/ somewhere.

#!/usr/bin/env ruby -W0

public def !
  gsub(/ +|#$//,%/ /)
end

class Symbol
  else
  def

  <<* w,t:?f
  yield end.
  << do raise +$/+

  ! <<-"the roof."
        the roof
        the roof.
end

end rescue begin # just to be cute

$><<%!#$!!*-~-~$.<<!!%!

is
on
fire!

puts end

# >> 
# >>  the roof 
# >>  the roof 
# >>  the roof  is on fire
JoshCheek commented 5 years ago

It's a Ruby bug:

image