Changes before 1.0

Jordan Miner jminer2613 at no.spam.students.pcci.edu
Sat Dec 2 12:51:27 PST 2006


Hello, I have been reading this newsgroup on and off for over a year, but this
is my first post. I first found D because I got fed up with the VMs of Java
and C# and the slowness of Ruby and Python. I went online to look for a
language that compiled to native code, but was easier to use than C++, and I
found D within minutes.
When I first started using D, there were many parts I though could be
improved, but I am OK with most of them now. I have been working on a GUI
library for D for months now, but I don't want to release it until it is
usable. While working on it, I have run into several things in D that I wish
were changed. Here are a few I think could be added before 1.0.

--1--
The following does not work, but it really should:
	void print(char[][] strs) { }
	print(["Matt", "Andrew"]);
Gives:
	Error: cannot implicitly convert expression ("Andrew") of type char[6] to char[4]
--2--
Sometimes using the property syntax causes a compiler error:
	with(obj.propName) {  // gives an error without parentheses
	}
	auto foo = obj.propName; // gives an error without parentheses
These are common uses of property syntax, and I think they should work.
--3--
I noticed one day that this kind of a loop is fairly common:
	while(true) {
		doSomething();
		if(!shouldContinue)
			break;
		doSomethingElse();
	}
It might be better to make an extended do-while loop that has code before and
after the condition:
	do {
		doSomething();
	} while(shouldContinue) {
		doSomethingElse();
	}
The latter is shorter and IMO cleaner.
--4--
It would be helpful if the following code would work:
	enum TestEnum {
		Value1, Value2
	}
	writefln("%s", TestEnum.Value2);
It should print "Value2", but instead gives:
	Error: std.format formatArg
While using C# the other day, I needed to know what enum value a variable was,
so I tried printing it and I got the name of the enum member.
	enum TestEnum {
		Value1, Value2
	}
	Console.WriteLine(TestEnum.Value2);
This prints "Value2" with .NET.
--5--
I know that it has been brought up before, but I would like to add my support
to this being put into object.d:
	alias char[] string;
-----

I also really want stack traces for exceptions/access violations and big Ddoc
improvements, but those don't change the language and can wait until after
1.0. I would also really really like to have closures/static delegates, but
that would probably take some time, what with escape analysis and all. BTW, I
really like how Walter wants to implement them--with the current delegate
syntax using escape analysis. D will be amazing then.



More information about the Digitalmars-d mailing list