Immer: README: Imperative programming

Created on 14 Sep 2018  Â·  2Comments  Â·  Source: immerjs/immer

Hi, this is a nice little library :)

It would be nice to have a section in the readme talking about the fact immer encourage imperative programming over declarative programming.

What do you think about that ?

Most helpful comment

Imperative versus declarative is unrelated syntax. Not using immer doesn't
make it more declarative, in contrast, if you want to make an argument
about that, I would argue that it makes it more declarative, as you are
closer to expression your goal without telling how the entire state tree
should be update to achieve that. But imho, imperative vs declarative is a
nonsense discussions if the difference is on the syntax and not on the
abstraction level

Op vr 14 sep. 2018 om 14:02 schreef Guillaume ARM <[email protected]

:

Hi, this is a nice little library :)

It would be nice to have a section in the readme talking about the fact
immer encourage imperative programming over declarative programming.

What do you think about that ?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/mweststrate/immer/issues/188, or mute the thread
https://github.com/notifications/unsubscribe-auth/ABvGhBoP_YDHkoO3rO7SY6rsuWWPu3raks5ua5q7gaJpZM4WpJZO
.

All 2 comments

Imperative versus declarative is unrelated syntax. Not using immer doesn't
make it more declarative, in contrast, if you want to make an argument
about that, I would argue that it makes it more declarative, as you are
closer to expression your goal without telling how the entire state tree
should be update to achieve that. But imho, imperative vs declarative is a
nonsense discussions if the difference is on the syntax and not on the
abstraction level

Op vr 14 sep. 2018 om 14:02 schreef Guillaume ARM <[email protected]

:

Hi, this is a nice little library :)

It would be nice to have a section in the readme talking about the fact
immer encourage imperative programming over declarative programming.

What do you think about that ?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/mweststrate/immer/issues/188, or mute the thread
https://github.com/notifications/unsubscribe-auth/ABvGhBoP_YDHkoO3rO7SY6rsuWWPu3raks5ua5q7gaJpZM4WpJZO
.

Immer provides a dirty hack that add ability to use imperative api instead of declarative. As a result many applications wants users to provide changes only instead of full property value. This hack works as a bridge between declarative and imperative programming.

The problem is that this hack forces user to provide a way of converting declarative application to imperative instead of application authors. This issue will be an example.

<Slate document={document} />

User is not able to provide new document to editor: slate is waiting for changes only. So slate user have to provide that changes himself: new input value -> find minimal changes required to make new document from prev document -> fight with DSU, etc -> provide changes.

I will warn react developers that his main declarative approach is not working anymore - users invented dirty hacks.

Was this page helpful?
0 / 5 - 0 ratings