Remus

bearophile bearophileHUGS at lycos.com
Tue Oct 9 14:07:45 PDT 2012


Namespace:

> 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);
> }

This seems far from being well designed not-nullable 
pointers/class references :-(


> [/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.

But what are they useful for?


> 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.

scope was removed for certain reasons, are those reasons not 
valid for "local"?

Bye,
bearophile


More information about the Digitalmars-d-announce mailing list