Skip to main content

Home/ javascript/ Group items tagged closure

Rss Feed Group items tagged

Mr. DiGi

Google Code Blog: Introducing Closure Tools - 1 views

  • Closure Compiler is a JavaScript optimizer that compiles web apps down into compact, high-performance JavaScript code.
  • Closure Library is a broad, well-tested, modular, and cross-browser JavaScript library. Web developers can pull just what they need from a wide set of reusable UI widgets and controls, as well as lower-level utilities for the DOM, server communication, animation, data structures, unit testing, rich-text editing, and much, much more. (Seriously. Check the docs.)
  • Closure Templates grew out of a desire for web templates that are precompiled to efficient JavaScript.  Closure Templates have a simple syntax that is natural for programmers.
Vincent Tsao

Javascript Closures - 0 views

  • The simple explanation of a Closure is that ECMAScript allows inner functions; function definitions and function expressions that are inside the function bodes of other functions. And that those inner functions are allowed access to all of the local variables, parameters and declared inner functions within their outer function(s).
yc c

Closure Compiler - Google Code - 1 views

  •  
    The Closure Compiler is a tool for making JavaScript download and run faster. It is a true compiler for JavaScript. Instead of compiling from a source language to machine code, it compiles from JavaScript to better JavaScript. It parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes what's left. It also checks syntax, variable references, and types, and warns about common JavaScript pitfalls.
Javier Neira

Inheritance Patterns in JavaScript - 2 views

  •  
    This article discusses the advantages of the pseudoclassical pattern over the functional pattern. I argue that the pattern used by the Closure Library paired with the Closure Compiler removes existing hazards while I also examine the hazards introduced by the functional pattern (as defined in The Good Parts). First let me demonstrate what I mean by the functional pattern.
Javier Neira

Google Closure: How not to write JavaScript - 3 views

  • “It’s a JavaScript library written by Java developers who clearly don’t get JavaScript.”
  • Unfortunately, unlike the built-in properties supplied by Object.prototype, custom properties added to Object.prototype will show up as an object property in any for-in loop in the page.
  • custom properties added to
  • ...3 more annotations...
  • will show up as an object property in any
  • loop in the page.
  • var a = "I am a string!";   2 alert(typeof a); // Will output "string"   3 var b = new String("I am also a string!");   4 alert(typeof b); // Will output "object" 
Javier Neira

fingernails in oatmeal, Metaprogramming: Ruby vs. Javascript - 0 views

  • drew['battleCry']();
  • What we want is the ability to define a method dynamically (given a name) that is also a closure over the lexical scope at the point of method definition.
  • color_name = 'black' Ninja.send(:define_method, 'color') do  puts "#{name}'s color is #{color_name}"end
  • ...5 more annotations...
  • var colorName = "black"; Ninja.prototype['color'] = function () {  puts(this.name + "'s color is " + colorName);}
  • The ubiquity of closures in Javascript is extremely powerful and, as we have seen so far, makes metaprogramming very easy.
  • You can think of a metaclass as a class definition specific to a single instance of a class.
  • This means we can add methods to an object’s metaclass without adding the same behavior to all instances of that object’s class.
  • This means that Javascript does not distinguish between classes/prototypes and instances and, therefore, we can add our desired behavior directly to the instance.
Javier Neira

JavaScript: The World's Most Misunderstood Programming Language - 1 views

  • JavaScript: The World's Most Misunderstood Programming Language
  • This is misleading because JavaScript has more in common with functional languages like Lisp or Scheme than with C or Java.
  • It has arrays instead of lists and objects instead of property lists. Functions are first class. It has closures. You get lambdas without having to balance all those parens.
  • ...1 more annotation...
  • Some argue that JavaScript is not truly object oriented because it does not provide information hiding. That is, objects cannot have private variables and private methods: All members are public. But it turns out that JavaScript objects can have private variables and private methods. (Click here now to find out how.) Of course, few understand this because JavaScript is the world's most misunderstood programming language. Some argue that JavaScript is not truly object oriented because it does not provide inheritance. But it turns out that JavaScript supports not only classical inheritance, but other code reuse patterns as well.
1 - 12 of 12
Showing 20 items per page