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

JSON_ARRAY JSON_VALUE returns #20

Open
phgachoud opened this issue Feb 26, 2020 · 4 comments
Open

JSON_ARRAY JSON_VALUE returns #20

phgachoud opened this issue Feb 26, 2020 · 4 comments

Comments

@phgachoud
Copy link
Contributor

Trying to inherit from JSON_ARRAY I'd like to have a MY_JSON_VALUE used in all the routines, so much as parameter than as return type. Was there a reason to make those types anchored and not like items.item ???

Any way to refactor it?
Pull request??

@jocelyn
Copy link
Member

jocelyn commented Feb 26, 2020

The lib sticks to the JSON specification, and the set of JSON values are limited.
So using JSON_VALUE sounds easier to read rather than like items.item

However, if this is possible, I invite you to send a pull request with what you have in mind, and maybe with an example.

@phgachoud
Copy link
Contributor Author

My point on this is

class MY_JSON_ARRAY

inherit
    JSON_ARRAY
        redefine
            items
        end

feature {NONE} -- Implementation

    items: ARRAYED_LIST[MY_JSON_VALUE]

end

instead of having to redefine everything because they are anchored types!

class MY_JSON_ARRAY

inherit
    JSON_ARRAY
        redefine
            items,
            put,
            ......
        end

feature {NONE} -- Implementation

    items: ARRAYED_LIST[MY_JSON_VALUE]

end

@jocelyn
Copy link
Member

jocelyn commented Mar 2, 2020

Ad what would be the additional value of MY_JSON_VALUE ?

@phgachoud
Copy link
Contributor Author

Ad what would be the additional value of MY_JSON_VALUE ?

None, actually I almost finished a pull request integrating the needs (or mines @least) for SCOOP integration. I'm in the process of testing them and will write you once done.

MY_JSON_VALUE was done only in the case no changes could have been done to JSON_VALUE

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

2 participants