Empty string is null?

2009-05-30 Thread hasen
How to pass it to C functions that expect a non-null string? Specifically to GTK+ (using gtkD) I also asked this on stackoverflow http://stackoverflow.com/questions/931360/ Using D1 with phobos I have a text entry field, instance of gtk.Entry.Entry, calling setText("") rais

Re: legal identifier check

2009-05-30 Thread downs
Saaa wrote: > Is there a function to check whether some string is a legal identifier? > > Sure. static if(is(typeof({ /* code to be checked for validity goes here */ }))) ...

first ddata load attempt

2009-05-30 Thread Saaa
Attached my first attempt to load int and int[] from a D-styled data file. Adding the functions to support the other types is trivial (hope to be using templates :) but supporting an arbitrary deep array isn't that obvious to me yet. Please comment :) ps. it uses std2 because of the possible tem

Using regexp over newlines

2009-05-30 Thread Jesse Phillips
Maybe this is a bug, but what I'm trying to do is select a substring that contains any number of new lines between some other regular expression. I'm doing this in D2 import std.stdio; import std.regexp; void main() { string tester2 = r"W((.*\n.*)+)z";//gives me 3 separate matches not 1.

legal identifier check

2009-05-30 Thread Saaa
Is there a function to check whether some string is a legal identifier?

Re: taking a crosssection of a 3-D array

2009-05-30 Thread bearophile
Andrew: > So, how do I take a cross section of a 3-D array. Basically I want to be > able to take a 2D matrix from a 3-D array. > auto m = a[][n][]; Languages (or libraries) like matlab and NumPy allow to slice nD arrays like you say, using a very compact syntax, but currently the D1/D2 languag

Re: expression

2009-05-30 Thread bearophile
Frits van Bommel: > To allow two expressions separated by a comma to be another expression. This > is > only useful if the expression before the last comma has side-effects of > course, > since its value isn't used. Such an expression returns the result of its > right-hand side. > For example:

Re: expression

2009-05-30 Thread Frits van Bommel
Ellery Newcomer wrote: what is the purpose of the expression grammar Expression: AssignExpression AssignExpression , Expression ? (emphasis on the comma) To allow two expressions separated by a comma to be another expression. This is only useful if the expression before the