Chasing Windmills Oncemore.

Published December 12, 2007
Advertisement
I have got it into my head to create a programming language. No idea why really. I am woefully ill-equipped for such an endeavor. I have Moe to work on. And I really should be learning other languages or getting things done.

Alas, my whimsy will heed no logic. And it's not exactly a new language anyways. Basically, I want to extend C# with two features.

1. Interface DuckTyping.

I found out this is already done assuming you've got sufficient permissions without language extension. The basic idea is not requiring an interface to be inherited in order to pass an object meeting its requirements to it.

    public interface IFoo {        void foo();    }    public class Bar {        public void foo() { Console.WriteLine("Foo."); }    }    class Program {                static void Main(string[] args) {            IFoo Baz = Duck.Type(new Bar());            Baz.foo();        }    }


A language extension will likely make that casting implicit.

2. Method Improvements

C#'s delegates suck. Typeless delegates are useful (beyond Func<> and Action<>). Expressions look to be useful, but are slightly orthogonal. You still need to give them a delegate and they effectively compile into delegates it seems.

Method signatures should be usable anywhere a Type is needed. Delegates should provide more info/methods to do useful things (like binding/adapting). I imagine this feature will involve tons of gotchas... [method groups don't really exist, lambdas aren't really delegates, delegates aren't inheritable, action and func are limited and not interchangable tmk]


So the general idea is get something that compiles the language to C# as the intermediary language. If it sucks little, then I might play around with the Visual Studio SDK; seems like an amusing thing to do.
Previous Entry Updates.
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement