Skip to content

Conversation

@devreal
Copy link
Member

@devreal devreal commented Oct 17, 2017

Changes to GlobRef:

  1. Remove reference-based comparison operator to perform value-based comparison and allow a test like arr[0] == arr[1] to succeed. Add test. See also Fix GlobAsyncRef #447
  2. Remove postfix increment/decrement operators because their semantic cannot be correctly implemented, i.e., (arr[0]++)++ will not perform two increments and return the result of the first increment. It's better to error-out than to yield incorrect results. After thinking about this again I realized that it's perfectly reasonable to have these operators on global references as they return a value and not a reference and (arr[0]++)++ is illegal anyway. Re-added the operators.

@devreal
Copy link
Member Author

devreal commented Oct 17, 2017

Fix for the failing test case is contained in #447

@fuchsto
Copy link
Member

fuchsto commented Oct 17, 2017

The increment-operator issue is a really good catch. The same situation with operator+=, and any operator@= for that matter. For asyncs, these should return a future on the operation. I will meditate on that.

@devreal
Copy link
Member Author

devreal commented Oct 19, 2017

The same situation with operator+=, and any operator@= for that matter.

Not sure I can follow: operator+= should return the result of the addition-assignment so returning a reference should work as expected. The catch really only is the postfix increment since that is supposed to return the previous state, which cannot be done by returning a reference.

@fmoessbauer fmoessbauer merged commit 11f6714 into development Nov 20, 2017
@fmoessbauer fmoessbauer deleted the dash-globref-compare branch November 20, 2017 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants