Wednesday, April 07, 2010

Delimited continuations? In ECMAScript?

Well, no.

Besides breaking a lot of language invariants, first-class continuations would be a nightmare for portability, since different implementations implement different API's natively. Either you mandate capturing continuations across native frames, which is a hardship for implementers and a performance-killer, or you don't, which causes observably different behavior across browsers when they place native delimiters at different points in the continuations-- leading to lots of painful bug reports and nasty market dynamics where everyone has to tailor their implementations to track the most popular.

So that won't happen. But!

JS 1.7 introduced Pythonic generators, which allow you to suspend a single function activation. This alleviates some of the painful CPS patterns people have to use on the web to interact with the event-loop-concurrent, single-thread-of-control semantics of JavaScript on the web. But it's also a little ad hoc. And Kris Zyp recently made the helpful suggestion that we could explore a design for a simpler, more general single-frame continuation-capture operation for Harmony.

What we're talking about here is a restricted version of delimited continuations: the delimiters are implicit--they're at function boundaries. But otherwise it's very much in that space. And there's a loooot of prior work on this topic. I'll post later with a little background and some notes about the design space of delimited continuations for ES.

68 comments:

Mitch said...

I think I understand scheme's call/cc, and I was really excited originally to hear that kind of thing proposed for ES. Then later, on LTU, Brendan explained the script/native/script thing and I was sad.

I don't really get delimited continuations yet, I've seen Oleg Kiselyov posting about them a lot but I don't understand just about everything he writes. Still, it's really exciting to see some kind of continuations show up again in ES context; I haven't really followed the ES email lists for a while but maybe it's time to start reading them again.

TL;DR - Yay!

jto said...

I think Lars Thomas Hansen's complaint about single-frame continuations is that they break lambda abstraction. Beta reduction changes the meaning. What do you think about that?

Dave Herman said...

Lars Thomas Hansen's complaint about single-frame continuations is that they break lambda abstraction.

Well, full continuations certainly do expose details of lambda abstractions. The main issue is if a library function takes a funarg and calls it, the funarg might capture the continuation and use it multiple times. (You can think of this as the funarg "highjacking" the control flow.) Turns out lots of standard Scheme libraries like map are buggy because they don't expect control to return multiple times.

I suspect the situation isn't as bad in the case of single-frame continuations, though. Did Lars tell you this in person, or is he on record somewhere publicly? I'm having drinks with him on Wednesday, so I'll ask him myself. :)

Beta reduction changes the meaning. What do you think about that?

Well, I'm not sure what you mean, exactly. The beta rule stays the same in the presence of call/cc. It just means that some of the invariants about function abstraction are gone.

Dave Herman said...

PS I should say, lots of implementations of standard Scheme libraries. Didn't mean to imply the spec is buggy.

jto said...

The beta rule stays the same in the presence of call/cc, yes. But not in the presence of single-frame continuations (or generators) because there every function call implicitly installs a delimiter.

EXPR

(function () { return EXPR; })()

I'm talking about the difference between these two in terms of what is captured if EXPR contains f->(x).

This is something lth mentioned to me while ES4 was going on. However now I'm a bit worried that I've misrepresented the importance of this objection compared to others; and it's been a year or two.

Dave Herman said...

I see what you're getting at now.

So first of all, there's no beta rule in JS, just an ad hoc semantics of functions, which are already exposed in the semantics: return is a delimited abort operation; arguments is function-specific; Function.arguments; Function.callee... heck, the spec even refers to function calls as "allocating an activation object" whose slots are the local variables.

That said, you're right that this hooks one more piece of semantics into the meaning of functions. If JS hadn't long ago already gone down this road in spades, I would whole-heartedly agree. (For example, it'd be a total non-starter for Scheme. And if the lambdas proposal weren't dead, they'd be specified not to be implicitly delimited.)

Another way of putting it: rather than "changing the beta rule" (which is just a reduction rule), this ruins beta-equivalence. But beta-equivalence already doesn't hold in JS.

Kanye Co Jamila said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Training in Chennai

john smith said...

Great post, Thank you for sharing this amazing post, I really appreciate your work.

norton.com/setup | office.com/setup | mcafee.com/activate

James Boond said...

Really great article, Glad to read the article. It is very informative for us. Thanks for posting

office.com/setup

mcafee.com/activate

mcafee.com/activate

norton.com/setup

alexathomson said...

Get comprehensive round-the clock QuickBooks Support for all issues. The QuickBooks technical support team offers immediate assistance and can be reached by calling the QuickBooks Support Toll-free Number.

Mia Davis said...

Much thanks to you such a great amount for sharing, I trust you keep on composing soul next subject.

norton.com/setup | norton.com/setup | mcafee.com/activate | norton.com/setup | mcafee.com/activate

Smith John Live said...

Download and install the HP LaserJet Pro m404n driver
 
1.Go to the HP support site and download the driver
2.When you get the prompt choose the printer and then press download and run the HP Easy start
3.When prompted choose the printer and press the My print is not shown
4.Tap continue and then choose wireless network
5.Now follow the onscreen setup to finish the wireless network
To know more about the process of HP LaserJet pro m404n setup you can just give a call at. Also, drop in on our site for more steps on printer setup.

geeksquad said...


geek squad appointment |
best buy geek squad appointment |
best buy appointment |
geek squad appointment scheduling |
best buy geek squad appointment schedule |
bestbuy.com-appointments |

Unknown said...

Gradually, with the new digital dominating world the options have increased of installing any program to the device; Norton.com/setup is an innovative and productive way to download, activate and complete the installation of Norton antivirus.

finnjordan100 said...

AVG Secure is a designed to keep your digital info safe and secure. Learn about its pricing, security features, and more in this review.
www.avg.com/retail | avg.com/retail |
Install AVG with license number |
AVG Download |
www.avg.com/activation

finnjordan100 said...

Webroot makes sure that you have the best security software products installed on your computer, it uses antivirus protection and a firewall, gives antispyware software, always keeps it up to date.
www.webroot.com/secure | webroot.com/secure |
Install Webroot With Key Code

finnjordan100 said...

Webroot makes sure that you have the best security software products installed on your computer, it uses antivirus protection and a firewall, gives antispyware software, always keeps it up to date.
www.webroot.com/secure | webroot.com/secure |
Install Webroot With Key Code

elibeth3636 said...

The AVG AntiVirus Free software offers protection against viruses, spyware, malware, trojan horses, worms, keyloggers, ransomware and a variety of other malicious threats.
www.avg.com/retail |
avg.com/retail

elibeth3636 said...

Trend Micro is best antivirus in this field because it uses multi-layered ransomware protection by working in three directions.
www.trendmicro.com/bestbuypc |
Trend Micro Geek Squad |
www.trendmicro.com besbuypc

Mark William said...

AVG Antivirus we suggest purchasing always from official website www.avg.com/retail . If you purchase from unauthorized websites then your system might get compromised. AVG is one of the best Antivirus who scan your whole device and keep eyes for the future as well. If you get any trouble during Installation you may also contact at Install avg with license number or AVG customer service phone number . AVG Support or AVG customer care keen to help their customers. You may also download AVG Internet Security from www.avg.com/activate AVG antivirus is the best among many antivirus software, which is provided by AVG technologies. avg.com/retail also Support on call by calling their AVG tech support or AVG Care Service .

greyhankin said...

Being the best streaming service in the US, Roku has a keen track of all your activities using the Roku account that you create. Roku also needs you to complete the Roku.com/link for activating the account. Here are certain things that we assist you on to complete the Roku activation.
For any further queries on Roku com link Activation, feel free to contact our active customer care team, working round the clock at the toll-free number.

charlesbronson said...

Thank you for sharing excellent opinion. I am impressed by the details that you have going approximately for this website. I have more warn similar this blog. Click asleep to know these instruction
Norton setup | www.office.com/setup| office setup |
Avast customer support number | Avast help & support Number

tech support said...

123.hp.com/dj2652
123.hp.com/setup 2652
123.hp.com/dj2622
123.hp.com/setup 6968
123.hp.com/setup 6978
123.hp.com/setup 5055
123.hp.com
123.hp.com/setup

honlith said...

hp envy 5052 driver

Jeffery king said...

hp envy 5052 driver

Unknown said...

Did you realize there is a 12 word phrase you can communicate to your crush... that will induce deep emotions of love and impulsive appeal to you deep within his chest?

That's because hidden in these 12 words is a "secret signal" that fuels a man's instinct to love, cherish and guard you with his entire heart...

=====> 12 Words Who Fuel A Man's Love Response

This instinct is so hardwired into a man's brain that it will make him work harder than ever before to take care of you.

Matter of fact, triggering this powerful instinct is so essential to achieving the best possible relationship with your man that the second you send your man a "Secret Signal"...

...You'll immediately notice him expose his mind and soul for you in such a way he never expressed before and he will perceive you as the only woman in the galaxy who has ever truly appealed to him.

Roan said...

Dragon NaturallySpeaking remains the for Windows-based speech-to-text technology.
dragon naturally speaking | dragon naturallyspeaking
nuance dragon | nuance dragon naturallyspeaking

lily grace said...

You can get it from avg to protect your identity. Browsers also contain cookies which track user’ location, id, and much other information and can be harmful so that AVG AntiTrack can protect you.
For some devices, during installation, AVG AntiTrack may show SQL Error, which cannot let you use the application and so we have discussed the blog here.
install avg with license number
AVG antivirus is the security program that works after it’s activation with avg retail. It requires an activation product key to activate AVG’s working and to protect your operating system. www.avg.com/retail | avg.com/retail
avg download

lily grace said...

McAfee service offers trusted safety to protect data and devices. So, you can shop, surf & keep all your devices safe online with the convenience of a single subscription.
www mcafee activate | mcafee login my account |
www mcafee com login
mcafee livesafe login | my mcafee account |
mcafee activation code |
mcafee.com my account

Mark William said...

Trend Micro Internet Security subscription is the single way to download the software on multiple devices through www.trendmicro.com/downloadme . Trend micro has become a superior antivirus program over many antiviruses due to its advanced protection features. trend micro download process becomes easy when you purchase the subscription.

Elegant IT Services said...

Nice Post...Thanks for sharing the Information...
Elegant IT Services

wilder zayn said...

Mcafee.com/activate - Presently, technology is transforming at a quicker pace than ever. With all the growth in technology comes the increasing number of possibilities for cybercriminals to abuse. As a consequence, cybersecurity has become extremely essential in order to safeguard persona, consumer, and business information against various threats. visit on mcafee.com/activate | www.mcafee.com/activate | mcafee.com/activate

Mark William said...

eset internet security can be installed quickly on each device if the user follows the correct procedure. You can follow the instructions below to install the setup on your devices such as Windows PC, Mac, or mobile device.

Garmin GPS said...

I know the value of Garmin Express Update and keep reading good content about the same. I found this blog very informative and it increased my understanding about garmin update to a great extent.

Garmin Nuvi said...

I did not know the entire benefits of Garmin Nuvi Update. But since I have read this blog on map update, I have installed all available updates for my garmin device. I must say that this piece of blog has helped me improve navigation experience. I am not suggesting all my friends to read this blog and get Garmin map update with this team.

Antivirus said...

We did not know the all benefits of Panda Antivirus Support Number. I have read this blog on Antivirus I have installed all available updates. I must say that this piece of blog has helped me improving navigation experience. I am not suggesting all my friends to read this blog and get Antivirus Panda Support with this team. You can use Panda Antivirus to get panda help desk update. Be it Norton Internet security, panda, Kaspersky, McAfee, or any other antivirus.

meldaresearch said...

There are academic nursing writing help companies whose ultimate goal is to provide Help with Nursing Writing Services since they are aware most nursing essay writing service part-time students lack enough time to complete their college custom nursing assignments.

Unknown said...

IO GAMES and also pick up something similar for my Mitsubishi lancer GAME

Roku-comlink said...

If you need streaming at a great value, then you can go for Roku. You can use it easily once you have done Roku setup. It can be a massive benefit if you are using Roku.com/link, having access to thousands of channels.

Aiden Jangra said...

I would like to say thank you to share such good information. Hp printer performs more than function is definitely needed. HP Printer troubleshooting your printer.you have the option to deal with all HP Printer issues.

augustwalker said...

how to setup a network printer windows 10 or system printer for your home or office and need to introduce it on Windows 10? Contrasted with the past times, including printers in Windows.

Home Appliance Services said...

We have thousands of happy customer in entire India. It's our entire team hard work who made us a remarkable brand in the field of AC installation and repair services. We believe in customer satisfaction and provides you, our services at the best market price. AC service engineer team at Samsung AC Service Centre in Jaipur are well qualified and fully trained.

hookstefan said...

the investigation for which eats up a tremendous portion
Assignment experts UK

Garmincom.express said...

You will receive the updates for the Garmin Express multiple times in a year and the same will be installed automatically or else you can also manually find the updates for the software. The procedure to update the Garmin Expresson different devices will be different mentioned hereunder are some of the simple steps to update Garmin.com/express on Computer.

Garmin.com/express-updates said...

It is also essential to frequently check Garmin express update.You can use Garmin express update version toupdate maps and ensure that the GPS functions accurately. It must remain updated to obtain the best performance.it's better to message on garmin.com/express, and you might get your solution.

Fubo.tv/Activate said...

Everyone knows that FuboTv is one of the best streaming platforms that provide you with a large number of sports and shows content. you can find anything on FuboTv from action shows to entertainment even educational stuff as per your requirement.You just have to complete Fubo.tv/Connect and then you are ready to go.
how do i activate FuboTV

Fubotv Activate said...

Sometimes the compatibility issues also trigger FuboTV not working problem. FuboTv keeps notification the users about the actual time technical problems FuboTv is facing at the moment.in that case, you might be needed to re-connect to your FuboTv account to access your activated channels. fubo.tv/Activate

Jaipur Escorts said...

Are you looking for sexy and bold call girls in Jaipur Escorts? So, you are searching for the right place because we are here now to give you an extreme level of sexual pleasure this you all time wanted with your wife and girlfriend but you never get it.

Fly Ash Supplier Louisiana said...

Hasten is uniquely positioned to maximize the success of its customers by utilizing its vast network of relationships along with its unwavering focus on its core principles of honesty, reliability, quality, credibility, and trust. With the goal of providing quality products, safely, and on a timely basis, Hasten will ensure you are satisfied with the end result.

Edmonton tile installation Contractor said...

Modern day caulk was invented in 1896, so if your home is older than that, you will have problems with tile staying in place.In the 1920s, acrylic, butyl, and silicone polymers were first developed and used in sealants. By the 1960s, synthetic-polymer-based sealants became available and that’s what we use today for the best bonding. Removing wall tiles is more difficult than removing floor tiles. Edmonton tile installation Contractor

Unknown said...

Get Our Famous Hollywood Movies Leather outfits available at our Online Store Instyle.com, We offer free shipping.
Women's Leather Bomber Jackets

Charlotte Paisley said...

The Programming Homework Help expert that they gave me was honest and free. He went on and asked if I could extend the deadline for the best grades, which I did. Food for me, he delivered what he promised; the best grade. It was a straight "A!" What was good about this was the prices. I didn't have to break the bank for the "A" like any other assignment helper would want. This time around, I'll come back to try their tutoring services, too. For now, much thanks for the C++ Homework Help

Charlotte Paisley said...

I'm very grateful for the free corrections that you did on my Excel assignment. The corrections we're demanding, so I thought that the company was going to ask for some amount to get them done. Luckily, I learned that they do corrections without charging clients, which is very generous of you. I've worked with several Statistics Assignment Help providers, and none of them ever offered to do me corrections without a tip. I highly recommend the Statistics Homework Help

Charlotte Paisley said...

My schedule is so tight and therefore I want someone to be a Matlab homework help solver who can help me complete my control systems assignment from time to time. I will be ready to give this Matlab assignment help
expert the login details to my class so that I don’t have to check whether there are pending assignments. If there is an assignment you will just be emailing me the quotation of having the work done and then you complete it and submit it in the class portal.

Charlotte Paisley said...

I am new here but they are offering exactly what I am looking for. I want an Economics assignment help. I am in the United States, and therefore, I don’t know whether they offer the service here. If you do, let me know how much it will cost me for Economics homework help. I am waiting for their response.

Emma Harper said...

I have tried hiring them on their website and the process of hiring is indeed quite simple. What has surprised me is that they have many Economics assignment help
professors, so I was even confused about which one to choose. I have submitted all the requirements and made the payment. I hope that I will get good Economics homework help

Emma Harper said...

I have sent them an email to the Matlab assignment help team. It just details my assignment requirements. I need a very good Matlab homework help tutor to be handling my numerical methods assignments. This is just the start because I just enrolled in a Matlab class. I, therefore, want someone who will be available and ready to deliver my work on time. If they have one very good Matlab expert then link me with them so that we can start the work immediately.

Emma Harper said...

Their services seem perfect. The Statistics Assignment Help expert who completed my assignment was fast and ardent. He was also very communicative throughout the period he was undertaking the order. Moreover, he followed all my instructions to the letter. I used the Statistics Homework Help after a friend told me about it. He had used it before and was very successful. Thanks for the unmatched services and marks.

Emma Harper said...

Do yourself a favor and order this company's Programming Homework Help services so that they smile all the way to success. That's what happened to me a few months ago when a friend recommended it to me. I'm honestly not very good at C despite attending its classes every week. When I resorted to the company'sC Homework Helpservices, I experienced immediate changes in my academic account.

Suntrustblog said...

I found so many exciting matters in this particular content, I would like to request please keep posting such informative content. Check out apex focus groups inc canada

Abigail Victoria said...

I was very nervous when I sent my first project for Statistics Homework Help online on their website. While it was my first experience with them, it was also my first-ever attempt to ask for such a service from an online source. Their experts then surprised me with peak grades and professional service. I also appreciate their timely delivery and easy-to-understand solutions. Meanwhile, I recommend that for all types of Statistics Assignment Help. Cheers!

Abigail Victoria said...

It's eight months down the line since I registered for Programming Assignment Help services, but that's not the news. There hasn't been any failure from their side; neither a delay nor a bad grade! That alone deserves a celebration! C Homework Help services are the best thing that has happened to me at college. Thanks for their support

Abigail Victoria said...

Finally graduating. My communications system assignment results are out and that is a clear indication that I am now all set to graduate. The Matlab assignment help expert who handled my paper did it well. I just feel like involving them in this graduation ceremony because they helped me a lot throughout the course. I will always recommend it to anyone looking for help. I cannot forget how desperately I was looking for experienced Matlab homework help solvers when I found them. Thanks for the four years we collaborated.

Abigail Victoria said...

Do you offer Economics homework help in Australia? I am looking for an Australian Economics assignment help expert for my economics assignment. I will not accept any tutor from another country. Therefore if you are not from Australia recommend one from me. My assignment relates to the Australian economy and only an Australian economist can handle it well.

milalillian710 said...

They'll still remain my best statistics advisor despite having done my last Bachelor's degree statistics assignment last week. Throughout my university studies, They provided me with unmatched Statistics Assignment Help with leasing scores and the quickest service ever. I later recommend your SPSS, STATA, R,EXCEL and Statistics Homework Help to my friends, who're also very pleased with their services. Cheers, pal!

milalillian710 said...

Their solutions were original, which is a reflection of knowledge and experience. The Programming Homework Help agents all to be determined in helping students excel rather than getting money from them like in lost other sites. That's the spirit we need from seniors like you. Meanwhile, the Python Homework Help you offered me was excellent. I scored the highest grade (A).

milalillian710 said...

Hello? What happens when Matlab Assignment Help solutions haven't met my expectations? Well, I'm not saying that I'm a victim, but I want to know this so that in case I make a grade request and it's not met, I know what to expect. Moreover, how much do they charge for such Matlab Homework Help requests? Before I leave, I'd also like to know their tutoring rates. I need a full week's tutoring service (4 hours each day) to catch up with the syllabus.

milalillian710 said...

How do you handle revisions? No one can be perfect always and therefore revisions will always come. As an Economics assignment help expert, do you give revisions a priority? More to that are the revisions free or do you charge for them? I am looking for an Economics homework help expert who will deliver my assignments on time and who will always give revisions a priority.