Skip to content

Conversation

@mcabbott
Copy link
Member

@mcabbott mcabbott commented Nov 14, 2022

Closes #46

Is this going to have any surprising consequences?

Note that @functor cannot go the other way, and use getproperty/ propertynames for everything, as that needs an instance not the type.

(Could add tests but they'd be kind-of contrived, I mean all existing tests check that this runs, new ones would only check against someone editing these lines back to getproperty.)

Copy link
Member

@ToucheSir ToucheSir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Slightly off topic, is there a way to add an org-wide breaking label so we can track what goes into such releases? And/or maybe we should use milestones?

@mcabbott
Copy link
Member Author

Could do milestones. Flux seems messy enough that they help, perhaps this is simple enough not to?

@mcabbott mcabbott merged commit 75fef99 into FluxML:master Nov 15, 2022
@mcabbott mcabbott deleted the getfield branch November 15, 2022 00:06
@CarloLucibello CarloLucibello added this to the v0.4 milestone Nov 15, 2022
@mcabbott
Copy link
Member Author

This breaks the following use, which relies on Tangent overloading getproperty:

julia> using ChainRulesCore

julia> x = (a = 1,);

julia> gx = ProjectTo(x)((a=0.1,))
Tangent{NamedTuple{(:a,), Tuple{Int64}}}(a = 0.1,)

julia> gx.a
0.1

julia> functor(typeof(x), gx)
ERROR: type Tangent has no field a

I think that means we should revert it. It will break Optimisers + non-Zygote completely.

mcabbott added a commit to mcabbott/Functors.jl that referenced this pull request Nov 15, 2022
mcabbott added a commit that referenced this pull request Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@functor is confused about properties vs fields

3 participants