From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from qmta03.westchester.pa.mail.comcast.net (qmta03.westchester.pa.mail.comcast.net [IPv6:2001:558:fe14:43:76:96:62:32]) by hurricane.the-brannons.com (Postfix) with ESMTP id 9F94E779A7 for ; Mon, 10 Feb 2014 10:26:41 -0800 (PST) Received: from omta09.westchester.pa.mail.comcast.net ([76.96.62.20]) by qmta03.westchester.pa.mail.comcast.net with comcast id Qgz71n0030SCNGk53iS2n7; Mon, 10 Feb 2014 18:26:02 +0000 Received: from eklhad ([107.5.36.150]) by omta09.westchester.pa.mail.comcast.net with comcast id QiS11n01N3EMmQj3ViS2v8; Mon, 10 Feb 2014 18:26:02 +0000 To: Edbrowse-dev@lists.the-brannons.com From: Karl Dahlke User-Agent: edbrowse/3.5.1 Date: Mon, 10 Feb 2014 13:26:02 -0500 Message-ID: <20140110132602.eklhad@comcast.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1392056762; bh=CqB1zWHfVrWluEutVZ0PdE5K3rEE/MVCC+Cf9Mhy0ik=; h=Received:Received:To:From:Reply-to:Subject:Date:Message-ID: Mime-Version:Content-Type; b=gu8HaEIsTyPoK8LTp/q7vLHpCocWTiRkp3K5ylIcgiwchyIvjK/dFEXIfuxr0FZID /f/xHvl13yaKH3zMQm+7I3/BOpHB0Kt84sqm0dJmKCmutMvIld6a56CHw5ogWsKPtI Wa1+7wu5nbznwOX8IP/8AzawjMlrGiQ8n8Ng/wmYrrCz/GxpET1SenRZen91X6qOu7 Yj/RcqeyGSZDn2NIxmrJ2rODVut9FxTQtOMjNfYPo614TxdoEwqnuL5p2hGn6o3IzA JjdN+66Wwos7LfAbYWn7VvssKK4k81q4PQ5h2XGaU2LEbp7xOlBri0Sot27YrjG6bO t+DnsVx/SKj2Q== Subject: [Edbrowse-dev] Removing Shorthand X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.17 Precedence: list Reply-To: Karl Dahlke List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Feb 2014 18:26:42 -0000 I hope I am on the right path here. I find myself, at this point, mostly removing shorthand from html.cpp. Shorthand like this. obj *ev = t->jv; /* element variable */ That's the way it use to look. ev was just shorthand for t->jv, the javascript variable that goes with this tag. And not that much shorthand really, it only saves me 3 characters. But now the shorthand has become longhand. ev has to be rooted, and that implies a compartment, so now it looks like this. AutoCompartmant(cx, jwin); Rooted(ev, t->jv); It's now more like longhand, and difficult to read or understand if you aren't an expert in spider monkey js. A new developer would look at that and say "what the hell?" If I had written my shorthand like this, I could have simply carried it along. #define e t->jv With all this in mind, I am removing these shorthand constructs, and may very well be able to eliinate all Rooted variables and all AutoCompartments from the html code. This has the following advantages. 1. More readable. 2. More maintainable. 3. Easier to upgrade when Mozilla changes its api again, as they surely will. We likely won't have to mess with html.cpp at all; it's all contained in js*.cpp. Encapsulation. 4. Easier to switch from Mozilla to some other js engine, which we might want to do someday if moz continues to be a pain. Again, html.cpp would mostly be unaffected. 5. All these functions will just work whether js is active or not, whether cw->jss is null or not. They aren't setting compartments or rooting variables. This moves us towards the goal of distroying a context, seting cw->jss = null, and letting edbrowse march on. I could put some of the shorthand back, using the #define shown above, but I usually don't like programming by the preprocessor. Well we can decide that later. Karl Dahlke