Thursday, April 3rd, 2008
Category: JavaScript
, Prototype
, Showcase
Sebastian Brink has developed a nice looking gallery application called qGallery
It is really simple to use you just have to upload your images in full resolution together with a simple xml file and include the script and a simple div into the webpage. Everything else is done automatically. The gallery is creating every used image on the fly with the help of some php scripts in the background.
It is developed on top of Prototype and a bunch of other libraries.
Tuesday, April 1st, 2008
Category: JavaScript
…. proper tail calls are out of ES4 as of yesterday’s Ecma TC39 meeting, by general (regretful, in Mozilla’s
case) agreement.
This is Brendan talking about the death of true tail calls in JavaScript 2 as the language gets tightened a la:
ES4 has overspent its complexity budget in order to explore a large design space. It is now shrinking to meet practical budgets involving Ecma member consensus, prime mover commitments, fatigue effects, community expectations, and the like. No one working on ES4 wants it to be like Perl 6. We aim to finish this year.
Chromatic jumped on this one.
Francis Cheng posted about the grammar update for ECMAScript 4 which has the following updates:
- Rename ListExpression to CommaExpression;
- Make CommaExpression a binary expression in the AST;
- Change ParenExpression to ParenListExpression in SuperExpression;
- Rename ParenListExpression to ParenExpression;
- Remove Path qualified PropertyNames;
- Mark reserved/deferred features with ‘x’;
- Remove ‘wrap’;
- Remove ‘like’ as a type;
- Add ‘like’ as a binary type operator;
- Remove LetStatement;
- Remove UnitDefinition;
- Fold NullableTypeExpression into TypeExpression;
- Remove OverloadedOperator from QualifiedNameIdentifier;
- Add distinguishing syntax for tuples and array types in ArrayType;
- Add SplatExpression to arguments and array literals;
- Add RestPattern to array patterns;
- Add to ReservedIdentifiers ‘type’;
- Add to ContextuallyReservedIdentifiers ‘external’;
- Removed from ContextuallyReservedIdentifiers ‘decimal’, ‘double’, ‘generic’, ‘int’, ‘Number’, ‘precision’, ‘rounding’, ‘standard’, ‘to’, ‘uint’, ‘unit’;
- Add LikedPattern to Parameter;
- Add ‘like’ predicate to ResultType;
- Remove ParameterKind and use in Parameter
Category: GWT
, JavaScript
The Google Web Toolkit has long been a bastion of Java developers who are able to chant “We don’t want your stinking JavaScript!”
GWT is a lot more than a client side framework that allows you to write code in Java. It is a productivity tool that lets you developer and test a solution that performs well and works cross browser (huge wins). In fact, when I talk to people that are using GWT, the most common comment that I hear is how happy they are with:
- How the application just works cross browser
- How great it is to get a new version of GWT, run the new compiler, and get substantive performance improvements
Why should this just live in a Java world? Today, it breaks out. Google has released GWT for JavaScript 2.
With the upcoming birth of JavaScript 2 hopefully hitting our browsers, wouldn’t it be nice to build your Ajax applications using JavaScript, but also having the cross browser helpfulness that GWT gets you.
How does it work?
You write an application using JavaScript 2, and you then run it through a compiler which spits out the same optimized JavaScript source code that works for the various browsers.
Why write cross browser JavaScript when you can just write JavaScript?
This fits in perfectly with Steve Yegge releasing js2-mode, a new JavaScript 2 module for Emacs that has a lot of great features:
- Asynchronous highlighting
- Code folding
- Comment and string filling
- Syntax errors
- Strict warnings
- jsdoc highlighting
Also, Didier has posted the news that GWT has been submitted to the JCP as JSR 404.
Monday, March 31st, 2008
Category: JavaScript
, Library
Tavs Dokkedahl has created a set of Date methods which people might find helpful in his JSLab standard libary.
Included are Date.getISOWeek, Date.setISOWeek, getFirstDateInWeek, Date.isLeapYear, and Date.format which works like the PHP equivalent.
In addition the library also includes other useful functions for Array, Math, Number, Function and other objects.
Friday, March 28th, 2008
Category: Articles
, JavaScript
JAVASCRIPT:
-
-
TheRulesAre(function() { with(this) {
-
-
a(Player).mayNot('buyProperty').unless(function(player, property) {
-
return property.owner === null &&
-
player.funds>= property.price;
-
});
-
-
a(Property).mayNot('addHouse').when(it().isMortgaged());
-
}});
-
Composing DSLs in JavaScript is James Coglan's latest perusal into fun with JavaScript and DSLs.
He walks through the building of this DSL in a step by step manner. He uses his JS.Class library, but you could of course substitute your favourite JavaScript library.
Category: JavaScript
, Presentation
, jQuery
John Resig has published his JavaScript and jQuery talk that he gave at Northeastern. What does he cover?
I covered the basics of JavaScript - targeted to a Computer Science major (in the case of the students at NU, they learn Scheme and Java so I emphasized the subject matter to that audience). I did a fast run-through of the whole language, covering the main points, and move on to a quick inspection of jQuery and the DOM - closing with some Q&A. The subject matter of JavaScript 2 (and 1.6-1.8) came up a couple times so discussion of that was interspersed throughout. There were a bunch of jQuery users in the audience and it was great to get to hear their feedback.
Thursday, March 27th, 2008
Category: JavaScript
, Library
, Ruby
, Showcase
This is from the "wow, really?" department. HotRuby is an implementation of Ruby in JavaScript!
The way it works is that a HotRuby "VM" takes the resulting output from YARV and can grok it via JSON:
RUBY:
VM::InstructionSequence.compile(cgi['src'], "src", 1, OutputCompileOption).to_a.to_json
Thus, you can embed Ruby by doing something like this:
HTML:
-
-
-
class Pi
-
def initialize
-
@a = 355.0
-
end
-
-
def calc
-
b = 113.0
-
return @a / b
-
end
-
-
PI = 'PI is about'
-
end
-
-
puts Pi::PI
-
puts Pi.new.calc
-
</script>
-
-
<body onload="prettyPrint(); new HotRuby().runFromScriptTag('/compileRuby.cgi')">
-
Since you can run on any JavaScript interpreter or VM, they also support Flash.
For example, check out this Box2D example written in Ruby, running in Flash:
