From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from resqmta-ch2-01v.sys.comcast.net (resqmta-ch2-01v.sys.comcast.net [IPv6:2001:558:fe21:29:69:252:207:33]) by hurricane.the-brannons.com (Postfix) with ESMTPS id 5537677CC9 for ; Sat, 13 Jun 2015 01:47:31 -0700 (PDT) Received: from resomta-ch2-09v.sys.comcast.net ([69.252.207.105]) by resqmta-ch2-01v.sys.comcast.net with comcast id fkoq1q0012GyhjZ01koqeD; Sat, 13 Jun 2015 08:48:50 +0000 Received: from eklhad ([IPv6:2601:4:5380:4ee:21e:4fff:fec2:a0f1]) by resomta-ch2-09v.sys.comcast.net with comcast id fkop1q00F5LMg2101kop2L; Sat, 13 Jun 2015 08:48:50 +0000 To: Edbrowse-dev@lists.the-brannons.com From: Karl Dahlke Reply-to: Karl Dahlke User-Agent: edbrowse/3.5.4.1+ Date: Sat, 13 Jun 2015 04:48:49 -0400 Message-ID: <20150513044849.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=q20140121; t=1434185330; bh=c1gUwflYM4FJApQAKrjht8ZfGPknmSy5JyrcWrk1MaQ=; h=Received:Received:To:From:Reply-to:Subject:Date:Message-ID: Mime-Version:Content-Type; b=q7agntR0ta4EEZo2tViZl5vbmELtZV3Yk8IwATCLuqeWejGUNVNOAFq5t8x6stJNH cI0c0CE6dV+GtDFo5x3osFMDcKgran0Qys2oBfqglJpW9t82C7Wbl4zbsgz2bzlXdn szfeyNbCmqe8S8Yvw6oNuIy3PXkyOpzGDt8eOPQ5XqKKs7DgvMtQRWIomr5qxfGpSk hd6qhhu/ELfXYOkB7p8nnzfKX1o8c9FzRXqbTj0KiKBo9uFfb6USq5CGqi5FMTVBz2 WPPx0/qHDl0Q0q0Km2kEDtVjot3IdDjxiwX3TJoH1gBafukc7CIWQ2urh3NDmRE4/8 jUbwmdiMGvaXg== Subject: [Edbrowse-dev] getters and setters in straight javascript X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jun 2015 08:47:31 -0000 Friends, before Adam dives into javascript duktape engine, if he could procrastinate just a couple more days, I would like to ask a question. This is just for discussion, I don't know enough even to have an opinion. The edbrowse-js that we have working today, based on mozilla, is 2354 lines of c++. Within this, the setters and getters for the URL class are 439 lines of code, almost one fifth of the total. If we include other setter code, such as document.cookie = "foo=bar" folding this into the entire document.cookie string, we could be talking about a quarter of the code or more. This is all C, and all tightly coupled to the getter syntaax of whatever engine we are using, all has to be modified whenever we upgrade or switch engines. My question is, could some of this be done by generic javascript in the sourcefile startwindow.js? Does it really have to be native C? There are already some URL.prototype definitions in there, perhaps we could add some getters and setters easily that would do all the stuff I do in C today. Have a look at this web page. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects Read the section Defining getters and setters Is this mozilla specific, or generic javascript? Perhaps run some of the examples through d8. The examples seem to suggest object.x can be defined as a getter or setter but not both. If that is the case then it won't work for us. URL.port needs to fetch the port, 80 for example, but url.port = 8080 needs to set the port and also change the port in url.href. This is an area of javascript that I didn't know existed at all until last week, so I'm still learning. Just raising some questions, because the several hundred lines of C code that implement the setters are a bit ugly, or at least awkward and engine specific. Karl Dahlke