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

Should we deprecate encapsulation violation as an API? #18

Open
dagolden opened this issue Oct 28, 2013 · 4 comments
Open

Should we deprecate encapsulation violation as an API? #18

dagolden opened this issue Oct 28, 2013 · 4 comments
Labels

Comments

@dagolden
Copy link

Right now, YAML::Tiny is a blessed arrayref and encourages users to access it directly to get at documents.

In the future, Ingy has indicated that YAML will have an OO API, not a functional one.

By encouraging encapsulation violation, we lock YAML::Tiny into one and only one OO model, which severely limits future options.

For version 2, should we deprecate direct access? (E.g. overload array deref to warn. This would prepare YAML::Tiny for a future OO model not tied to direct arrayref access.

@jkeenan
Copy link
Contributor

jkeenan commented Oct 28, 2013

On 10/28/13 9:15 AM, David Golden wrote:

Right now, YAML::Tiny is a blessed arrayref and encourages users to access it directly to get at documents.

Can you provide an example of where the codebase or the documentation
actually "encourages" users to do this? When I was studying the code
recently no light went off in my head concerning this.

Thank you very much.
Jim Keenan

@dagolden
Copy link
Author

The whole SYNOPSIS is full of $yaml->[0]->{foo} examples.

@adamkennedy
Copy link
Member

If we leave things the way they are, consumers of YAML:Tiny need to
migrate their code once. If we introduce a new API now, and it's
different in any way from the final form of YAML, consumers need to
migrate twice.

Also, the current approach was specifically taken to avoid the weight of an
API.
On Oct 28, 2013 6:15 AM, "David Golden" [email protected] wrote:

Right now, YAML::Tiny is a blessed arrayref and encourages users to access
it directly to get at documents.

In the future, Ingy has indicated that YAML will have an OO API, not a
functional one.

By encouraging encapsulation violation, we lock YAML::Tiny into one and
only one OO model, which severely limits future options.

For version 2, should we deprecate direct access? (E.g. overload array
deref to warn. This would prepare YAML::Tiny for a future OO model not tied
to direct arrayref access.


Reply to this email directly or view it on GitHubhttps://github.com//issues/18
.

@dagolden
Copy link
Author

Fair enough. I'll move this off the 2.00 milestone list, but keep it as a reminder for later.

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