> From: JP Bader [mailto:j...@zavteq.com] 
> Sent: 23 February 2012 17:10
> 
> The only question/reference point I have is the lack of requirement for
this in several other  
> languages I've recently been learning, i.e. Ruby, Python, Scala (IIRC).
They can compile 
> just fine with or without ';'.  Is it really that important to make this
required?
Scala has the same sloppy approach to semicolons as AS3 and so suffers from
similar problems when the compiler does and doesn't infer semicolons
wrongly, eg see
http://stackoverflow.com/questions/2246212/why-does-scalas-semicolon-inferen
ce-fail-here. In this case "well Scala does it badly too" seems a poor
argument.

Ruby (as far as I know) does things properly. A newline always denotes the
end of an expression. So BNF can precisely depict the language as ";" and
"\n" are equivalent. Semicolons aren't really optional in Ruby, it just
makes no sense to put them at the end of a line.

I don't know Python, so cannot comment on that.

When a language uses sloppy optional semicolons, one is forced down one of
two paths with a parser: hand craft a parser (the approach used for mxmlc I
believe) or hack a BNF-based one to handle the semicolons (the approach
taken by Falcon.) I'd prefer to avoid both of these methods and instead to
come up with a precise BNF definition of AS3 (or as near to AS3 as BNF can
get.) Doing so will make writing the parser far easier and gives us a parser
that can be expressed in a meta language. A whole range of different
language-based compilers (C, C#, Java, etc) can be generated from the one
source.

David.



JP

On Thu, Feb 23, 2012 at 6:53 AM, saurabh jain <jainsaurab...@gmail.com>
wrote:
> +1 to mandatory semicolon.
> I always thought why this was not mandatory.
>
> Regards,
> Saurabh



--
JP Bader
Principal
Zavteq, Inc.
@lordB8r | j...@zavteq.com
608.692.2468

Reply via email to