Skip to content

Reconsider usage of accessor properties #349

Closed

Description

@vanruesc

Is your feature request related to a problem?

Recent API refactoring replaced accessor properties and plain properties with methods. This will inadvertently increase the maintenance burden for maintainers of react-posprocessing if left as-is.

Describe the solution you'd like

Reconsider using a hybrid approach of methods and accessors properties if applicable.

Additional context

#279 (comment)

Activity

  1. drcmda commented on Feb 23, 2022

    @drcmda
    Member

    I'll copy the middle in here for reference:

    we won't be able to set and, more importantly, spread props over passes, we'll have to know all props beforehand and translate them to functions. functions cannot be expressed declaratively, they are not serializable either.

    good examples could be threejs, or the dom, they strike a sensible balance between atomics and more complex functions that will either carry out calculations or set multiple props at once. the upside for atomics is that they can easily by driven by state models and spread over the surface.

    another upside is maintenance for abstractions of pp. if pp updates and introduces a new atomic, say foo, the userland solution or library using it just needs to npm update and foo will work without having to adjust the abstraction.

    we are also publishing types for raw postprocessing, https://github.com/pmndrs/react-postprocessing/blob/master/types/postprocessing.d.ts that would be another "abstraction" that's currently quite simple to adjust.

  2. vanruesc commented on Feb 23, 2022

    @vanruesc
    MemberAuthor

    good examples could be threejs, or the dom, they strike a sensible balance between atomics and more complex functions that will either carry out calculations or set multiple props at once.

    That sounds reasonable. One motivation behind the move towards methods was that a lot of settings on effects need to trigger shader recompilations to take effect. Using method calls makes it clear that changes will be expensive as opposed to just changing the value of a seemingly harmless property.

  3. vanruesc commented on Mar 9, 2022

    @vanruesc
    MemberAuthor

    Getter and setter methods have been converted into accessor properties in [email protected]. I had my concerns regarding accessors, but it's ultimately ease-of-use and consistency that matters.

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

    enhancementEnhancement of existing functionality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions