Type Annotations ?
Lars T Hansen
lth at acm.org
Wed Oct 3 07:44:13 PDT 2007
The ES4 syntax for type annotations is invariably a postfix ": type"
phrase: put it on variable bindings, parameters, functions (following
the parameter list).
For example,
function dot( xs: Vector.<double>, ys: Vector.<double>): double {
let result: double = 0
for ( let i: uint=0, limit: uint=xs.lenght ; i < limit ; i++ )
result += xs[i] * ys[i]
return result
}
There are some subtleties with providing type annotations for names
bound by destructuring bindings; details can be found in the proposals
and are in any case forthcoming in a coherent writeup.
--lars
On 10/3/07, David Teller <David.Teller at univ-orleans.fr> wrote:
> Hi everyone,
> I'm still working on my static analysis tool for ES4. This tool will
> make use of custom type (or type-like) annotations. I wonder if there
> are already syntax guidelines for this kind of things. I assume I should
> put them somewhere in comments. Should I use something like Java's
> @annotation tag ?
>
> Thanks,
> David
>
>
> --
> David Teller ------------------------------------------
> Security of Distributed Systems -----------------------
> -- http://www.univ-orleans.fr/lifo/Members/David.Teller
> ----- Laboratoire d'Informatique Fondamentale d'Orleans
>
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es4-discuss
>
More information about the Es4-discuss
mailing list