Closed not-an-aardvark closed 6 years ago
It enables custom control structures that resemble syntactically built-in ones.
Or kotlin-style DSLs like the following:
Which are substantially different (visually) from callbacks.
Does that sound like a reasonable distinction?
On Wed, Nov 15, 2017 at 4:12 PM, Teddy Katz notifications@github.com wrote:
The readme says that under this proposal, code like this:
a("hello") { / ... / }
is desugared to code like this:
a("hello", function() { / ... / });
Aside from saving a few characters, is there an advantage to using a block param over using a callback function? I'm confused about how block params would "enable DSLs" if they're just a less verbose way to do something which is already possible. For example, it seems like lock https://github.com/samuelgoto/proposal-block-params/tree/8b33d26659b5f4ac33c3202e41045b27966ec2d7#lock demo in the readme would already be possible by using something like this:
lock(resource, () => { resource.kill(); });
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/samuelgoto/proposal-block-params/issues/19, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqV6j6OxU-iHjCLM1wE9as_WvXZ-RArks5s2331gaJpZM4QfxXu .
-- f u cn rd ths u cn b a gd prgmr !
That makes sense, thanks for clarifying.
The readme says that under this proposal, code like this:
is desugared to code like this:
Aside from saving a few characters, is there an advantage to using a block param over using a callback function? I'm confused about how block params would "enable DSLs" if they're just a less verbose way to do something which is already possible. For example, it seems like
lock
demo in the readme would already be possible by using something like this: