Closed JoshCheek closed 7 years ago
+1
I've added this as a feature and turned it on by default (I try to make the defaults what I think most people would want it to do rather than avoiding change -- if avoidance of change is desired, there are flags to explicitly set a default).
It works on both normal SiB and xmpfilter style. @avdi and @jcinnamond if you wouldn't mind installing it locally and letting me know if it's better or worse / if there are changes I should make, I'd appreciate it (clone, gem build seeing_is_believing.gemspec
, gem install seeing_is_believing-3.0.1.gem
).
I just kept winding up wanting to show how results on one line matched up with results on the next, but their inspected value didn't line up, so I wound up editing the comments by hand on many occasions.
If it annoys you, you can turn it off with the --no-interline-align
option.
The feature is here for SiB style and here for xmpfilter style.
Other recent changes:
You can generally fuck with the environment without SiB breaking (there were a few I couldn't get), the most common example was when I was trying to show people that they could make their own Class.new
, it used to break SiB (SiB instantiated classes, which would get recorded, which would instantiate classes, which would... eventually this would overflow the stack)
class Class
def new(*args, &block)
instance = allocate # => #<A:0x007f883386ec88>
instance.__send__(:initialize, *args, &block) # => 123
instance # => #<A:0x007f883386ec88 @arg=123>
end # => :new
end # => :new
class A
attr_reader :arg # => nil
def initialize(arg)
@arg = arg # => 123
end # => :initialize
end # => :initialize
A.new(123).arg # => 123
I haven't released it yet, so there is time to change defaults.
Eg, consider this program
It would be nice for the outputs to line up, like so: