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

Core/Array: reset #81

Open
nkkollaw opened this issue Aug 2, 2017 · 6 comments
Open

Core/Array: reset #81

nkkollaw opened this issue Aug 2, 2017 · 6 comments

Comments

@nkkollaw
Copy link
Owner

nkkollaw commented Aug 2, 2017

No description provided.

@nkkollaw
Copy link
Owner Author

nkkollaw commented Aug 7, 2017

As discussed, this function needs its parameter to be passed by reference.

What to do, considering that we're trying to avoid that? I think this is a gotcha but we'd have to do by reference.

@ddziaduch
Copy link
Contributor

@nkkollaw I don't see any other option that sticking to the reference

@radmen
Copy link
Contributor

radmen commented Aug 16, 2017

What to do, considering that we're trying to avoid that? I think this is a gotcha but we'd have to do by reference.

The question is more general - should the wrapper function be pure? If so it means that some native functions (like reset(), key(), current()) will be broken "by design".

If the answer is no - I wouldn't bother with passing variables as references.

@nkkollaw
Copy link
Owner Author

In this case, the only purpose of the functions is to modify the element passed, so it kind of makes sense.

Implementing without passing by reference wouldn't work IMO.

I would definitely add it to the documentation as a gotcha, but I think we should make ot work like the original.

@Petah
Copy link

Petah commented Aug 16, 2017

the only purpose of the functions is to modify the element passed

Its not always the only purpose. For example end also returns the last element of the array (as well as setting the pointer to the end).

@nkkollaw
Copy link
Owner Author

Definitely. I meant that if you take that aspect away, the function doesn't make much sense.

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

No branches or pull requests

4 participants