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

Ruby 2.5 Warnings on Data classes #96

Open
grncdr opened this issue Mar 14, 2018 · 4 comments
Open

Ruby 2.5 Warnings on Data classes #96

grncdr opened this issue Mar 14, 2018 · 4 comments

Comments

@grncdr
Copy link

grncdr commented Mar 14, 2018

The docs recommend inheriting from Data following this idiom:

let data_class = Class::from_existing("Data");
Class::new("MyClass", Some(&Data)).define(...)

On Ruby 2.5, this prints warning: constant ::Data is deprecated every time Data is accessed. I guess that there is some way to access this via the C extension API but I haven't found it yet.

@danielpclark
Copy link
Contributor

This isn't a ruru issue unless you're specifically saying that ruru's docs are suggesting the use of Data.

As for using Data it is depricated. You can see the discussion on the Ruby Bug Tracker # 3072. That will also have the relevant information you're looking for on what you can use instead.

@asppsa
Copy link

asppsa commented Apr 2, 2018

As per https://github.com/d-unseductable/ruru/blob/master/src/dsl.rs#L392, the documentation actually currently says that Data must be used.

@danielpclark
Copy link
Contributor

Thanks for pointing that out @asppsa . I haven't yet come across a need for using it so I'm not sure at the moment about implementing an alternative.

@danielpclark
Copy link
Contributor

danielpclark commented Jun 20, 2018

I tried switching everything over from Data to Object in ruru and that works (doc tests pass). That is what Ruby is officially doing:

Agreed. How about making Data alias to Object.
It may be removed in the future (3.0?).

Matz.

source: https://bugs.ruby-lang.org/issues/3072#note-15

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

No branches or pull requests

3 participants