[Top][All Lists]

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

Re: [DotGNU]About scripting: SilverScript

From: David Sugar
Subject: Re: [DotGNU]About scripting: SilverScript
Date: Mon, 10 Jun 2002 21:42:18 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0rc3) Gecko/20020523

I do not object to the idea of a new web services scripting language. It sounds a bit like what you have in mind may turn out to be to C# what php is to C, and that may not nessisarly be as horrible :). Nah, php is okay. I think it is an interesting idea, although, one might claim that a transcoded virtual machine implemented language like C# is already a scripting language :). I will have to look at your document, but I think it could be interesting...

Peter Minten wrote:

Hi folks,

I've been doing some thinking on what would be the ideal scripting
language for webservices. The main requirements I thought of were:

* Object-Orientedness
* Strong typing (to avoid errors)
* Clearness of what code does (no C irregularities)
* Code readability
* Simplicity
* How easy it is to call C# code

I've run down a couple of scripting languages I know and put up why I
think they all don't do:

*VBScript: it doesn't support strong typing

*JScript: it doesn't support strong typing

*Python: seems to meet all requirments, implementing the callling of C#
code would be a little tricky however

*Perl: due to the context dependent actions it's often not clear what
the code does and it also makes perl a bit hard to learn (there are few
really strict rules)

*Lisp: not object-oriented so connecting to C# code is hard, due to the
lack of special characters the code is  hard to read for anyone except a
lisp programmer, this scares of newbies

There is also a 6th option: SilverScript (working name, I haven't been
able to think of a better name yet :-). I went to my drawing board
yesterday to draw up what a good scripting language would need, I ended
up drawing up a scripting language. I've attached the main design
document of SilverScript to this message (the language still needs a lot
of work though, this is only a days work).

The main idea of SilverScript is a C#-like scripting language that does
not inherit the traditional C illogicalness. Also I threw in my personal
developers itch, changing program code while running. The result is a
scripting language mostly similar to C# with a simplified strong typing variable system. SilverScript can almost all of the code in pnetlib
(delegates may prove difficult, the rest will be easy) and can use
code in any IL file, thus being a kind of IL scripting language.

IMHO SilverScript is the best option, what do you think about it?




SilverScript idea file. Copyright 2002 Peter Minten. This file may be
distributed under the terms of the GNU FDL.

Important properties of SilverScript:
* SilverScript is object-oriented
* SilverScript supports events
* Global functions are possible
* Strong typing
* Scoping
* Exceptions through events
* C like syntax
* Overloading

Data types:
Object (the parent of all others)
Number (any number that stays within the scope of C#'s biggest data type)
String (text)
Void (the old void data type)
Composite (term for any other data type)

Everything (variables, function definitions, event definitions, class
definitions and event connectings) exists only in the scope (code
block) in which it was created.

There is no forward declaration, a functions contents must be entered
at the time the function is defined.

Comments are C and C++ style (/**/ and //).

Execution starts at function void main().

Note: the number of arguments are not limited, the argument numbers
here are only examples.

Variable definition (FOO is not in the syntax but indicates that part
is to be replaced by something described in the part):: TYPE NAME

The types can have a modifier prepended, this can be either ref or val
(val doesn't exactly need to be prepended since it's standard). Ref
means pass by reference, val means pass by value.

Function definitions:


Array definition:

The number of arguments decides the number of dimensions. This is
limited to max. ten arguments.  If an number of elements part is
ommited this dimension is considered range 0 to infinite, this comes
down to 0 to max greatest integer in C#. Arrays are accessed in normal
C (NAME[NUMBER]) style.

Class definition:
        /* Constructor, recognizable by the 'constructor' name */
        constructor (TYPE NAME);

        /* Functions, recognizable by the ( ) */

        /* Variables */

Multiple namespace names can be preppended to the class name. Example:

Inheritance never copies private methods and variables. To inherite
simply put the class name of the class you want to inherit from behind
the inherits part.

Access modifiers control if these things can be called from outside
the object, they can be either 'public' or 'private'.

Constructors are normal functions except that they have the name

A scope level is surrounded by <> or {}.

Whenever a statement is expected a block ( {} ) or an empty statement
(;) can be put (though it is questionable if empty functions are

Events are declared like functions with the exception that they don't
have a return type and don't have need for an implentation.  Any
implementation is ignored. When an event is called the interpreter
throws the event, the connect definitions read decide what functions
need to be called. If there is more than one function for the event
then the last registered function is called first, when that finishes
the second last registered is called and so on.

Event definition:

Connect definition:

The parameters don't need to match (so that for example to much data
can be ignored).

Exceptions are events that if they aren't caught stop execution. Local
exception checking is possible by putting the connect statement in a
local codeblock.  Events will always go for the last registration, use
that. Exceptions are of form Exception_NAME, they can be created like
normal events. Events are thrown manually by calling them as a (return
type void) function, after the throwing of an event a function
continues after the event calling. Example: /* Throw event Exception_NoMem() */ Exception_NoMem();

All methods can be redefined, simply by defining them (using scope
(appending namespaces and class names if needed) and by appending
'redefine' to the definition (this is for preventing accidental
redefinition problems)

Every variable has two methods attached to it (the accessors).  Every
code uses the accessors (if they exist, otherwise old simple
assignment rules apply) with the exception of class code, they have to
explictly call the accessor methods using NAME.get() and NAME.set().
The accessors are set using declaration: redefine VARIABLENAME.get() {CODE} redefine CLASSNAME.VARIABLENAME.set(); /* This means that the standard set code is activated: oldvalue = newvalue */

It's also possible to get the code from the function into a string or
set the code to the value of a certain string. This is done using the
special operator -> (special variables operator) which is only used
for this and special variable 'code'. It works like this:

String STRINGNAME = FUNCTIONNAME.get()->code; /* This also works for set */

redefine FUNCTIONNAME.get()->code = STRINGNAME; /* When redefining use redefine */

SilverScript has three ways of accessing data outside of the file. One
is reading another file first, the others are IL/invoke (for running
code in IL) and P/Invoke (for running native code).

Reading works simply like this: attach a 'readscript' directive at the
beginning of the file that points to the file you want interpreted
first. This way: readscript "FILE_NAME";

IL/Invoke is similar, just set the name of the file you want to
access. This way: readil "FILE_NAME";

You can use things from scripts and IL without declaration, but you
have to declare P/Invoked functions. You simply declare the things
name using a special command (things are data, functions and classes):

extern ("THINGNAME", "FILE_NAME");

reply via email to

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