allocate hash table manually

Johan Granberg lijat.meREM at OVEgmail.com
Tue Sep 5 11:01:13 PDT 2006


Mildred wrote:
> Hi,
> 
> I'm a new user od D language but immediately, I felt that was the
> language I always looking for. So I'm very happy to use it.
> I'm trying to convert my recent project to C (using a garbage collector
> as library) to D. It's a script language with a lisp syntax.
> 
> My question is how do I use new to allocate a hash table. My code is as
> follows :
> 
> class Value {
> 	...
> 	protected Value[char[]] _environment = null;
> 	...
> 	public void env_make(Stack S){
> 		_environment = new Value[char[]];
> 	}
> 	...
> }
> 
> But the compiler says : need size of rightmost array, not type char[]
> 
> My problem is that I want some Value objects to have an environment,
> and I want others objects without environment (so I use null).
> How can I do that ?
> 
> Thanks
> Mildred
> 

I think this is what I have used.

class Value {
	...
	protected Value[char[]] _environment = null;
	...
	public void env_make(Stack S){
		Value[char[]] e;
		_environment = e;
	}
	...
}



More information about the Digitalmars-d mailing list