Generator

=20
As it was brought to my attention, that the yield should not operate withou=
t the function* syntax in a regular function.
=20
With that said again:
=20
The ES5+ welcome the yield operand, not the function*
=20
Her is my argument for the proposal that will follow:
=20
=20
function r(){
     var i =3D 0, a =3D [0,9,8,7,6,5,4,3,2,1];  =20
     return (function (){return a.pop();});
 }
=20
var rr =3D r();
=20
function y(){
     let i =3D 0, a =3D [0,9,8,7,6,5,4,3,2,1];
     while(a){
         yield (a.pop());
     }
}
=20
let yy =3D y();
=20
function* g(){
     let i =3D 0, a =3D [0,9,8,7,6,5,4,3,2,1];
     while(a){
         yield (a.pop());
     }
}
=20
let gg =3D g();
=20
print("return: " + rr() + " " + rr() + " " + rr() + " " + rr() + " " + rr()=
 + " " + rr() + " " + rr() + " " + rr() + " " + rr() + " " + rr() + " " + r=
r()  + "\n" +
      "yield: " + yy.next() + " " + yy.next() + " " + yy.next() + " " + yy.=
next() + " " + yy.next() + " " + yy.next() + " " + yy.next() + " " + yy.nex=
t() + " " + yy.next() + " " + yy.next() + " " + yy.next() + "\n" +
      "function*: " + JSON.stringify([gg.next(), gg.next(), gg.next(), gg.n=
ext(), gg.next(), gg.next(), gg.next(), gg.next(), gg.next(), gg.next(), gg=
..next()]));
=20
/*
return: 1 2 3 4 5 6 7 8 9 0 undefined
yield: 1 2 3 4 5 6 7 8 9 0 undefined
function*: [{"value":1,"done":false},{"value":2,"done":false},{"value":3,"d=
one":false},{"value":4,"done":false},{"value":5,"done":false},{"value":6,"d=
one":false},{"value":7,"done":false},{"value":8,"done":false},{"value":9,"d=
one":false},{"value":0,"done":false},{"done":false}]
*/
=20
The above works great... and got me speculating that the yield contain a sc=
ope of its own... if what I display above should not fully work... it cause=
 of the change to the language that new possibility are possible that wasn'=
t before.
=20
If this is non - valet ES6 generator function... Consider adding this featu=
re to the spec:
=20
function y(){
     let i =3D 0, a =3D [0,9,8,7,6,5,4,3,2,1];
     while(a){
         yield (a.pop());
     }
}
=20
let yy =3D y();
=20
print("yield: " + yy.next() + " " + yy.next() + " " + yy.next() + " " + yy.=
next() + " " + yy.next() + " " + yy.next() + " " + yy.next() + " " + yy.nex=
t() + " " + yy.next() + " " + yy.next() + " " + yy.next());
=20
//yield: 1 2 3 4 5 6 7 8 9 0 undefined
=20
the above is much better and allow list to be done to get the value. Consid=
ering the way to the function* way, this way wins. I'm not suggestion to ge=
t rid of the function* but if this way is an... additional feature only exc=
lusive to that browser who allow it, then it should be included into the sp=
ec.... Especially when that browser is the one that is supporting this mail=
ing list.
=20
Ones people realize that one can use the yield operand -in this particular =
browser... which you are working with-- without the none ES5 syntax like fu=
nction*, they will wonder and question; why can't this be done in all brows=
er? Why is the browser that is help writing the spec isn't including this f=
eature into the spec as well? -and for those who was told this type of synt=
ax could not be done will be outrage--I though this wasn't possible, why is=
 this allow in the browser that is helping the most to write the spec but n=
ot in the spec? They will question, so rightful should. In this plantation =
it doesn't return an object but a value, so it's much concise.
=20
There are still some question that desire to be answer?
=20
Why:
=20
In some case when yield let say... this:
=20
function ask(){
         yield 1;
}
var why =3D ask();
why.next();why.next();
/*
Exception: [object StopIteration]
*/
=20
What is that empty -stringify it--exception object?
=20
Why isn't null or undefined, or even the false value return instead?
=20
An exception being throw denote that the problem is my serious, and in most=
 case, out of programmer hands to handle and most be dealt with via implant=
ation means. I request that is be change to a false value being thrown rath=
er than an exception for the none asterisk syntax style generator. And of c=
ourse that the none asterisk style syntax be adopted into the spec as well.=
   
0
epgajr
9/16/2014 9:21:10 PM
mozilla.dev.apps.firefox 3660 articles. 0 followers. Post Follow

0 Replies
752 Views

Similar Articles

[PageSpeed] 5
Get it on Google Play
Get it on Apple App Store

Reply:

Similar Artilces:

mzills.dev.apps.firefox crashes
dear group i am facing problem while i browse firefox it is crashes so plz suggest me for this problems most problem with utube site gaurav.............. Hi Gaurav, Please try using a beta of the next version of Firefox from = http://www.firefox.com/beta - this build includes protection from plugin = crashes. cheers, mike On 2010-06-19, at 3:26 AM, Gaurav Shelar wrote: > dear group i am facing problem while i browse firefox it is crashes > so plz suggest me for this problems most problem with utube site > gaurav.............. > _________________________...

App manager and Dev Apps
Hello, I am experiencing problems to debug apps loaded in the App Manager. I don't have this problem if the App is downloaded from the Marketpalce and debugged with the App Manager. Is there a known problem to debug Dev Apps, loaded from a directory in your computer? Thanks, Juanma ...

Send dev-apps-firefox mailing list submissions to
...

Resending an idea for app to app or multitasking navigation and homescreen mini apps for Firefox os
Hey Mozilla team, I have uploaded my ideas for Firefox os on tinypic.com as per your request. Here are the links: http://tinypic.com/r/9zyf74/6 and http://tinypic.com/r/r25eeh/6 Hope you guys like it, and if possible please do tell me what you guys think about it. :-) Yours Sincerely. Renault Ferns. ...

Communication by Firefox devs to add-on devs
The time has come for the developers of Firefox to start communicating with the developers of add-ons. As a case in point: Recently the classic.manifest file in fx3 has had a large number of override codes added to it that reassigned filenames from example.png to example-aero.png. Suddenly, all third-party themes in Vista are now missing buttons in a number of places - some of them not easy to spot (e.g. - the wrap icon that shows up only when you reach the bottom of a page in a page search). If one of the themers had not had a user using Vista who communicated with him, and if the t...

App needs to open other app (dev help)
Hi there, I have this app, which needs to open another app, and minimize the current = app. Its like you have a link to the app and when you click on it, it opens= it. How to do that in FF OS app? Would creating a href link a good idea? I= f not, then what is the correct way to do it? Thanks ...

Terminology
Hi all, I've been having interesting discussions about this recently, and = thinking about it a lot, so I thought I'd open it up to the wider = engagement community as I thought you might have some insight on this, = particularly the tech evangelists. I have been using "Open Web App" as a term to describe the kinds of web = experiences I am teaching people to create via the Apps documentation on = MDN (https://developer.mozilla.org/en-US/docs/Web/Apps). This includes = stuff like install API, manifests, priviledged APIs, etc. that are = currently only on Firefox ...

Firefox OS App Accounts Managed By Firefox Accounts
Hi Sync! tl;dr I want to allow users to setup email and calendar accounts with Firefox Accounts. How can we make that happen? My name is Gareth Aye and I work on the productivity group within gaia. We maintain the email and calendar apps. One core experience that we've built into both apps is account authorization. We'll likely always support an option to authorize email and calendar accounts in isolation from within the apps, but it'd be awesome if we could offer a more unified experience for users who want it. There are lots of service providers like Google, Yaho...

An idea for app to app or multitasking navigation for Firefox os
--e89a8f234665c811a204cafa5f03 Content-Type: text/plain; charset=ISO-8859-1 Hey Mozilla team, I'm Renault Ferns. I really like your Firefox os project. I just came up with an idea for app to app navigation or app multitasking navigation based on standard swipe gestures. I've explained my idea in the attached jpg image. I really would appreciate it if you guys would take a look at it. If possible please tell me what you guys think about it. Yours Sincerely. Renault. --e89a8f234665c811a204cafa5f03-- ...

Firefox or not Firefox
Name: M B Fletcher Email: mf38794atntlworlddotcom Product: Firefox Summary: Firefox or not Firefox Comments: You asked why I took it off but did not ask more than the basics. I put security but in fact I put on Fire fox today and found a GOOGLE front page for searching when I had nothing there before. I wondered if I had been hijacked or you had done a very stupid update. I still do not know for sure. I do not ever use Google that I know of. The biggest spy on computers in the world and you should know better. If I find it is correct on Firefox I will go back to IE. At...

firefox aurora app not capturing keyup event
I have some jQuery which binds a text field to a function handler for the keyup message. This code works fine in Firefox Mobile, but doesn't fire in the app/module mode of Aurora. So when I run my page in the standalone app mode that I installed via Aurora the event isn't registering. Is this a known issue? Or this there an intentional discrepancy? Thank you for any insight. James ...

Custom icon when using xulrunner app with Firefox using -app flag
Hi All, Trying to use Firefox instead of xulrunner to launch my application. Everything works fine except the custom icon my application has. Is there a way to have custom icon when we launch xul application using Firefox -app flag? Thanks in advance. Vivek Hi, Am 10.09.2013 21:04, ukdvivek@gmail.com wrote: > Trying to use Firefox instead of xulrunner to launch my application. > Everything works fine except the custom icon my application has. > > Is there a way to have custom icon when we launch xul application > using Firefox -app flag? You can use the...

firefox vs enigmail app / vista co-relation to firefox 3
Name: michael e. cotton Email: mcotton7atyahoodotcom Product: Firefox Summary: firefox vs enigmail app / vista co-relation to firefox 3 Comments: In the summary tells it all i believe that will vista co-relate to an future if not now upgrade of the firefox 3 platform,....also the application enigmail is in-compatible to vista off an firefox platform,..also the understanding is that app gnupg file (and there is an app for windows) a file much too large to download and use without possible bugs or incurring the resent ones. ...

First Pinoy-made Firefox OS App Lands at the Firefox Marketplace: RaffleHat
The *Mozilla Philippines Community Dev Team* headed by Mozilla Reps *Joell Lapitan* <http://twitter.com/jlapitan> and *Kevin John Ventura*<https://twitter.com/kjventura>are happy and proud to announce the availability of the very first Pinoy-made app found at the Firefox Marketplace: *RaffleHat*<https://marketplace.firefox.com/app/rafflehat> .. *RaffleHat* is a webapp created using *jQuery Mobile* and the *EventBrite API *to facilitate raffles (or draw lots) in an orderly and professional manner. If your event uses *EventBrite* <http://www.eventbrite.com>for ...

[Debrief] Firefox Apps Day Pune (App Day in a Box (ADIAB)), Pune, India
Debrief: Firefox Apps Day Pune (App Day in a Box (ADIAB)), Pune, India I and QaidJohar (FSA, VIIT Firefox Club) conducted one day workshop on FirefoxOS App Development on 15th March 2014 at VIIT Engg College, Pune, India. -= Audience and size =- There were 22 students who attended the App-hack-in-day one day workshop event. One of the participants came from Bangalore to attend the event. Remaining were Final Year (B.E) engineering students of Information Technology in VIIT, Pune. Overall, they seemed to have good knowledge of web technologies ( HTML, JavaScript) and intereste...

Web resources about - Generator - mozilla.dev.apps.firefox

Generator - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Android phone name generator
Just click on the logo. ∞ Read this on The Loop

out of office generator nails your vacation message
Next time you're on the way out of the office for a kick ass vacation, make sure you use this witty OOO generator brought to you by Westin Hotels. ...

Silicon Valley's elite startup generator is shaking up how it runs things
Silicon Valley's Y Combinator has reached its Alphabet moment. Last August, Google had become way more than a hub for internet searching so ...

Now THAT'S a generator test!
This rural county government doesn't have a lot of money for spare equipment which means an emergency generator for the data center isn't high ...

Trouble Coming Up with Ideas for Posts? Check Out This Generator
... Are Probably Doing With Your Car.” Easy huh? Now here’s a tool that will remove even that work from your part. It’s called Blog Idea Generator ...

UK Using Diesel Generators To Avoid Blackouts From Too Much Wind, Solar Energy
UK Using Diesel Generators To Avoid Blackouts From Too Much Wind, Solar Energy

Global revenues from diesel generator set installations expected to total US$538 billion from 2015-2024 ...
Reciprocating engine-based diesel gensets are among the fastest-selling, least expensive distributed generation (DG) technologies in the world ...

The Quest for the One True Static Site Generator
... and complexities of hosting providers and blogging engines. Somewhere last year I started to get interested by the rise of static site generators ...

Two White Tiger Cubs Die After Crimean Zoo Fails To Provide Generators For Warmth During Blackout
Two white tigers have reportedly died at a Crimean zoo during a two-week blackout, according to reports. Read more...

Resources last updated: 1/12/2016 7:24:42 PM