<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I think there’s always going to be a
disconnect between browser developers and web developers, since we’re
both living in very different worlds.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Like I said, I’m all for making
cookie access more rational (as if one could argue that it has been at all
rational to this point). Right now, though, I can’t see a benefit to
switching from any of the current synchronous approaches to an asynchronous
one, as it doesn’t give me enough added benefit. The asynchronous
approach may be the most performant and potentially the easiest to implement,
but if it’s out there and everyone is still using document.cookie, is
there really a net gain?<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>-Nicholas</span></font><font color=navy><span
style='color:navy'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=navy face="Times New Roman"><span
style='font-size:12.0pt;color:navy'> <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>______________________________________________</span></font><font
color=navy><span style='color:navy'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Commander Lock: "Damnit Morpheus, not
everyone believes what you believe!"</span></font><font color=navy><span
style='color:navy'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Morpheus: "My beliefs do not require
them to."</span></font><o:p></o:p></p>

</div>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
jorlow@google.com [mailto:jorlow@google.com] <b><span style='font-weight:bold'>On
Behalf Of </span></b>Jeremy Orlow<br>
<b><span style='font-weight:bold'>Sent:</span></b> Wednesday, February 24, 2010
12:20 PM<br>
<b><span style='font-weight:bold'>To:</span></b> David Flanagan<br>
<b><span style='font-weight:bold'>Cc:</span></b> Peter Kasting; whatwg; <st1:PersonName
w:st="on">Nicholas Zakas</st1:PersonName>; Darin Fisher; Adam Barth<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [whatwg] HTML Cookie
API</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>On Wed, Feb 24, 2010 at 9:07 PM, David Flanagan <<a
href="mailto:david@davidflanagan.com">david@davidflanagan.com</a>> wrote:<o:p></o:p></span></font></p>

<div>

<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>

<div>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>Jeremy Orlow wrote:<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><br>
Also note that the spec currently has the notion of a storage mutex which
should be taken whenever a script tries to access a cookie (or local storage)
and is held until the script finishes.  The network stack is also supposed
to take this lock whenever getting or setting a cookie.  No one has
implemented the storage mutex or stated any intention of doing so because this
is basically impossible today.  But, if there were an asynchronous API
that most people were using, it actually could be possible that we'd want to
implement such a mutex since cookies would then obey run to completion
semantics without having serious lock contention.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Well if no one is going to implement the storage mutex, then I probably
need to retract my last message<o:p></o:p></span></font></p>

<div>

<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>But yeah.  Definitely any API that touches information spanning
tabs (and probably even APIs spanning origins within those tabs) really should
be designed in an async manor from now on.  Otherwise we're just digging
the whole deeper in terms of forcing ourselves into a single threaded world.<br>
<br>
J<o:p></o:p></span></font></p>

</blockquote>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>I worry that this comes down to web developers who want simple APIs vs
browser implementors who say we can't have them (at least not if we also want
speed.)<br>
<br>
Concurrency issues are not my strong suit, but shouldn't it be possible to have
safe, synchronous read-only access to cookies (caching volatile values like
cookies within each thread and then clearing that cache when the thread returns
to the event loop).  Can't the requirement for a mutex or an asynchronous
API be limited to setCookie()?<o:p></o:p></span></font></p>

</blockquote>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>From a technical standpoint, this is very doable.  And, done
right, I think I could be in favor of it.<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>But I believe the counter argument is that any relaxation of run
to completion semantics is going to confuse developers and probably
result in them writing racy code without realizing it.  Many developers
won't understand when it's safe to use the cached value vs needing to use the
asynchronous interface.  And if the less safe one is easier to use....<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>I agree that asynchronous interfaces have disadvantages, but as far as
I can tell many of them are costs that you pay once (learning them and getting
use to them) or once per app (if you handle one asynchronous call or need to
use setTimeout, then probably using another won't require too much
restructuring of your code).  Maybe I'm just a browser developer who's
completely out of touch with reality though.  :-)<o:p></o:p></span></font></p>

</div>

</div>

</div>

</body>

</html>