Just out of curiosity, if I write say
int i = "abc";
in Java
I would get a compilation failure (even if the variable is not used).
Java is a statically-typed language.
Most of the time, XSLT compiles the program and executes it
in one pass. Can we say XSLT is a interpreted language, like
say JavaScript?
Compiled vs interpreted is a matter of the processor implementation, nothing
to do with the language itself. And it's a pretty fuzzy distinction these
days, because most processors actually compile down to some intermediate
representation which is then interpreted by some kind of virtual machine:
the question is how close that representation is to machine code. JIT
compilation makes it even fuzzier.
A clearer distinction is between strongly-typed and weakly-typed languages,
or (almost the same) statically-typed and dynamically-typed. XSLT is
essentially dynamically-typed (meaning type-checking isn't done until
runtime) except that there's provision for optional optimistic static typing
- which means you can report a compile-time error if you find a construct
that's guaranteed to fail if executed at run-time (as in your example), but
not (like Java) if there's merely a possibility that it might fail.
Michael Kay
http://www.saxonica.com/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--