JoshCheek / seeing_is_believing

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

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

Closed JoshCheek closed 6 years ago

JoshCheek commented 6 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 6 years ago

It's a Ruby bug:

image