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

deprecate _capt and _expr #1

Closed
twada opened this issue Dec 4, 2015 · 3 comments
Closed

deprecate _capt and _expr #1

twada opened this issue Dec 4, 2015 · 3 comments

Comments

@twada
Copy link
Owner

twada commented Dec 4, 2015

_capt and _expr is now out of date in the destructuring era.
Seeking for a better way without them.

see: allow destructuring of t parameter. by jamestalmage · Pull Request #302 · sindresorhus/ava

@twada
Copy link
Owner Author

twada commented Dec 4, 2015

rough design

import assert from 'power-assert';
import _powerAssertCapture from 'power-assert-capturing';

assert(_powerAssertCapture(this, function (_capt) {
    return _capt(falsyStr, 'arguments/0');
}, {
    content: 'assert(falsyStr)',
    filepath: 'test/fixtures/Identifier/fixture.js',
    line: 3
}));

@jamestalmage
Copy link
Contributor

race condition: power-assert-js/empower#21 (comment)

While yours looks better, it won't work with async/await:

async function foo() {
   function bar() {
     // await will not work in here.
   }
}

We could do

assert(await _powerAssertCapture(this, ...))

But then you end up having to change how you do things in generators vs async functions vs synchronous functions.

@twada
Copy link
Owner Author

twada commented Jan 10, 2016

closed since Embed value capturing helper into transpiled code has landed

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

No branches or pull requests

2 participants