I agree that It would be nice. However, unlike Enumerator, Enumerator::Lazy doesn't have enough information, so it needs to have some information only for inspect. Is it so important to make inspect rich?
I agree that It would be nice. However, unlike Enumerator, Enumerator::Lazy doesn't have enough information, so it needs to have some information only for inspect.
Is it so important to make inspect rich?
I'm not sure, but it would certainly be helpful when debugging.
On the other hand, if that would impact significantly performance or code (maintainability), it's probably not worth it.
I guess I'm not used to a core Ruby class without a nice #inspect.
This issue was solved with changeset r35124.
Benoit, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
enumerator (enumerator_inspect): include the original receiver and
method name of Enumerator::Lazy in the result of inspect. [ruby-core:43345] [Bug #6159]
enumerator (InitVM_Enumerator): don't use rb_define_alias for
some methods such as collect in order to make rb_frame_this_func()
return the correct method names.
I agree that It would be nice. However, unlike Enumerator, Enumerator::Lazy doesn't have enough information, so it needs to have some information only for inspect.
Is it so important to make inspect rich?
I'm not sure, but it would certainly be helpful when debugging.
On the other hand, if that would impact significantly performance or code (maintainability), it's probably not worth it.
I guess I'm not used to a core Ruby class without a nice #inspect.
I guess it wouldn't impact performance or maintainability so much, and fixed Enumerable::Lazy#inspect so that the following code:
I agree with you, as a core team member.
It is a simple and straightforward implementation.
But I also agree with Benoit, as a user.
The output is actually a bit verbose.
I guess the fault is the prefix "#<Enumerator::Lazy: ".
It is too long and unfriendly for human eyes.
I agree with you, as a core team member.
It is a simple and straightforward implementation.
But I also agree with Benoit, as a user.
The output is actually a bit verbose.
I guess the fault is the prefix "#<Enumerator::Lazy: ".
It is too long and unfriendly for human eyes.
Hmm...could you make a counter proposal? We may be able to choose a
shorter prefix such as "#<lazy", in which case, however, the class
name information would be lost.