Re: How do I find the arity of an Expression? (dmd hacking)

2009-11-30 Thread Ellery Newcomer
On 11/30/2009 12:32 PM, Chad J wrote: Ellery Newcomer wrote: On 11/30/2009 03:53 AM, Ary Borenszweig wrote: Chad J wrote: Given an Expression object in dmd, I'd like to know how many subexpressions it contains and, even better, iterate over them. I'd like to do this in a general way, without

Re: How do I find the arity of an Expression? (dmd hacking)

2009-11-30 Thread Ellery Newcomer
. Here's some chicken scratch that more or less illustrates what I envision going on (I can't attest that DMD's ASTs look exactly like this, but I assume they're similar): http://personal.utulsa.edu/~ellery-newcomer/scribble.png How much effort it would entail is another matter though. I

hello world

2009-11-21 Thread Ellery Newcomer
Just switched back to 64 bit fedora, and wonder of wonders, dmd doesn't work. Well, actually dmd sorta does. The linker doesn't. I'm getting $ ./dmd test.d /usr/bin/ld: crt1.o: No such file: No such file or directory ideas? dmd 2.036

Re: hello world

2009-11-21 Thread Ellery Newcomer
On 11/21/2009 02:11 PM, Jesse Phillips wrote: On Sat, 21 Nov 2009 14:01:23 -0600, Ellery Newcomer wrote: Just switched back to 64 bit fedora, and wonder of wonders, dmd doesn't work. Well, actually dmd sorta does. The linker doesn't. I'm getting $ ./dmd test.d /usr/bin/ld: crt1.o

Re: Question about mutable arrays

2009-11-19 Thread Ellery Newcomer
A Bothe wrote: Hey guys, I've found a problem that occurred since DMD 2.034: When I've created a dynamic array like string[] a; and I want to assign something via the index of this array a[0]=Test; DMD says the array isn't mutable...even if these are normal types like int or char.

Re: multidimensional dynamic arrays

2009-11-16 Thread Ellery Newcomer
Trass3r wrote: Ellery Newcomer schrieb: auto array = new ubyte[][](width*height, numSprites); params might be backwards.. Ah yeah, thanks, that was it. Don't get the reason for that syntax. I think it has something to do with uniformity inside templates or something. alias ubyte

typeof and my crummy code...

2009-11-05 Thread Ellery Newcomer
given tak.d: import std.stdio; void main() { //int[1][2]([3][4] i[5][6])[7][8]; int i(I)(int){return 1;} writeln(typeof(i).stringof); } $ dmd tak ./tak spits out 'void' does this make sense, or would it make more sense as an error for not appending the template argument? Or would it

Re: tuples

2009-11-02 Thread Ellery Newcomer
Ellery Newcomer wrote: Is there currently any way to get something like Tuple!(int,i) t = tuple(5); to work? Doh. It looks like Tuple!(int,i) t = tuple!(int,i)(5); should work, but I'm getting the following error /home/ellery/download/dmd2035/dmd2/linux/bin/../../src/phobos/std

tuples

2009-10-31 Thread Ellery Newcomer
Is there currently any way to get something like Tuple!(int,i) t = tuple(5); to work?

Re: version specific enum members

2009-10-29 Thread Ellery Newcomer
Phil Deets wrote: Hi, is there a way to add members to an enum based on conditional compilation symbols. I tried enum Tag { A, B, version (symbol) { C, D, } E, } but it doesn't work. I know I could do version (symbol) { enum Tag { A, B, C, D, E } } else {

Re: Sorry, I just love templates, AAs and mixins :)

2009-10-17 Thread Ellery Newcomer
grauzone wrote: Saaa wrote: public void addToAA(char[] var_name, KT, ET)(KT key, ET element) { mixin(ET.stringof~`[]* elements = key in `~var_name~`;`); if( elements == null ) { ET[] temp; temp.length = 1; temp[0] = element; mixin(var_name~`[key] = temp;`); }

case statements

2009-10-10 Thread Ellery Newcomer
This is probably a bad idea, but from my readings of the dmd source, I noticed some preprocessor defines that looked useful, along the lines of #define CASES case A:case B: (etc) I'd kinda like something similar in D, but a naive attempt with mixins doesn't work, e.g. immutable string cases =

Re: case statements

2009-10-10 Thread Ellery Newcomer
Jarrett Billingsley wrote: On Sat, Oct 10, 2009 at 8:45 PM, Ellery Newcomer ellery-newco...@utulsa.edu wrote: This is probably a bad idea A single string mixin must consist of an entire, fully-formed statement, expression, or declaration (depending on where it's used). Case labels do

Re: case statements

2009-10-10 Thread Ellery Newcomer
Christopher Wright wrote: Ellery Newcomer wrote: Jarrett Billingsley wrote: On Sat, Oct 10, 2009 at 8:45 PM, Ellery Newcomer ellery-newco...@utulsa.edu wrote: This is probably a bad idea A single string mixin must consist of an entire, fully-formed statement, expression, or declaration

Re: How initialize a static rectangular array (2-d matrix)

2009-10-08 Thread Ellery Newcomer
Justin Johansson wrote: Jarrett Billingsley Wrote: On Thu, Oct 8, 2009 at 8:10 PM, Justin Johansson n...@spam.com wrote: Thanks Jarrett. Am I having a blonde day? int[2,3] m = [ 1, 2, 3 ]; writefln( m=%s, .sizeof=%d, m, m.sizeof); Compiles and prints: m=[1,2,3],

printable unicode

2009-09-18 Thread Ellery Newcomer
Is there anything analogous to tango.text.Unicode.isPrintable in phobos?

tango version identifiers

2009-09-17 Thread Ellery Newcomer
Does the tango build by any chance set any distinguishing predefined version identifiers?

Re: D2 Pointer confusion

2009-09-01 Thread Ellery Newcomer
Umm.. A shot in the dark? void main(){ struct SomeStruct{ int* p; void aa(int a){ *p = a; } } class SomeClass{ int a; SomeStruct foo(){ SomeStruct m; m.g = a; return m; } } SomeClass inst = new SomeClass;

Re: Error: constant false is not an lvalue

2009-08-30 Thread Ellery Newcomer
Steven Schveighoffer wrote: On Sat, 29 Aug 2009 20:15:55 -0400, Ellery Newcomer ellery-newco...@utulsa.edu wrote: void blah(out bool a = false){ // blah blah blah } compile time use of blah results in error. Am I doing anything wrong? out implies a reference. You can't have

overloading

2009-08-11 Thread Ellery Newcomer
Why is function overloading not applied to nested functions?

Re: alias syntax

2009-08-05 Thread Ellery Newcomer
-- As to your question: class K{ alias static int B; B b; // b is non-static } -- Curious. I didn't actually test the example, but I did for deprecated, and it doesn't get

alias syntax

2009-08-01 Thread Ellery Newcomer
what is the purpose of the syntax alias StorageClasses Declarator ? (I just noticed my parser doesn't support it, but I don't see any reason to)

Re: alias syntax

2009-08-01 Thread Ellery Newcomer
Jarrett Billingsley wrote: On Sat, Aug 1, 2009 at 8:31 PM, Ellery Newcomerellery-newco...@utulsa.edu wrote: what is the purpose of the syntax alias StorageClasses Declarator ? I don't know where you're getting that grammar. Is that from the D spec? um, yeah. Declaration:

Re: alias syntax

2009-08-01 Thread Ellery Newcomer
You mean how the compiler rejects alias const int x; but not alias static int x;? That is strange.. I want to know why alias static int x; is allowed in the first place

mixins

2009-07-09 Thread Ellery Newcomer
From the specs: It is not an error to have const module variable declarations without initializers if there is no constructor. This is to support the practice of having modules serve only as declarations that are not linked in, the implementation of it will be in another module that is linked in.

assert

2009-07-08 Thread Ellery Newcomer
I'm tired and witless just now, but I can't think of any reason why assert should be an expression and not a statement. Any clues?

symbol shadowing

2009-06-21 Thread Ellery Newcomer
when is symbol shadowing permitted/forbidden? It appears that it is only forbidden in multiple levels of statements, but not in multiple levels of declDefs

Re: Simple trampoline code

2009-06-11 Thread Ellery Newcomer
bearophile wrote: I'm trying to convert to D2 the following (quite simplified up) Python code, that implements a trampoline to run tail-call functions with no stack overflow: # Python code # *args means almost all the arguments def trampoline(fun, *args): thunk = lambda : fun(*args)

Re: Simple trampoline code

2009-06-11 Thread Ellery Newcomer
BCS wrote: Hello Ellery, bearophile wrote: I'm trying to convert to D2 the following (quite simplified up) Python code, that implements a trampoline to run tail-call functions with no stack overflow: [...] How DO you define the signature of a function that returns itself? Last I

tuples

2009-06-11 Thread Ellery Newcomer
what is up with this code? auto t = tuple(1,'a',3.333,false); pragma(msg,typeof(t.tupleof[2 .. $]).stringof); spits out (double, bool, int, char, double, bool)

Re: Inside the switch statement

2009-06-08 Thread Ellery Newcomer
BCS wrote: Hello Sam, To save time ,just get to my point:I do not understand why such code below inside the switch ... case statement is allowed ,what is the point of do ... while...: This is a classic C thing. The short explanation is that a switch is a conditional, many way goto and

expression

2009-05-30 Thread Ellery Newcomer
what is the purpose of the expression grammar Expression: AssignExpression AssignExpression , Expression ? (emphasis on the comma)

Re: more cyclical confoundedness

2009-04-08 Thread Ellery Newcomer
suggests that the above assumption will generate a large proportion of false positives, or else the compiler ignores a large proportion of true positives. Ellery Newcomer wrote: Hello. When I have three files test1.d test2.d test3.d as follows: module test1; import tango.io.Stdout; import test3

more cyclical confoundedness

2009-04-05 Thread Ellery Newcomer
Hello. When I have three files test1.d test2.d test3.d as follows: module test1; import tango.io.Stdout; import test3; static this(){ Stdout(test1\n); } module test2; import test1; //no ctor module test3; import tango.io.Stdout; import test2; static this(){ Stdout(test3\n); } and

Re: Symbol undefined on interface with public getter and package setter

2009-02-23 Thread Ellery Newcomer
Daniel Keep wrote: TSalm wrote: I'm not sure but I think package is not virtual. :-( So there's really no way to have a method declared package in an interface ? You also can't have a private function in an interface. This once lost me four days trying to figure out why my program wouldn't

Re: parsing parameters

2009-02-23 Thread Ellery Newcomer
BCS wrote: I don't understand your question. Are you suggesting that something be added or asking why something is allowed? Why is it allowed? for example: int myfun(int=10);

parsing parameters

2009-02-22 Thread Ellery Newcomer
is there any reason to allow BasicType AnonymousDeclarator = AssignExpression as a parameter? As far as I know, it's gibberish (but, then, I don't know very far).

Re: Cyclic Dependencies

2009-02-16 Thread Ellery Newcomer
Ellery Newcomer wrote: Hello all, I began learning D a few months ago, and now I have a question about cyclic dependencies (and some random whining). I come from a java background and have had no serious exposure to C++. In java, cyclic dependencies are legit to the best of my knowledge. I

Re: A array bug?

2009-01-28 Thread Ellery Newcomer
taqya wrote: Hi,i write this code. then d compiler is shutdown. Is it a array bug? //Digital Mars D Compiler v2.014 (windows) import std.stdio; int main() { char[] a = a.dup; char[] b = b.dup; writefln(a + b); //Error: Array operations not implemented return 0; }

Re: base class access specifier[s]

2009-01-19 Thread Ellery Newcomer
BCS wrote: Reply to Ellery, I don't buy that. Not that I'm a C guru or anything, but it looks to me that Parser::BaseClasses could be easily edited to make the point in question go away. it's not a parser thing but a grammar thing. It would be complex to define a grammar that allows one

Re: Cyclic Dependencies

2008-12-09 Thread Ellery Newcomer
Derek Parnell wrote: It is not a bug. A string literal such as true is a char[] type (UTF8), and the compiler will not implicitly convert UTF8 to UTF16 (wchar[]). Which would then beg the obvious wchar[] w = true;

Cyclic Dependencies

2008-12-08 Thread Ellery Newcomer
Hello all, I began learning D a few months ago, and now I have a question about cyclic dependencies (and some random whining). I come from a java background and have had no serious exposure to C++. In java, cyclic dependencies are legit to the best of my knowledge. I don't know about C++,

<    1   2   3   4