samuelgoto / proposal-block-params

A syntactical simplification in JS to enable DSLs
204 stars 8 forks source link

Yield handling in JS #31

Closed rajasekarm closed 3 years ago

rajasekarm commented 6 years ago

I'm planning to port block params proposal in babel. I've one doubt.

Let's take ruby,

def iffy(condition) 
  if (condition) then
    yield()
  end
end 

iffy(true) {
  // do something
}

Like wise, how block params will be called in the parent function?

samuelgoto commented 6 years ago

There are two formulations for yield:

(1) throw SyntaxError and disallow (2) support yield()

I'd assume (1) for now while we sort how (2) works.

On Tue, Dec 12, 2017 at 5:12 AM, Raja Sekar notifications@github.com wrote:

I'm planning to port block params proposal in babal. I've one doubt.

Let's take ruby,

def iffy(condition) if (condition) then yield() endend

iffy(true) { // do something }

Like wise, how block params will be called in the parent function?

— 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/31, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqV6r-LMrVO3o9Gl_TJd1n_ahZTBseYks5s_nvCgaJpZM4Q-8qm .

-- f u cn rd ths u cn b a gd prgmr !