Hi Phil,
I agree with you - that case I think is nonsensical. I was going to
get some more wisdom
by experimenting with the flex compiler, but it doesn't support !
or ? in types.
At all - syntax error. These cases are shown in the ECMAScript 4
Language Overview final draft, but that's not a standard yet, so maybe
nobody is implementing it.
BTW, there will be many other cases in this area that we cannot catch
in the grammar,
like basic type snafus:
var v_typed_q:int = "hello";
and is this:
var v:int! = 1;
even valid? (A primitive type like int may not accept nullability -
it wouldn't make sense in Java).
My first temptation is to accept any such cases in our grammar and
let the backend compiler flag them
as errors for us.
But given that the language feature isn't in flex, I'm not sure what
to do, leave '!' '?'
in for a future day, or take them out. ?!
Tucker - opinion on this? Am I wrong to be looking at the ECMAScript
4 overview?
- Don
On Nov 7, 2007, at 8:22 PM, Philip Romanik wrote:
Approved.
If I write this line of code, no error is generated, but it doesn't
seem right. Is this legal ecma4?
var v_typed_q:?int! = 123;
(Perhaps somebody else can chime in here. Is /test/lztest still the
preferred way to write a unit test? If so, this test can be
converted into lztest format.)
Change 20071107-dda-g by [EMAIL PROTECTED] on 2007-11-07 18:14:27 EST
in /Users/dda/laszlo/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Allow type information for vars, even though ignored in
SWF7/8 and DHTML.
New Features:
Allow type information accepted in ActionScript 3.0, that is:
var x:int;
var y:String = "hello";
var z:?String = null; // ? means can set to null (default)
var z:String! = "bonjour"; // ! means cannot set to null
Please note that the type information is merely accepted as
part of the language, and ignored for now.
Bugs Fixed: LPP-5059
Technical Reviewer: ptw
QA Reviewer: philip
Doc Reviewer: (pending)
Documentation:
Requires documentation if we describe in detail our language
(or subset). If we point
users to the published standards, then we can continue to do
that.
We should note that type information is ignored except for the
(upcoming) SWF9 runtime.
Release Notes:
Variables declared using the 'var' statement now allow type
specifications as
described by Ecmascript 4 (that is, ActionScript 3.0).
Details:
No type checking is done by the SWF7/8 and DHTML runtimes
(nor is planned), any
type information is thrown away. However, when SWF9 is
available, the type information
will be accepted and passed through to the 3rd party SWF9
compiler, which will do type
checking for any variable with type information. This change
allows users and developers
to write code that can be useful with either runtime. Even
if they don't use with SWF9,
this is a useful feature for self documenting usage of
variables.
We currently allow type information on 'var' declarations,
also method parameters and
method return values. I believe only information for 'var'
declarations can be done
in .lzx, but the latter two are also accepted (and ignored
for current runtimes) in .lzs files.
Tests:
Ran new test test/typevar.lzx for both SWF7/8 and DHTML, to
make sure syntax is accepted.
Ran smokecheck.lzx to assure there are no regressions.
Files:
A test/typevar.lzx
M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/Parser.jjt
M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/parser/
ASTIdentifier.java
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20071107-dda-
g.tar
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
Voice: 617-547-7881
Email: [EMAIL PROTECTED]
WWW: http://www.ddanderson.com
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
Voice: 617-547-7881
Email: [EMAIL PROTECTED]
WWW: http://www.ddanderson.com