As promised, a little description of Remus. :)

Not Null references:
I chose this syntax: int& b = a; because I like it in C++. This syntax is recognized by Remus and is converted to: Ref!(int) b = a; If you must give a reference to a function or other things like that, you can write:
[code]
Foo obj = new Foo();
some_function(@obj)
[/code]
instead of
[code]
Foo obj = new Foo();
{
        Foo& robj = obj;
        some_function(robj);
}
[/code]
Namespaces: You can declare a namespace this way:
[code]
namespace io {
        void print() {
                writeln("foo");
        }
}
[/code]
you _cannot_ use it without explicit "use" statement (will maybe change). So you must write [code]use io;[/code] to use _all_ methods from "io", or, like import, [code]use io : print[/code] or [code]use io : write = print;[/code] "use" statements are converted to one or more alias' and namespaces to (mixin) templates.

not null safe invocation:

If you have an object which can be null, you can write: obj?.print(); the print method is only called, if obj is not null. It works even with more than one '?': obj?.getOtherObj?.print(); but then you have to take care of some special weakneses: Until now you can not write obj?.getOtherObj()?.print() because the parent's aren't recognized as valid identifiers for '?'.
So you must use properties or this workaround:
[code]
Foo otherObj = obj?.getOtherObj(); // otherObj is null if obj is null
otherObj.print();
[/code]
Furthermore you cannot use '?' in the middle or end, or with breaks. So these are valid: a?.b.c and this a?.b?.c but these a.b?.c and a?.b.c?.d not.

I described some more examples, do's and don't's on my website.

Stack Instances:
There aren't many words for: if you need a stack instance, write: local Foo f = new Foo(); it's more or less the same as scope.

My next version will contain the elvis operator:
[code]
Foo obj = otherObj.get() ?: null;
if otherObj.get() is _not_ null, it will assign to obj, otherwise obj will be assigned with null.
[/code]

And maybe cast's with 'as'. But my main interests are to fix the bugs and weakneses.

That's it. Sorry for the few words, but I'm a bit busy right now. If you have questions or suggesstions you can write it here,
I will read it every evening.

Reply via email to