JuliaGeometry / JuliaGeometry/GeometryBasics.jl

ensure consistency among `Base.iterate` and `Base.in`

Open
#107 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
215
Forks
64
Avg merge
3d 18h
Merged PRs (30d)
2

Description

The definitions at

https://github.com/JuliaGeometry/GeometryBasics.jl/blob/234699e015ccb23bdaab26539dfc8fdfa9ff6add/src/basic_types.jl#L47-L49

are convenient, but they induce a non-geometric definition of Base.in, due to the fallback definition https://github.com/JuliaLang/julia/blob/4b739e711a7241f48ec0525e97c44cc870a9af99/base/operators.jl#L1109-L1120 and furthermore a geometric definition like the following

https://github.com/JuliaGeometry/GeometryTypes.jl/blob/4f1ba71d7df1341087f84974f869ea7a421eafa8/src/polygon.jl#L21-L28

are inconsistent with the documentation for Base.in. Since it is a shame to be inconsistent (because generic programs may break since they may rely on a consistency of iterate and in, and since it is a shame to lose the notation of point ∈ polygon, I propose ensuring that either

  1. a type represents an infinite set of points and does not implement iterate
  2. a type represents a finite set of points and implements iterate

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the definitions in src/basic_types.jl at the referenced lines, then compare Julia's Base.in fallback and the prior GeometryTypes.jl polygon definition. Determine how the affected geometry types should satisfy the proposed finite-set or infinite-set distinction, and confirm that iterate, in, and their documentation are consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
computer-graphics
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.