Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable osmosifying of raw functions #211

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

samogot
Copy link
Contributor

@samogot samogot commented May 13, 2018

There is a "feature" that any function passed as one of properties of
object parameters to any command is replaced with than command. It is
rather inconvenience than handy, because it makes imposible to use
contextCallbacks in set command using object syntax. If setting several
simple properties can be bypassed, by calling set command several times,
using contextCallbacks for nested properties is completely imposible.

It is uncertain what was the reason behind such behaviour. It's hard for
me imagine where sole than command may be usefull in set or any oter
command parameter context. It neither documented, nor covered by tests,
so the proposal is to remove this "feature". This may cause some
regressions in some existing code that relies on such behaviour (is such
code exists), but it will be rather easy to fix by calling then commad
explisitly.

This commit also fixes #203 as type: () => "some string" now works.

There is a "feature" that any function passed as one of properties of
object parameters to any command is replaced with than command. It is
rather inconvenience than handy, because it makes imposible to use
contextCallbacks in set command using object syntax. If setting several
simple properties can be bypassed, by calling set command several times,
using contextCallbacks for nested properties is completely imposible.

It is uncertain what was the reason behind such behaviour. It's hard for
me imagine where sole than command may be usefull in set or any oter
command parameter context. It neither documented, nor covered by tests,
so the proposal is to remove this "feature". This may cause some
regressions in some existing code that relies on such behaviour (is such
code exists), but it will be rather easy to fix by calling then commad
explisitly.

This commit also fixes rchipka#203 as `type: () => "some string"` now works.
@samogot samogot force-pushed the no-osmosifying-raw-functions branch from c482a8c to 984bd2c Compare November 13, 2018 10:08
@rchipka
Copy link
Owner

rchipka commented Nov 25, 2020

I believe the reason is because casting functions as .then() commands allows us to keep track of several things, like cloning and ref count of the data object, passing in context (this), and preserving data sort index.

I believe it is necessary and the tests should indicate as much, so if they aren't breaking with your changes they probably should.

That being said, the contextCallback functions should still work regardless of being deeply-nested in an object or array, even though they're casted to .then() commands.

@samogot
Copy link
Contributor Author

samogot commented Nov 25, 2020

Sorry, I don't even remember what it was about :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set {key: string }
2 participants