Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usability: Segments that can't have children raise NoMethodError #39

Open
untoldone opened this issue Oct 1, 2014 · 3 comments
Open
Assignees
Labels

Comments

@untoldone
Copy link

While segments with children respond to :children, segments (such as MSH) do not. This seemed to not match my abstraction usability expectation. With the current implementation, I'll have to write code to detect if Segment has a child or not rather than just getting no children.

I do see that there is a :has_children? method which helps, but it just feels off to have to call a method like this to prevent this type of StandardError.

@mogox mogox added the Bug label Oct 1, 2014
@mogox
Copy link
Member

mogox commented Jan 25, 2015

I agree this is an issue, I've seen it more than a few times, we probably want to fix this in a major release.
I think the solution is always have children and treat it as an empty collection for segments which do not have one. I believe this would be change that will break compatibility for those who depend on the method children being only available for segments with children.

What do you think @Stratus3D ?

@untoldone
Copy link
Author

One thought: You could always add another method in addition to children to avoid the reverse compat issue and depreciate children.

@mogox mogox self-assigned this Jan 27, 2015
@mogox
Copy link
Member

mogox commented Jan 27, 2015

That's an excellent idea @untoldone. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants