On 10/8/2013 12:34 PM, Gregory Szorc wrote:
Also, this JS is invalid because a generator function cannot return a
value through "return." For people learning at home, a working
implementation is:
function add2(a, b) {
return Task.spawn(function () {
let sum = yield a + b;
throw new T
On Tue, Oct 8, 2013 at 12:34 PM, Gregory Szorc wrote:
> On 10/8/13 9:14 PM, Dave Townsend wrote:
>
>> I was asked to clarify what I meant by my two examples so here are some
>> snippets of code that illustrate it. This is forcibly async but you get
>> the
>> point I hope. If you want to add three
On 10/8/13 9:14 PM, Dave Townsend wrote:
I was asked to clarify what I meant by my two examples so here are some
snippets of code that illustrate it. This is forcibly async but you get the
point I hope. If you want to add three numbers you can define:
function add3(foo, bar, baz) {
return Tas
> I'm going to claim that the latter method of returning a new task promise
> is the one we should use in general. It makes the function more easily
> usable outside of a task since you're just getting a promise back. It is
> also what Task.jsm does internally for generators anyway.
I fully agree
On Tue, Oct 8, 2013 at 12:20 PM, Ted Mielczarek wrote:
> On 10/8/2013 3:14 PM, Dave Townsend wrote:
> > I was asked to clarify what I meant by my two examples so here are some
> > snippets of code that illustrate it. This is forcibly async but you get
> the
> > point I hope. If you want to add th
On 10/8/2013 3:14 PM, Dave Townsend wrote:
> I was asked to clarify what I meant by my two examples so here are some
> snippets of code that illustrate it. This is forcibly async but you get the
> point I hope. If you want to add three numbers you can define:
>
> function add3(foo, bar, baz) {
>
I was asked to clarify what I meant by my two examples so here are some
snippets of code that illustrate it. This is forcibly async but you get the
point I hope. If you want to add three numbers you can define:
function add3(foo, bar, baz) {
return Task.spawn(() => {
let sum = yield add2(foo
On 10/08/2013 12:00 PM, dev-platform-requ...@lists.mozilla.org wrote:
Message: 7
Date: Tue, 8 Oct 2013 11:47:52 -0700
From: Dave Townsend
To: dev-platform
Subject: Coding style for functions called by Task.jsm tasks
Message-ID:
Content-Type: text/plain; charset=ISO-8859-1
As Task.jsm
8 matches
Mail list logo