background preloader

Traceur-compiler - Google's vehicle for Javascript Language Design Experimentation

LanguageFeatures - traceur-compiler - Traceur Language Features - Google's vehicle for Javascript Language Design Experimentation Property Method Assignment These features are proposals for ECMAScript Harmony unless otherwise noted. Classes This implements class syntax and semantics as described in the ES6 draft spec. In earlier versions of Traceur we had more feature rich classes but in the spirit of Harmony we have scaled back and are now only supporting the minimal class proposal. class Monster extends Character { constructor(x, y, name) { super(x, y); this.name = name; this.health_ = 100; } attack(character) { super.attack(character); } get isAlive() { return this.health > 0; } get health() { return this.health_; } set health(value) { if (value < 0) throw new Error('Health must be non-negative.'); this.health_ = value; }} Here's an example of subclassing an HTML button: class CustomButton extends HTMLButtonElement { constructor() { this.value = 'Custom Button'; } // ... other methods ...}var button = new CustomButton();document.body.appendChild(button); Warning This is currently not supported. Modules Generators

NaCl; Has Native Client been sweet of too salty? NaCl; Has Native Client been sweet of too salty? Posted by Dion Almaer about a year ago on c++ nacl plugins Native Client has always been an interesting project. Bring your C/C++ to the Web via special gcc sauce. Not very webby in the view-source tradition, but brings interesting features through to the browser. At Palm we had something similar to NaCl called the PDK, and a big goal was to mix and match low level native code and web native code. Scott Ananian has written a short post on the state of NaCl that shares where we are at based on outside view that compares to the Android NDK: To begin, the Native Client (NaCl) plugin is fairly mature in a number of areas. Tom Robinson (280North co-founder / Capp / Narwhal) is certainly bullish on the approach: Emscripten is neat, but Native Client and especially PNaCl (NaCl + LLVM) is what you should be watching over the next few years.

GitHub - termi/es6-transpiler: Tomorrow's JavaScript syntax today nzakas/computer-science-in-javascript - GitHub SPDY: What I Like About You. I've been working on implementing SPDY as an experiment in Firefox lately. We'll have to see how it plays out, but so far I really like it. Development and benchmarking is still a work in progress, though interop seems to be complete. There are several significant to-do items left that have the potential to improve things even further. The couple of anecdotal benchmarks I have collected are broadly similar to the page load time based reports Google has shared at the IETF and velocity conf over the last few months. tl;dr; Faster is all well and good (and I mean that!) SPDY: What I Like About You #1: Infinite Parallelism with Shared Congestion Control. You probably know that SPDY allows multiplexing of multiple HTTP resources inside one TCP stream. Normal HTTP achieves transaction parallelism through parallel TCP connections. Parallelism is a must-have for performance. The architectural problem lies in HTTP's interaction with TCP congestion control. Packet Loss. huzzah. #3:Header compression.

The Super Surrogates of JavaScript – JavaScript Non Grata – Medium There are at least two important things we know for certain about the popular programming language JavaScript: JavaScript is the native language in web browsers. Thus, we cannot escape from using it in web development.JavaScript has a great many “warts” and semantical inconsistencies, much more so than in other programming languages. It’s not only slightly worse than other languages; it is substantively much worse. That being said, there is absolutely no solid rationale to directly program in JavaScript. Here are several examples of transpiled languages and their best representative web applications… Amber (Smalltalk) Smalltalk is a pure object-oriented programming (OOP) language that has an impossibly clean and simple syntax. Brython (Python) ClojureScript (Clojure) Clojure is a dialect of Lisp (commonly regarded as the grandfather of functional programming, or FP, languages) that runs atop the JVM. Dart GopherJS (Go) GWT (Java) Haxe Scala.js (Scala)

Online javascript beautifier Unofficial Google Advanced Search - Vimperator The JWebNet.net main page > Unofficial Google Advanced Search Google Search Box Table of Contents Back to the table of contents 1. Disclamer: This site is not controlled or supported by Google in anyway. Welcome to the Unoffical Google Advanced Search page. This page is provided as a reference and a guide to using the advanced search operators that Google provides. With the announcement of SSL support on Google.com I changed all the search examples to use SSL as well. 2. Google is case insensitive, meanting that 'gOoGle' is the same as 'GOOGLE' and 'google' Search operators are case sensitive, meaning that 'OR' is not the same as 'or' Without using any operators, Google will show pages with all words first, trying to find the words in order Google excludes common words (known as stop words) like 'I', 'the', 'a' etc Pay attention to operators that must be used alone 3. 3.1. 3.2. Google advanced search sends the following URI to the server. 3.3. 3.4. 3.4. 4. 5.

Brython Using continue with a label Summary Terminates execution of the statements in the current iteration of the current or labelled loop, and continues execution of the loop with the next iteration. Version Information Syntax continue [ label ]; Parameters label Identifier associated with the label of the statement. Description In contrast to the break statement, continue does not terminate the execution of the loop entirely: instead, In a while loop, it jumps back to the condition. The continue statement can include an optional label that allows the program to jump to the next iteration of a labelled loop statement instead of the current loop. Examples Example: Using continue with while The following example shows a while loop that has a continue statement that executes when the value of i is 3. i = 0; n = 0;while (i < 5) { i++; if (i === 3) { continue; } n += i;} Example: Using continue with a label In the following example, a statement labeled checkiandj contains a statement labeled checkj. See also break, label

label The labeled statement can be used with break or continue statements. It is prefixing a statement with an identifier which you can refer to. Syntax label : statement label Any JavaScript identifier that is not a reserved word. statement Statements. break can be used with any labeled statement, and continue can be used with looping labeled statements. Description You can use a label to identify a loop, and then use the break or continue statements to indicate whether a program should interrupt the loop or continue its execution. Note that JavaScript has NO goto statement, you can only use labels with break or continue. Examples Using a labeled continue with for loops Using a labeled continue statement Given an array of items and an array of tests, this example counts the number of items that passes all the tests. var itemsPassed = 0;var i, j; top:for (i = 0; i < items.length; i++){ for (j = 0; j < tests.length; j++) if (! Using a labeled break with for loops Using a labeled break statement Specifications

Object-Oriented JavaScript Over recent years, JavaScript has increasingly gained popularity, partly due to libraries that are developed to make JavaScript apps/effects easier to create for those who may not have fully grasped the core language yet. While in the past it was a common argument that JavaScript was a basic language and was very 'slap dash' with no real foundation; this is no longer the case, especially with the introduction of high scale web applications and 'adaptations' such as JSON (JavaScript Object Notation). JavaScript can have all that an Object-Orientated language has to offer, albeit with some extra effort outside of the scope of this article. Congratulations, you just created an object. For each of the objects we have created a property 'iAm' which contains a string value that is used in our objects method 'whatAmI' which alerts a message. Properties are variables created inside an object and methods are functions created inside an object. First we will create an Object literal;

You must remember 'this' Of all the tech blogs in all the sites in all the worldwide web, you walk into mine... If you hang out in JavaScript-oriented newsgroups like these for any length of time, you will eventually see some variation of this question: Hey, why doesn't this work?function MyWidget(name){ this.name = name; this.element = null;}MyWidget.prototype.showName = function(){ alert('The name is ' + this.name);}MyWidget.prototype.hookElement = function(element){ this.element = element; Event.observe(this.element, 'click', this.showName);}function test(){ var widget; widget = new MyWidget('Test Name'); widget.hookElement(document.getElementById('testDiv'));}"testDiv" is a div in the document, and I know that I'm not calling the test() function before the DOM is loaded, so why is it when I click the div I get the message "The name is undefined"?! (As always, I'm using some convenience syntax in the above for hooking up the event handler.) The OP (original poster) might even follow on with: And that's it!

Static variables

Related: