<html><head><base href="x-msg://118/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div><div>On Jul 29, 2010, at 7:57 PM, Nicholas Zakas wrote:</div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div lang="EN-US" link="blue" vlink="purple"><div class="Section1" style="page: Section1; "><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; ">Proposed Interface Change:<o:p></o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; "><o:p> </o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; ">The easiest way to include such a change would be to augment the Storage::setItem() method with a third optional argument. So change from:<o:p></o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; "><o:p> </o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; "> setter creator void setItem(in DOMString key, in any data);<o:p></o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; "><o:p> </o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; ">To:<o:p></o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; "><o:p> </o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; "> setter creator void setItem(in DOMString key, in any data, [Optional] in unsigned long ttl);</span></font></div></div></div></span></blockquote></div><br><div><br></div><div>I think too that being able to specify the end of life of stored data can be useful </div><div><br></div><div>I also think, like Paul Ellis it might be frustrating to have too set again the value of an item to update its TTL value (all the more on very large Objects)</div><div><br></div><div>Another frustration for me is to have to set a TTL value when the value I want to defined is a fixed expiration date and not a "Time To Live" value.</div><div>I'd prefer then:</div><div>- to call this third argument "expires"</div><div>- make this argument considered as a TTL value if it is a number</div><div>- make this argument considered as an expiration date if it is a Date Object </div><div>- it might also be considered as an expiration Date if it is a ISO Date String (often used in JSON string)</div><div>- it might then be considered as a TTL if it is not an ISO Date String but a string that can be converted into a valid number</div><div><br></div><div><br></div><div>About negative, null value of a value equal too 0 assigned to this third argument:</div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>-> I agree with Paul that it could be interpreted to remove this expiration setting</div><div><br></div><div>About interpreting no value to the second argument as a TTL update</div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>-> I find it kind of weird</div><div>What is the expected behavior when setting an item value to undefined ?</div><div>I find it unclear in the specification. </div><div>It says setItem fix a structured clone value... </div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>-> will it throw an exception for undefined </div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>-> will it remove the item as we could expect using the alternative way to set the value (localStorage.myItem = undefined)</div><div>Thinking about JSON stringification, setting a property to undefined makes it disappear while null preserves its existence. </div><div>Thinking about Objects, assigning null would is often used to delete an instance (even if I semantically prefer the "delete" JavaScript instruction)</div><div><br></div><div>To update this "expires" or "TTL" attribute of this item, I would consider</div><div><br></div><div><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">Storage::setExpiration(in DOMString key, in TTL or expiration Date)</span></div><div><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br></span></div><div><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "></span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">(or </span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">Storage::setTTL() if you guys don't agree on the Date option)</span></div><div><font class="Apple-style-span" face="Arial" size="3"><span class="Apple-style-span" style="font-size: 13px; "><br></span></font></div><div><br></div><div>By the way, I often figure out that one on the goals to define good APIs is to "Keep It Stupid Simple" ;-)</div><div>So I could live, maybe a bit sadly, without the support of Dates...</div><div><br></div><div><br></div><div>Alexandre.</div></div><div><br></div></body></html>