Monday, November 17, 2014

Introduction



Welcome to the Excess Platform Prototype. Here is what we have:
  1. A semi-useless programming language created as a super-set of C#
  2. A still raw method to augment the C# language independent of xs
  3. A lot of ideas

A bit of history, I spent an inane amount of time in the previous incarnation of xs that went very far in terms of technology and that nobody ever used. It eventually died and you can find it here, for nostalgic reasons. The idea of the project was not only for me to have fun with languages, but to create one with the ability to generate code for multiple platforms.

Back in the present, Microsoft has released Roslyn, a compiler platform which is, by any means; great. I was able to recreate the old xs in about 2 weeks, and now we're here.

As for xs, the language; it intents to be a useful for quick prototyping without all the seriousness of production languages. The main intention of this project is not that language and it can be considered made-for-fun, because one must have fun.

Now, for the useful part of the project, we intended to utilize the various aspects of the old project:
  1. To link language artifacts with external data. In other words, to allow parts of the definition of objects, etc to come from a data source (XML, JSON, etc)
  2. User created DSLs, or the ability for users to modify the language (by adding domain specific languages) independently of the original language designers.
  3. Multiple language targets, the platform will translate to xs code into multiple existing programming languages.
At the moment there is very little of all that done, but the work has started on DSLs, here is an example:

        asynch()
        {
          var x = expensive();
         
          synch()
               {
                  notify(x);
               }
        }

This was fairly revolutionary when first written, now with the asynch additions to C# it is more of a sad example, but it will do. The functioning of the sample should be clear, the expensive operation will be executed in a separate thread while its result will be notified in the same thread that triggered the asynchronous operation, possibly the UI thread.

The asynch/synch construct is not meant to be part of the xs language, and it is done using the tools the project wants to perfect. Next post will get to that, but in the meantime we will leave you with the result of compiling the sample code using the Excess compiler:

        SynchronizationContext __ASynchCtx = SynchronizationContext.Current;
        Task.Factory.StartNew(() =>
        {
              var x = expensive();
              __ASynchCtx.Post(() =>
              {
                    notify(x);
              });
        });

Not as pretty.

These small languages are fun and can be quite cool, it shouldn't be hard to imagine variations. It would be great to be able to to write F# alongside C# code for certain problems. This is a sample we intend to provide and should quite useful. SQL is another prime example and I'm sure your ideas are quite better. Leave a comment, try the site.

No comments:

Post a Comment