April 17th, 2008
Is it good to have something like that:

To me -1 or -99999 is not a good way to express absence of item. Why? Because this is syntactical level which is rather concrete - which means it could change in unexpected way.
In case the function/method would return special values it will be better to have someting like this:

then:
if ( table.IndexOf(column) == -1)
{
return ColumnIndex.NullIndex;
}
Looks better, but again not perfect. This approach now using semantical differences between ordinary index and NullIndex.
Another step - distinguish special empty class:

But this is also not perfect…..
April 4th, 2008
Today I published a Sample game application featuring several ideas:
- Windows Presentation Foundation (WPF) UI,
- Script.NET language to provide AI,
- Min-max algorithm for playing Tic-Tac-Toe.
The purpose of the sample is to demonstrate Script.NET language as a part of more complex .NET application. These toy application implements two players (user and computer) Tic-Tac-Toe game.The design of example is preatty simple:UI interface was created with Visual Studio 2008 Express using WPF designer.

The game’s logic (AI) is provided by external algorithm executed with Script.NET engine. This algorithm is implemented in AI.SDN file (this file should be located in the same dir as exe file).It may be modified and improved in certain way without recompiling the application. This may be a good excercise.
The .NET application provides Script.NET Engine with reference to the UI interface, so it is able to modify a view state. It is implemented via single function SetPoint( index ). The example show interaction between .NET code and Script.NET engine via shared variables (references) and IInvokable interface.
Prerequesties to run the application:
- Windows XP or higher
- .NET framework 2.0 and 3.5
March 28th, 2008
This entry will start a series of posts about Script.NET language features.
The first feature I would like to introduce is Contracts and Mutanic objects. I will start with an example. It will implement a verified collection. The collection will satisfy following requirement: it should contain no more than 10 items.
In the example I will use a Stack of integers. (Stack<int> in C#):
stack = new Stack<|int|>();
I will override two functions of stack: Push and Pop. For this purpose I will use DataMutant. DataMutant is a class that is able to decorate any existing .NET class. Because Script.NET is dynamically typed language there is no need to care about function signatures. Moreover, Script.NET uses Late binding for searching object’s functions.
To create a DataMutant object I will use special language construct:
mObject=[Push->Push,PopCheck->Pop];
It will create an object with two fields Push and PopCheck. Because, these fields are function pointers (they implement IInvokable interface) it is possible to invoke them as well: mObject.Push(20).
One more step is to decorate original stack: mObject.Mutate(stack).
One more thing that should be mentioned is function’s contracts. They are represented by three conditions: pre-, post- and invariant. Their semantics is very simple: pre condition should be satisfied before function body is being executed. post conditions should be satisfied after function body execution. invariant condition should preserve the value between function execution.
All above said is summarized on the following code snippet. Further instructions are at the bottom of the post.

Code for this exampleTo run an example proceed the following steps:
- 1. Open Code for this example and copy it
- 2. Open Script.NET on-line
- 3. Paste the Code
- 4. Press “Evaluate with Irony”
- 5. Change the number 5 in for statement to 15
- 6. Run example once again
- 7. See the precondition exception
March 28th, 2008
The upcoming release of Script.NET language will bring to the language a set of new features.
Among them are:
- *using statement
Here is example:
using(Console)
{
using(Math)
{
//Call Console.WriteLine(Math.Pow(2,10).ToString());
WriteLine(Pow(2,10).ToString());
}
}
You can try this example on Try On-Line. Click “Evaluate with Irony” button;
- *new syntax for generic types, like list = new List<|string|>(); for simplifying grammar;
- *exception handling;
try
{
throw new Exception(’Exception test’);
}
catch(e)
{
msg = e.Message;
}
finally
{
Console.WriteLine (’Message:’+msg);
}
- *new metafeatures;
- *run-time extensibility with custom Contexts, Scopes, Functions.
- *debugger. now you will be able to debug script.net programs:
Download Debugger Preview.
March 25th, 2008
Good news for Script.NET users. I have started reworking the language run-time because of the large feedback about first release. Hopefuly the new version will be more stable and efficient. The grammar of the language was also changed. The changes are minor and will not impact the majority of the exisiting code.
The preview of the future release was published:DownloadPreview
Info:
Irony is a new-generation .NET compiler construction kit. It utilizes the full potential of c# 2.0 and .NET Framework to implement a completely new and streamlined technology of compiler construction. Unlike most existing yacc/lex-style solutions Irony does not employ any scanner or parser code generation from grammar specifications written in a specialized meta-language. In Irony the target language grammar is coded directly in c# using operator overloading to express grammar constructs. Irony’s scanner and parser modules use the grammar encoded as c# class to control the parsing process
Script.NET is a language that provides scripting functionality in .NET applications, embedding custom functionality into CLR applications. It is very simple, yet powerful enough to satisfy usual needs for scripting your application.