« Version 0.5.5 | Main | Version 0.3.6 »
Tuesday
Jul222008

Version 0.4 released.

Version 0.4 is released now. Download.

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (12)

Hi Olav,

function references within classes don't appear to compile with the new version.

i.e.
this will compile fine:
function test1()
{
var test11 = function() {};
}

but this won't:
class test2
{
function test1()
{
var test11 = function() {};
}
}

and the same with this:
function test1()
{
var test11 = function() {};
}

class test2
{
function test21()
{
var test211 = test1;
}
}

I'm using your compiler to learn ecmascript4...so is this expected handling in the language?

Thanks for the great work!

July 22, 2008 | Unregistered Commenterboniestlawyer

Hi boniestlawyer,

you have discovered a bug. I have uploaded a new version, 0.4.1, with a fix. Thank you very much for reporting thing.

Nice to hear that you find the compiler useful. Hope you have fun with it!

July 23, 2008 | Unregistered CommenterOlav Junker Kjær

Olav,

You're doing awesome work!

Just curious: what changed between 0.3 and 0.4?

-- Peter Rust

July 23, 2008 | Unregistered CommenterAnonymous

Apart from the new bugs you mean? :)
- Triple quoted strings and multiline regexes.
- Function expression signature can now be annotated to indicate the type "this" inside the function.
- prototypes now shared between int/float/Number, string/String and boolean/Boolean.

I'll write a blog post detailing the new features when I get time.

Thanks for the nice words!

July 23, 2008 | Unregistered CommenterOlav Junker Kjær

Hi Olav,

Is it possible in the current state to cast a value as an inherited type. Example:

import browserapi;
import htmldom2;

var e : HTMLSelectElement
= document.createElement("select");

This throws the warning: Variable e of type HTMLSelectElement is not compatible with expression documentselect (HTMLElement)

July 24, 2008 | Unregistered Commenterboniestlawyer

Hi boniestlawyer, you have to write:

import browserapi;
import htmldom2;

var e : HTMLSelectElement
= document.createElement("select")
cast HTMLSelectElement;

July 24, 2008 | Unregistered CommenterOlav Junker Kjær

BTW, if you feel that the redundant HTMLSelectElement is redundant, you can just write:

var e = document.createElement("select")
cast HTMLSelectElement;

The compilers then figures out that the type of e is HTMLSelectElement.

July 24, 2008 | Unregistered CommenterOlav Junker Kjær

wow, that's awesome, thanks olav!

July 24, 2008 | Unregistered Commenterboniestlawyer

> I'll write a blog post detailing
> the new features when I get time
No worries. I don't mind if the blogging is a bit sparse if that means you're spending more time coding! (eagerly awaiting Array Comprehensions and Operator Overloading)

-- Peter Rust

July 25, 2008 | Unregistered CommenterAnonymous

Hi Peter,
I'm afraid it seems like operator overloading has been removed from the current draft of the ES4 spec. Perhaps it will reappear in a later version.

Array comprehensions are a priority though, since they are also one of my favorite features :-)

July 25, 2008 | Unregistered CommenterOlav Junker Kjær

Hi there. Do you know if the "module" pattern that is used in existing Javascript will work with the namespaces of ES4?

For instance, if I try:

namespace foo;
(function() {
foo var bar = 10;
})();
foo::bar;

It errors out saying 'bar' is not defined at Program scope for namespace 'foo'. Which makes sense, since 'bar' is defined in the anonymous function. However, how could I add something to the 'foo' namespace from within the anonymous function?

Thanks :)!

October 26, 2008 | Unregistered CommenterAnonymous

Hi Anonym,
That is an interesting issue.
It seems that what you propose is not possible. You cannot define a global variable in a namespace from inside a non-global scope. I'm not yet sure it this is intentional or an oversight in the spec.

However, namespaces are intended to solve the same problem that the module-pattern intends to solve (that is, avoiding name clashed between modules), so I guess you wouldn't need to use both at the same time.

October 31, 2008 | Unregistered CommenterOlav Junker Kjær

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>