JoshCheek / seeing_is_believing

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

Void Value Expressions #87

Closed JoshCheek closed 6 years ago

JoshCheek commented 7 years ago

-.-

class Fixnum
  undef <
  undef <<
  undef ==
  undef to_s
  remove_method next
  undef inspect
end
"a"

# !> f7.rb:6: void value expression
# !>   $SiB.record_result(:inspect, 6, (remove_method next))
# !>                                                       ^
# !> /Users/josh/code/seeing_is_believing/lib/seeing_is_believing/event_stream/producer.rb:87:in `record_exception': undefined method `size' for nil:NilClass (NoMethodError)
# !> \tfrom /Users/josh/code/seeing_is_believing/lib/seeing_is_believing/the_matrix.rb:75:in `block in <top (required)>'
JoshCheek commented 7 years ago

Not sure I care about this one, it's an error in the code that I gave to SiB. Essentially, it should have printed the error that Ruby prints here rather than evaluating it. But do I really want to try to figure out whether the user has void value violation in their code as I walk the AST? Prob not but maybe.

$ cat f8.rb
a next

$ ruby f8.rb
f8.rb:1: void value expression

$ bin/seeing_is_believing f8.rb
a next

# !> f8.rb:1: void value expression
# !> $SiB.record_result(:inspect, 1, (a next))
# !>                                         ^
# !> /Users/josh/code/seeing_is_believing/lib/seeing_is_believing/event_stream/producer.rb:86:in `record_exception': undefined method `size' for nil:NilClass (NoMethodError)
# !> \tfrom /Users/josh/code/seeing_is_believing/lib/seeing_is_believing/the_matrix.rb:69:in `block in <top (required)>'
JoshCheek commented 6 years ago

No. Nah. Ain't nobody got time for that.