<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom"><title>Simon Willison's Weblog: pete-michaux</title><link href="http://simonwillison.net/" rel="alternate"/><link href="http://simonwillison.net/tags/pete-michaux.atom" rel="self"/><id>http://simonwillison.net/</id><updated>2008-06-27T19:01:34+00:00</updated><author><name>Simon Willison</name></author><entry><title>Module Pattern Provides No Privacy... at least not in JavaScript(TM)</title><link href="https://simonwillison.net/2008/Jun/27/peters/#atom-tag" rel="alternate"/><published>2008-06-27T19:01:34+00:00</published><updated>2008-06-27T19:01:34+00:00</updated><id>https://simonwillison.net/2008/Jun/27/peters/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://peter.michaux.ca/article/8069"&gt;Module Pattern Provides No Privacy... at least not in JavaScript(TM)&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
JavaScript variables hidden inside a closure aren’t as hidden as I thought—it turns out you can pass a closure as the second argument to eval (at least in Firefox) and “steal” private variables back out of it.

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox"&gt;Ajaxian&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/closures"&gt;closures&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/firefox"&gt;firefox&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/javascript"&gt;javascript&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/modulepattern"&gt;modulepattern&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/pete-michaux"&gt;pete-michaux&lt;/a&gt;&lt;/p&gt;



</summary><category term="closures"/><category term="firefox"/><category term="javascript"/><category term="modulepattern"/><category term="pete-michaux"/></entry><entry><title>Transitioning from Java Classes to JavaScript Prototypes</title><link href="https://simonwillison.net/2008/Feb/10/classes/#atom-tag" rel="alternate"/><published>2008-02-10T15:10:21+00:00</published><updated>2008-02-10T15:10:21+00:00</updated><id>https://simonwillison.net/2008/Feb/10/classes/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://peter.michaux.ca/article/5004"&gt;Transitioning from Java Classes to JavaScript Prototypes&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Peter Michaux shows how JavaScript’s prototypal inheritance can run rings around traditional Java-style classes once you figure out how to take advantage of it.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/inheritance"&gt;inheritance&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/java"&gt;java&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/javascript"&gt;javascript&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/object-oriented-programming"&gt;object-oriented-programming&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/pete-michaux"&gt;pete-michaux&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/prototypal-inheritance"&gt;prototypal-inheritance&lt;/a&gt;&lt;/p&gt;



</summary><category term="inheritance"/><category term="java"/><category term="javascript"/><category term="object-oriented-programming"/><category term="pete-michaux"/><category term="prototypal-inheritance"/></entry><entry><title>Lazy Function Definition Pattern</title><link href="https://simonwillison.net/2007/Aug/15/peters/#atom-tag" rel="alternate"/><published>2007-08-15T18:57:53+00:00</published><updated>2007-08-15T18:57:53+00:00</updated><id>https://simonwillison.net/2007/Aug/15/peters/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://peter.michaux.ca/article/3556"&gt;Lazy Function Definition Pattern&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Neat JavaScript trick: redefine a function the first time it’s called, for example to switch in different browser implementations based on object detection.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/javascript"&gt;javascript&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/pete-michaux"&gt;pete-michaux&lt;/a&gt;&lt;/p&gt;



</summary><category term="javascript"/><category term="pete-michaux"/></entry><entry><title>JavaScript Minifier that doesn't break code</title><link href="https://simonwillison.net/2007/Jun/4/peters/#atom-tag" rel="alternate"/><published>2007-06-04T17:44:46+00:00</published><updated>2007-06-04T17:44:46+00:00</updated><id>https://simonwillison.net/2007/Jun/4/peters/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://peter.michaux.ca/article/2242"&gt;JavaScript Minifier that doesn&amp;#x27;t break code&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Perl re-implementation of Douglas Crockford’s classic JSMin that doesn’t clobber IE’s conditional comments, by Peter Michaux.

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="http://www.b-list.org/links/2007/05/27/javascript-minifier-doesnt-break-code-perl"&gt;James Bennett&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/conditionalcomments"&gt;conditionalcomments&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/douglas-crockford"&gt;douglas-crockford&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/internet-explorer"&gt;internet-explorer&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/james-bennett"&gt;james-bennett&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/javascript"&gt;javascript&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/jsmin"&gt;jsmin&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/perl"&gt;perl&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/pete-michaux"&gt;pete-michaux&lt;/a&gt;&lt;/p&gt;



</summary><category term="conditionalcomments"/><category term="douglas-crockford"/><category term="internet-explorer"/><category term="james-bennett"/><category term="javascript"/><category term="jsmin"/><category term="perl"/><category term="pete-michaux"/></entry></feed>