Skip to content

Avoid or clarify possible pun on Base.parent #80

Open

Description

@goretkin

Base.parent(root::BinaryNode, node::BinaryNode) = isdefined(node, :parent) ? node.parent : nothing

The definition doesn't seem to be used, and I'm not sure what it illustrates. In any case, this seems to be a pun on Base.parent:

help?> parent
[...]
  parent(A)

  Return the underlying "parent array”. This parent array of objects of types SubArray, ReshapedArray or LinearAlgebra.Transpose is what was passed as an argument to view, reshape,
  transpose, etc. during object creation. If the input is not a wrapped object, return the input itself.

Activity

  1. jlumpe commented on Apr 27, 2021

    @jlumpe
    Collaborator

    The parent API hasn't really been strictly defined yet, so I agree that Base.parent shouldn't be used for getting the parent of a node. I plan to submit a PR for that sometime in the near future in which it's a separate function.

  2. BenjaminDoran commented on Dec 19, 2025

    @BenjaminDoran

    Any update on this? ExplicitImports notes that AbstractTrees.parent is not exported or public. Is this a public function, or should it be treated as package internals?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions