sizeof

2011-01-01 Thread Ellery Newcomer
Hello. Been trying to link to some C code with gdc on 64 bit, and I've been racking my brain over the following: //tok.d import std.stdio; struct x { union _u_{ ulong uq; struct _s_ { ushort dw; uint dd; }; _s_ s; }; _u_ u;

Re: sizeof

2011-01-01 Thread Ellery Newcomer
curious. prints 12, DMD 2.051 linux On 01/01/2011 06:15 PM, Manfred_Nowak wrote: Ellery Newcomer wrote: d code prints 12 prints 16 ( DMD 2.051 on win32) -manfred

cstrings

2011-01-01 Thread Ellery Newcomer
are there any other cstring - dstring functions than to!string(char*) ? something like to!(char[])(char*) (the memory allocation bothers me)

Re: Examples using Tango

2010-12-30 Thread Ellery Newcomer
On 12/30/2010 03:46 AM, spir wrote: On Thu, 30 Dec 2010 01:42:27 -0500 bearophilebearophileh...@lycos.com wrote: Overall, it sounds like no one should be using D2 yet unless they have a fetish for arrowhead wounds in their back. Well, I don't have this impression in practice. Sure, on D

slist insertion

2010-12-28 Thread Ellery Newcomer
why does SList.insertFront have a complexity of O(log(n)) ?

long problems

2010-12-22 Thread Ellery Newcomer
quick question - will the following code do as I expect? long x; x = -1; assert(x == -1); cuz I've hit a spot where the optimizer isn't loading the high dword into x

Re: long problems

2010-12-22 Thread Ellery Newcomer
On 12/22/2010 11:04 PM, Ellery Newcomer wrote: quick question - will the following code do as I expect? long x; x = -1; assert(x == -1); cuz I've hit a spot where the optimizer isn't loading the high dword into x nevermind, it's failing with x = cast(long) -1 and x = -1L also

Re: long problems

2010-12-22 Thread Ellery Newcomer
On 12/22/2010 11:10 PM, Jonathan M Davis wrote: That said, it's definitely a bug if that assertion fails - an _enormous_ bug really. Regardless, it works just fine on my machine. try this on your machine: http://d.puremagic.com/issues/show_bug.cgi?id=5364 - Jonathan M Davis

Re: first shot for a combinator library for d

2010-12-10 Thread Ellery Newcomer
Nice. Maybe add support for predicated alternatives? If you *really* want to make it more convenient, you could make a string mixin front for it, so that one could do something like mixin(maek_parser( start - s1 s2; s1 - (`ab`|`cd`) `ef`; s2 - (`1`|`2`|`3`); )); I don't recommend

sarrays are value types?

2010-12-03 Thread Ellery Newcomer
I might just be having one of those moments, but if static arrays are value types, doesn't it make more sense that arr1 = arr2; performs a value copy than a reference copy?

utf ranges

2010-11-30 Thread Ellery Newcomer
Is there a way in phobos to reencode a dchar range as a utf8 bytestream?

Re: utf ranges

2010-11-30 Thread Ellery Newcomer
I'm afraid that I'm not clear enough on exactly what you're looking to do to give you a proper suggestion. on further reflection, neither am I. I suppose to!string is what I want

bigint

2010-11-26 Thread Ellery Newcomer
why does the following code fail? import std.bigint; void main(){ BigInt b1 = 1; BigInt b2 = 3; BigInt e1 = 1; BigInt e2 = 3; BigInt[] b = [b1,b2]; BigInt[] e = [e1,e2]; assert(b == e); }

Re: effect of a label on following block

2010-11-15 Thread Ellery Newcomer
My gut feeling is that the if statement's behavior is wrong and the while statement's is correct, but it could go either way. No need for a rationale for what can be adequately explained as a compiler bug (this is a downside of dmd - it trains you to think like this) It is curious, though, as

Re: effect of a label on following block

2010-11-15 Thread Ellery Newcomer
AM, Ellery Newcomer wrote: My gut feeling is that the if statement's behavior is wrong and the while statement's is correct, but it could go either way. No need for a rationale for what can be adequately explained as a compiler bug (this is a downside of dmd - it trains you to think like

==, is

2010-11-15 Thread Ellery Newcomer
quick question: are the following rewrites always valid: e1 != e2 - !(e1 == e2) e1 !is e2- !(e1 is e2) e1 !in e2- !(e1 in e2) ?

Re: ==, is

2010-11-15 Thread Ellery Newcomer
parser definitely does it for !in, but it doesn't for the other ones, and I didn't want to go digging all over the place for it. Also, spec says yes for !in, but is silent for the other ones On 11/15/2010 01:08 PM, Steven Schveighoffer wrote: On Mon, 15 Nov 2010 14:06:34 -0500, Ellery

Re: ==, is

2010-11-15 Thread Ellery Newcomer
a while ago, I assumed that e1 += e2 gets rewritten as e1 = e1 + e2 Yeah. It doesn't. It doesn't even behave the same wrt erroneously typed arguments On 11/15/2010 02:35 PM, Jonathan M Davis wrote: As far as is, it doesn't explicitly say that rewriting is done, but, it does spell out that

Re: Nested associative arrays

2010-11-12 Thread Ellery Newcomer
Should be. Are you having problems? (I don't use them much, but fwiw, it seems like tango had some [trivial?] problems with them) On 11/12/2010 10:08 AM, Jacob Carlborg wrote: Is D supposed to be able to handle nested associative arrays ?

Re: byte byte

2010-10-29 Thread Ellery Newcomer
On 10/29/2010 10:48 AM, Jesse Phillips wrote: Because C code will not behave differently I'm not convinced of this. Proposed counterexample: // test.d import std.stdio; void main(){ ushort x = 0x; writefln(%08x, ~x+1u); } // test.c #include stdio.h void main(void){ unsigned short

Re: byte byte

2010-10-29 Thread Ellery Newcomer
It all depends on how important backwards compatibility with C is (I wish it weren't important). From a machine code point of view, D's behavior probably makes more sense, at least with intel. http://d.puremagic.com/issues/show_bug.cgi?id=5132 On 10/29/2010 01:52 PM, Jesse Phillips wrote:

Re: byte byte

2010-10-28 Thread Ellery Newcomer
Next question: why does (~ short) result in short, but in c it results in int? On 10/27/2010 11:02 PM, Steven Schveighoffer wrote: Well, if 'int' represents a literal, or a manifest constant, they are not exactly ints. When the compiler can tell that the result of the operation will fit into

Re: byte byte

2010-10-28 Thread Ellery Newcomer
erm, wut? On 10/28/2010 12:56 PM, Jesse Phillips wrote: I see no reason for this or byte byte to return an int. Since this would only cause C code to not compile, why not change it?

byte byte

2010-10-27 Thread Ellery Newcomer
can someone remind why the resulting type is int? is it a c does it thing?

Re: byte byte

2010-10-27 Thread Ellery Newcomer
Hm. Thanks for the heads up. Now how about byte = int is there any good reason why the result type of that isn't error? On 10/27/2010 10:12 PM, Steven Schveighoffer wrote: On Wed, 27 Oct 2010 22:49:47 -0400, Ellery Newcomer ellery-newco...@utulsa.edu wrote: can someone remind why

d and c

2010-08-31 Thread Ellery Newcomer
Hello. Randomly bored tonight. Motivated by this: http://stackoverflow.com/questions/3540596/mixing-c-and-d-code-in-the-same-program, I was trying to get c to call d. I can't remember; is it actually possible? 64 bit Fedora and gcc; here's what I have: $ cat test.d import std.c.stdio;

Re: [D1] capitalize cannot be interpreted at CT

2010-07-21 Thread Ellery Newcomer
On 07/21/2010 09:09 PM, strtr wrote: Could somebody please explain this error to me. evidently ctfe can't eat foreach(i, dchar d; s){ } Bleach. Make sure it's in bugzilla.

Re: Mixing operations with signed and unsigned types

2010-07-06 Thread Ellery Newcomer
On 07/06/2010 07:05 PM, Stewart Gordon wrote: Ellery Newcomer wrote: On 07/05/2010 07:59 AM, Stewart Gordon wrote: bearophile wrote: Stewart Gordon: I can also imagine promoting your mindset leading to edit wars between developers declaring an int and then putting assert (qwert = 0

Re: Mixing operations with signed and unsigned types

2010-07-05 Thread Ellery Newcomer
On 07/05/2010 07:59 AM, Stewart Gordon wrote: bearophile wrote: Stewart Gordon: I can also imagine promoting your mindset leading to edit wars between developers declaring an int and then putting assert (qwert = 0); in the class invariant, and those who see this and think it's brain-damaged.

lexer escape

2010-07-03 Thread Ellery Newcomer
what is the point of having \? a valid escape sequence?

Re: @porperty problem..

2010-06-28 Thread Ellery Newcomer
On 06/28/2010 03:47 PM, Steven Schveighoffer wrote: On Mon, 28 Jun 2010 16:37:06 -0400, BLS windev...@hotmail.de wrote: @property nextServer() { Shouldn't this be @property Server nextServer() { ??? auto functions?

Re: @porperty problem..

2010-06-28 Thread Ellery Newcomer
On 06/28/2010 03:58 PM, Steven Schveighoffer wrote: On Mon, 28 Jun 2010 16:55:01 -0400, Ellery Newcomer ellery-newco...@utulsa.edu wrote: On 06/28/2010 03:47 PM, Steven Schveighoffer wrote: On Mon, 28 Jun 2010 16:37:06 -0400, BLS windev...@hotmail.de wrote: @property nextServer

Re: Why doesn't this work in D2?

2010-06-27 Thread Ellery Newcomer
On 06/27/2010 12:18 PM, Jacob Carlborg wrote: Why doesn't the following code work in D2 (it works in D1)? void foo (T) (in T[] a, T b) { } void main () { asd.foo('s'); } asd.foo(cast(immutable) 's');

Re: Why assert is in the language?

2010-06-22 Thread Ellery Newcomer
On 06/22/2010 05:36 PM, Ali Çehreli wrote: Jonathan M Davis wrote: Steven Schveighoffer wrote: all calls to assert are removed by the compiler in release mode. I don't think there's a way to implement that via a library (it would be nice though!) Also IIRC, the compiler uses

Re: ERROR - cannot implicitly convert expression (s) of type int[3u] to int*

2010-06-18 Thread Ellery Newcomer
On 06/18/2010 12:25 AM, Chick Corea wrote: [NOTE - sent twice as I was unsure that first attempt, pre-subscription, was received.] Working through the basics of D and running into simple problems that I cannot solve, such as: Error: cannot implicitly convert expression (s) of type int[3u]

Re: template specialization

2010-06-08 Thread Ellery Newcomer
On 06/08/2010 05:01 PM, Robert Clipsham wrote: On 08/06/10 22:25, Larry Luther wrote: Q: Is this the way it's supposed to be? Yes, byte implicitly casts to ubyte so it's accepted. Try switching the templates round, they will both be byte. The way around this is to add template constraints to

Re: noob Q: declaring string variables

2010-05-29 Thread Ellery Newcomer
On 05/29/2010 04:38 PM, Duke Normandin wrote: Back again... As an introductory tutorial, I'm now using: http://www.dsource.org/projects/tutorials/wiki/InitializingVariablesExample BTW, somebody fix that page - the `writefln' statements are missing the %d and %s. char[] password = sesame;

Re: Installing D on MacOS X

2010-05-25 Thread Ellery Newcomer
On 05/25/2010 08:50 AM, Duke Normandin wrote: Hey... 2 hours into my D language experience Got some instructions from th digitalmars-d list for getting D installed on my Intel OS X box. Still having problems: dnormandin@ ~/programming/dmd2/code 06:40 am dmd firstApp.d ld warning: in

Re: enum overloading

2010-05-23 Thread Ellery Newcomer
On 05/23/2010 07:35 AM, strtr wrote: Did I miss it or should I add a bug report? http://www.digitalmars.com/d/2.0/hijack.html (it strikes me that this is a necessary product of a loose type system) It is? :) yes. here's an example which acts differently if you don't have it: module a;

Re: enum overloading

2010-05-23 Thread Ellery Newcomer
On 05/23/2010 02:05 PM, Simen kjaeraas wrote: Ellery Newcomer ellery-newco...@utulsa.edu wrote: I tried telling walter that enums don't and won't suffer from this problem. True. However, treating enums as special for this means another special case in the language. And special cases are bad

TemplateMixinDeclaration

2010-05-23 Thread Ellery Newcomer
So I'm finally buckling down and going through the D2 specs. What is this one?

Re: enum overloading

2010-05-22 Thread Ellery Newcomer
On 05/22/2010 08:20 PM, Ellery Newcomer wrote: From a discussion with walter a while back, I gathered not possible. Strike this line, not sure what I was thinking of here

Re: Newbie: copy, assignment of class instances

2010-05-20 Thread Ellery Newcomer
On 05/20/2010 06:23 PM, bearophile wrote: You are a newbie, so let me point the little flaws in your D code, this is the D style guide: http://www.digitalmars.com/d/2.0/dstyle.html Regarding white space it says: * Use spaces instead of hardware tabs. * Each indentation level will be

Re: segfaults

2010-05-04 Thread Ellery Newcomer
On 05/04/2010 01:58 AM, Lars T. Kyllingstad wrote: In your case the segfault would cause SIGSEGV (signal 11) to be sent to the process, and the the above test would print Process terminated by signal 11. See man wait for more info. That's where I got my info (or rather

Re: Tuple unittests

2010-05-04 Thread Ellery Newcomer
On 05/04/2010 09:07 AM, Masahiro Nakagawa wrote: I once hit the same bug. SHOO has been reported this bug. http://d.puremagic.com/issues/show_bug.cgi?id=4003 thanks for the link I don't know the solution to fix :( easy, remove the unittest from phobos :)

Re: segfaults

2010-05-04 Thread Ellery Newcomer
On 05/04/2010 09:51 AM, Graham Fawcett wrote: Thanks for posting this. Just curious -- why did you choose to model PID as a tuple instead of a struct? I'm not clear on what the tradeoffs are. Best, Graham according to core.sys.posix.sys.wait, this is only valid for linux, grrr. I don't

Re: segfaults

2010-05-04 Thread Ellery Newcomer
On 05/04/2010 11:32 AM, Lars T. Kyllingstad wrote: Shouldn't 'term' and 'signaled' switch names? It looks to me like 'term' will be nonzero if the process receives any signal, while 'signaled' will be only be true if it is a terminating signal, and not if it is a stop signal. signaled

segfaults

2010-05-03 Thread Ellery Newcomer
Hello. I'm trying to invoke a command inside d, and it returns a success code when the command in question segfaults. any ideas? // the caller import std.process; int main(){ auto r = system(./test); return(r); } //test.d import std.stdio; void main() { Object o;

Re: segfaults

2010-05-03 Thread Ellery Newcomer
On 05/03/2010 06:08 PM, Graham Fawcett wrote: What OS are you running on? In D2, this the definition of system(): int system(string command) { if (!command) return std.c.process.system (null); const commandz = toStringz (command); invariant status =

Tuple unittests

2010-05-03 Thread Ellery Newcomer
lately I've been getting a lot of screwy error messages whenever I try to compile with -unittest: /home/ellery/Downloads/dmd2044/linux/bin/../../src/phobos/std/typecons.d(425): Error: static assert (is(Tuple!(string,float) == Tuple!(string,float))) is false

phobos streams

2010-05-01 Thread Ellery Newcomer
Hello. what's phobos' current status with regard to streams? std.stream has InputStream and OutputStream, but it seems like I read somewhere or other that std.stream is old news and is eventually going to go away.

ranges

2010-04-29 Thread Ellery Newcomer
Hello. I'm muddling over the following code, which compares an array/take composition with the analogous imperative code. For medium-large values of n, I'm seeing a fivefold degradation in performance, which blows up to 30 times worse at n=5000. Any ideas on why this is or better ways

Re: ranges

2010-04-29 Thread Ellery Newcomer
Oh I get it. hasLength is broken. http://d.puremagic.com/issues/show_bug.cgi?id=3508 Kyle Foley's patch brings my program to a more respectable 1.6 times slower or thereabouts. On 04/29/2010 01:52 PM, Ellery Newcomer wrote: Hello. I'm muddling over the following code, which compares

Re: newbie: Access violation because of class

2010-04-29 Thread Ellery Newcomer
On 04/29/2010 08:50 PM, Larry Luther wrote: Why do I get an object.Error: Access Violation in the following code? If I change class to struct and remove public: I don't get an error. I'm using D2. import std.stdio; class Plane { public: int xres, yres; }; void main

Re: newbie: Circular references across modules

2010-04-29 Thread Ellery Newcomer
On 04/29/2010 09:04 PM, Larry Luther wrote: This code describes the concept: module a; import B; struct A { B *ptr; } - module b; import A; struct B { A *ptr; } - Can this be done? sure Do both classes have to be in the same module?

structs, templates, alias

2010-04-25 Thread Ellery Newcomer
Hello. I have a bunch of disparate binary record types that I need to be able to read and write to/from a binary stream. Currently, the way I do this is just by drumming out a struct declaration and relying on the tupleof property to specify how to read/write. Ex: struct Rec0{ ushort

Re: structs, templates, alias

2010-04-25 Thread Ellery Newcomer
On 04/25/2010 02:10 PM, Robert Clipsham wrote: On 25/04/10 19:15, Ellery Newcomer wrote: Yeah, that's about what I do. The trouble is getting blit to know which field is the length field. I suppose you could pass an index into the tuple to the substructure. That still wouldn't fix

Re: structs, templates, alias

2010-04-25 Thread Ellery Newcomer
On 04/25/2010 02:50 PM, Robert Clipsham wrote: On 25/04/10 20:32, Ellery Newcomer wrote: Hmm. Either I'm not understanding you or I didn't explain something clearly. something like this struct Rec2{ ushort index; ushort nparams; ushort options; ushort[] params; // this has nparams elements

Re: tools.ctfe for D1

2010-04-22 Thread Ellery Newcomer
, but if you make your tables work with '\u2500' and friends, I might do it.. On 04/22/2010 12:36 PM, FeepingCreature wrote: On 21.04.2010 16:43, Ellery Newcomer wrote: On 04/21/2010 05:43 AM, FeepingCreature wrote: On 20.04.2010 01:49, Ellery Newcomer wrote: Are there any good libraries

Re: tools.ctfe for D1

2010-04-21 Thread Ellery Newcomer
On 04/21/2010 05:43 AM, FeepingCreature wrote: On 20.04.2010 01:49, Ellery Newcomer wrote: Are there any good libraries for ctfe/code generation? I don't know, things like parsing support for compile time strings, string formatting, type- string My project seems to be growing ctfe, and it's

Re: tools.ctfe for D1

2010-04-21 Thread Ellery Newcomer
Also, are there any examples for usage of the table parsing functions? And to whom do I give attribution?

Re: ctfe library

2010-04-20 Thread Ellery Newcomer
On 04/20/2010 10:17 AM, Don wrote: I don't see anything particularly ugly or hacky about CTFE code, like the code below: int greater(int a, int b) { if (ab) return a; else return b; } int [ greater(short.max/3, 515) ] foo; It isn't. Things don't get ugly until you hit the relatively low

Re: ctfe library

2010-04-20 Thread Ellery Newcomer
On 04/20/2010 01:02 PM, div0 wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ellery Newcomer wrote: As ctfe support matures, I dream of a full-fledged parser generator that can be evaluated at compile time, although that's way more heavy duty than what most people will need. My spirit

Re: Comb Sort with ranges

2010-04-20 Thread Ellery Newcomer
this is a bit off topic, but have you noticed that comb sort can consistantly beat the pants off phobos' built in sort for data of reasonable sizes? Admittedly, I didn't implement it using ranges (It's really cool that you can!) and just used arrays.

templates

2010-04-19 Thread Ellery Newcomer
Hello. Say I have a [struct] template T, which takes a param S. Any T!(S) satisfies a certain template constraint W, so I can use any T!(S) the same way. I want to be able to store heterogeneous T!(S) in a single list. Is there any good way to express the type for this?

Re: templates

2010-04-19 Thread Ellery Newcomer
Won't the union balloon Wrapper's size to always be that of the largest inner struct that you use?

Re: templates

2010-04-19 Thread Ellery Newcomer
On 04/19/2010 02:16 PM, Steven Schveighoffer wrote: What you are looking for is a conversion from compile-time interface to runtime interface. The only drawback is, you can't go backwards (from a runtime interface to a compile-time). That hurts. The thing is, I'm eventually going to need to

ctfe library

2010-04-19 Thread Ellery Newcomer
Are there any good libraries for ctfe/code generation? I don't know, things like parsing support for compile time strings, string formatting, type - string My project seems to be growing ctfe, and it's all horribly hacky and ugly code.

Re: Newsgroups, off-topic

2010-04-16 Thread Ellery Newcomer
On 04/16/2010 03:13 PM, eles wrote: PS2 What does really means to use LLVM or GCC backends for dmd? Is a front-end somewhat like a parser (or bytecode compiler) and the back-end something like an assembler? Pretty much. Except in the case of D, the front end also requires a backend of sorts

Re: gdc and Make

2010-04-10 Thread Ellery Newcomer
On 04/10/2010 08:27 PM, nedbrek wrote: Hello all, I have been following D for over a year now, and have just started my first big project. I am really enjoying it so far! I am using Cygwin, with the patched in gdc 0.24 for D 1.0 (old, I know). I am also using Make as my build

Re: writefln on interface array

2010-04-07 Thread Ellery Newcomer
On 04/07/2010 06:13 AM, strtr wrote: Is it possible to have this output [null,1] in stead of Error: std.format formatArg? interface I{} class C:I{ int index; char[] toString(){ return toString(index) } } I[2] two_i; I[1] = new C(); writefln(two_i); Would be handy for debugging ;)

tango and unicode

2010-03-30 Thread Ellery Newcomer
Is there an equivalent of std.utf.stride anywhere in tango?

non halting regex

2010-03-27 Thread Ellery Newcomer
Is this program expected to terminate? D 2.042 module test; import std.regex; import std.stdio; void main(){ foreach(m; match(hello world,`.*`)){ writefln(%s[%s]%s,m.pre,m.hit,m.post); } }

dup and arrays

2010-03-26 Thread Ellery Newcomer
I just noticed that dup does not dup deep. In a two second search I couldn't find any reason for or against, but I'd kinda like it if auto r2 = r.dup; r2[i][j] = 0; r[i][j] = 1; assert(r2[i][j] != r[i][j]); held.

Re: is pointer

2010-03-20 Thread Ellery Newcomer
On 03/19/2010 07:53 PM, Moritz Warning wrote: On Fri, 19 Mar 2010 19:29:24 -0400, bearophile wrote: (I am looking for rough corners in D, or in my knowledge of D.) [..] template IsPointer1(T) { enum bool IsPointer1 = is(T : T*); } void main() { int* ptr; static

Re: How to make a formatted string ?

2010-03-17 Thread Ellery Newcomer
On 03/17/2010 11:21 AM, Gabriel Laskar wrote: I have another problem : 1 import std.stdio; 2 import std.string; 3 4 int main() 5 { 6 char[][] a = [expected %s but found %s.dup, 42.dup, 32.dup]; 7 8 writeln(format(a[0], a[1 .. $])); 9 10 return 0; 11 } Does not work : $ dmd-phobos -run

temp files

2010-03-14 Thread Ellery Newcomer
Does phobos have any functionality regarding these?

aa literals

2010-03-13 Thread Ellery Newcomer
anyone know of a good (or any) syntax for an empty aa impetus: auto aa = reduce!(g)(emptyaa, lst);

Re: aa literals

2010-03-13 Thread Ellery Newcomer
On 03/13/2010 07:20 PM, bearophile wrote: Ellery Newcomer: anyone know of a good (or any) syntax for an empty aa impetus: auto aa = reduce!(g)(emptyaa, lst); Sorry, I have probably not understood your question. Bye, bearophile No, you hit it on the head. Here's the kind of thing I

Re: Can't initialize the TangoTrace LGPL stuff

2010-03-11 Thread Ellery Newcomer
On 03/11/2010 10:36 AM, Nick Sabalausky wrote: Ellery Newcomerellery-newco...@utulsa.edu wrote in message news:hn9qvi$qf...@digitalmars.com... how do you get stacktracing to work under windows? Have you seen this page? http://www.dsource.org/projects/tango/wiki/TutStackTrace No I haven't.

Re: Static struct assign

2010-03-11 Thread Ellery Newcomer
On 03/11/2010 11:22 AM, bearophile wrote: While trying to create a safe int, I have found a problem, this is reduced code: struct Foo { int x; static Foo opAssign(int value) { return Foo(value); } } void main() { Foo y = 0; } The compiler prints: test.d(6): Error: cannot

Can't initialize the TangoTrace LGPL stuff

2010-03-10 Thread Ellery Newcomer
how do you get stacktracing to work under windows?

foreach, tupleof

2010-03-07 Thread Ellery Newcomer
Hello. In D1, this code fails: void foo(S)(ref S s){ foreach(ref k; s.tupleof){ k = 1; } } struct K{ int g; } void main(){ K k; foo(k); assert(k.g == 1); } test.d(5): Error: no storage class for value k (referring to 'k = 1;') Is this an expected error, and is there a good

Re: foreach, tupleof

2010-03-07 Thread Ellery Newcomer
On 03/07/2010 12:23 PM, Jacob Carlborg wrote: On 3/7/10 19:11, Ellery Newcomer wrote: Hello. In D1, this code fails: void foo(S)(ref S s){ foreach(ref k; s.tupleof){ k = 1; } } struct K{ int g; } void main(){ K k; foo(k); assert(k.g == 1); } test.d(5): Error: no storage class for value k

Re: line counting tool that detects D comments etc?

2010-03-03 Thread Ellery Newcomer
On 03/03/2010 06:15 PM, Trass3r wrote: Is there any line counting tool that also detects nested D comments etc.? Preferably for Windoze or platform-independent. Could you clarify what kind of a utility you're looking for? e.g. what's the significance of being able to detect nested comments?

raii

2010-02-28 Thread Ellery Newcomer
Hello The impetus: I agree, except I more and more think that scope classes were a mistake. Structs with destructors are a much better solution, and wrapping a class inside a struct would give it RAII semantics. The problem: In designing a library (or rather touching up someone else's

Re: raii

2010-02-28 Thread Ellery Newcomer
On 02/28/2010 02:16 PM, Ellery Newcomer wrote: RAII!(Foo) foo(int i){ return RAII!(Foo)(new Foo(i)); } One thing I'm curious about in particular is how to ensure that the destructor of Foo doesn't get called inside foo. With this particular code, it evidently doesn't, but I can't tell

Re: segfaults

2010-02-23 Thread Ellery Newcomer
On 02/23/2010 06:28 AM, Steven Schveighoffer wrote: On Mon, 22 Feb 2010 21:14:08 -0500, Ellery Newcomer ellery-newco...@utulsa.edu wrote: Is there any decent way to figure out where segfaults are coming from? e.g. 200k lines of bad code converted from java I tried gdb, and it didn't seem

Re: segfaults

2010-02-23 Thread Ellery Newcomer
On 02/23/2010 10:34 AM, Robert Clipsham wrote: I'm no expert, but that looks like a dmd bug, can you reproduce with ldc? The actual segfault is probably to do with your code, but if gdb gives that then there's a problem with the debug info that dmd is writing. The only easy way to debug this if

Re: segfaults

2010-02-23 Thread Ellery Newcomer
On 02/23/2010 03:22 PM, Bernard Helyer wrote: On 24/02/10 03:45, Ellery Newcomer wrote: I'm thinking it's an issue with DMD. I can get backtraces with simple programs. If you use a dynamic array in there somewhere, the chances of it not working go up, I'm afraid. This doesn't leave many

exceptions

2010-02-23 Thread Ellery Newcomer
Okay, does anyone know a good way to figure out where something like this is coming from: object.Exception: lengths don't match for array copy

segfaults

2010-02-22 Thread Ellery Newcomer
Is there any decent way to figure out where segfaults are coming from? e.g. 200k lines of bad code converted from java I tried gdb, and it didn't seem to work too well. Die: DW_TAG_type_unit (abbrev 3, offset 0x6d) parent at offset: 0xb has children: FALSE attributes: DW_AT_byte_size

Re: segfaults

2010-02-22 Thread Ellery Newcomer
On 02/22/2010 08:41 PM, Jesse Phillips wrote: Ellery Newcomer wrote: Is there any decent way to figure out where segfaults are coming from? e.g. 200k lines of bad code converted from java I tried gdb, and it didn't seem to work too well. Die: DW_TAG_type_unit (abbrev 3, offset 0x6d

Re: Compile Phobos library ?

2010-02-17 Thread Ellery Newcomer
On 02/17/2010 07:09 PM, GG wrote: DMD2.040 on linux: When I try to build phobos library with make -f linux.mak, I got : dmd -w -O -release -nofloat -d -lib -ofobj/posix/release/libphobos2.a crc32.d std/algorithm.d std/array.d std/atomics.d std/base64.d std/bigint.d std/bitmanip.d std/boxer.d

Re: template specialization question

2010-02-01 Thread Ellery Newcomer
On 02/01/2010 04:19 PM, daoryn wrote: The whole point of specialisation (and of templates in general) is to have functions that work for any type. Having to forcibly specify a type is like casting to a specific overload of a function. Why add clutter to the syntax when the language

Re: template specialization question

2010-01-31 Thread Ellery Newcomer
I haven't gotten around to templates yet, so I don't grok them quite as well as I'd like, but it looks like DMD is having trouble deducing T from the parameter given. print([1,2,3]) fails to match the specialized template, even when the general template is removed. If you force the template

Re: op=

2010-01-23 Thread Ellery Newcomer
On 01/22/2010 12:23 PM, Steven Schveighoffer wrote: On Thu, 21 Jan 2010 22:44:24 -0500, Ellery Newcomer ellery-newco...@utulsa.edu wrote: according to the spec, a op= b; is semantically equivalent to a = a op b; but this doesn't seem to be strictly true. for example: char c = 'a'; real r

op=

2010-01-21 Thread Ellery Newcomer
according to the spec, a op= b; is semantically equivalent to a = a op b; but this doesn't seem to be strictly true. for example: char c = 'a'; real r = 3.14; c = c + r; // error c += r; // accepted; seems to be doing c += floor(r); is this behavior intentional?

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

2009-12-01 Thread Ellery Newcomer
On 12/01/2009 02:35 PM, Chad J wrote: No guarantees, but a lot of promise. http://erdani.com/d/thermopylae.pdf On page 114 of the draft, 14 of the pdf, in section 4.1.10, at the bottom: notice how Andrei seems to be hedging on properties working correctly. Oh goodie. We're going to get

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

2009-11-30 Thread Ellery Newcomer
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 having to create cases for all of the different kinds of

<    1   2   3   4   >