dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]About scripting: SilverScript


From: Rhys Weatherley
Subject: Re: [DotGNU]About scripting: SilverScript
Date: Tue, 11 Jun 2002 10:55:12 +1000

Peter Minten wrote:

> * Strong typing (to avoid errors)

One of the strong points of most scripting languages is
that they aren't strongly typed, but rather weakly typed.

e.g. you pull a string out of a POST'ed form field and
immediately use it as a number to perform computations,
without needing to explicitly call an "atoi" function.
The engine knows how to convert for you, driven by what
you are trying to do.

This accelerates development time, allowing you to
focus on what you want to do, rather than how to do it.

> Function definitions:
> TYPE NAME (TYPE NAME, TYPE NAME)
> {
>         CODE
> }

The "TYPE NAME" syntax is one of the main reasons why
C-style languages are such a pain to parse.  It creates
ambiguities in the grammar that are very difficult to
resolve without multiple passes and horrible hacks.

More recent versions of JavaScript/ECMAScript use a
C-like syntax for everything except variable and
function definitions.  Instead, they use something
like this:

function NAME (NAME : TYPE, NAME : TYPE) : TYPE
{
    var NAME : TYPE;
}

i.e. they use Pascal-like declarations and extra keywords.
This removes the ambiguities in the grammar, allowing
the parser to process the script in a single pass with
a simple recursive-decent approach.

I suggest that you go look at the ECMAScript spec,
as they've already solved most of these problems:

    http://www.ecma.ch/

Look under "Publications" for ECMA-262.

Cheers,

Rhys.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]