Re: introspection woes (2)

2011-06-13 Thread Johannes Pfau
Lloyd Dupont wrote: trying to learn introspection, I have this simple test method: === static void dumpelement(Object o) { if (!o) return; auto ci = o.classinfo; foreach(mi ; ci.getMembers(null)) { writefln(%s . %s, ci.name, mi.name()); } }

simple syntax issue with template

2011-06-13 Thread Lloyd Dupont
I'm trying to create 2 extra method for arrays (range would be better, though I don't quite understand what is a range) Although I have some indecipherable (to me) compiler error... What's wrong with the code below? == import std.algorithm; public: void remove(T)(ref T[]

Re: introspection woes (2)

2011-06-13 Thread Lloyd Dupont
Interesting... I think I understand... Thanks! :) However an other problem arise with getMembers() it always returns null! Looking at the code it seems (from my beginner's perspective) that getMembers() rely on the member field (function) xgetMembers which is always null, as far as I can tell

Re: simple syntax issue with template

2011-06-13 Thread Dmitry Olshansky
On 13.06.2011 16:03, Lloyd Dupont wrote: I'm trying to create 2 extra method for arrays (range would be better, though I don't quite understand what is a range) Although I have some indecipherable (to me) compiler error... What's wrong with the code below? == import

Re: simple syntax issue with template

2011-06-13 Thread Lloyd Dupont
removed some obvious error, still stumped on the templated syntax ... so.. why is it not compiling? (error: Error: template std.algorithm.countUntil(alias pred = a == b,R1,R2) if (is(typeof(startsWith!(pred)(haystack,needle does not match any function template declaration ) = import

Re: introspection woes (2)

2011-06-13 Thread Robert Clipsham
On 13/06/2011 13:11, Lloyd Dupont wrote: Interesting... I think I understand... Thanks! :) However an other problem arise with getMembers() it always returns null! Looking at the code it seems (from my beginner's perspective) that getMembers() rely on the member field (function) xgetMembers

Re: simple syntax issue with template

2011-06-13 Thread Lloyd Dupont
ho.. plenty of silly mistake indeed.. thanks for spotting them! (maybe I should take a break and play the witcher 2 hey!?!? :) however I still have a problem with removeAt now! :( === void removeAt(T)(ref T[] array, int index) { if(index 0 || index = array.length) return;

Re: introspection woes (2)

2011-06-13 Thread Lloyd Dupont
Thanks Robert! Mm.. can you (per chance!) share some code? I'm a newbie and compile time reflection is something which eludes me (so far...)! Robert Clipsham wrote in message news:it4vp1$1n5q$1...@digitalmars.com... Anyway of ... making the runtime update xgetMembers? My understanding

Re: introspection woes (2)

2011-06-13 Thread Robert Clipsham
On 13/06/2011 13:56, Lloyd Dupont wrote: Thanks Robert! Mm.. can you (per chance!) share some code? I'm a newbie and compile time reflection is something which eludes me (so far...)! See: http://www.digitalmars.com/d/2.0/traits.html class MyClass { void method1(){} void

Re: introspection woes (2)

2011-06-13 Thread Lloyd Dupont
Works a treat! Thanks for your detailed sample! :) Robert Clipsham wrote in message news:it5395$2028$1...@digitalmars.com... See: http://www.digitalmars.com/d/2.0/traits.html class MyClass { void method1(){} void method2(){} } import std.stdio; void main() { foreach

Re: dmd vs rdmd

2011-06-13 Thread Joshua Niehus
Thanks Jonathan, that cleared things up for me. Josh On Sat, Jun 11, 2011 at 12:00 PM, digitalmars-d-learn-requ...@puremagic.com wrote: Send Digitalmars-d-learn mailing list submissions to digitalmars-d-learn@puremagic.com To subscribe or unsubscribe via the World Wide Web, visit

Re: simple syntax issue with template

2011-06-13 Thread Dmitry Olshansky
On 13.06.2011 16:49, Lloyd Dupont wrote: ho.. plenty of silly mistake indeed.. thanks for spotting them! (maybe I should take a break and play the witcher 2 hey!?!? :) Why not ? ;-) however I still have a problem with removeAt now! :( === void removeAt(T)(ref T[] array, int index) {

Re: simple syntax issue with template

2011-06-13 Thread Joshua Niehus
I'm trying to create 2 extra method for arrays (range would be better, though I don't quite understand what is a range) Although I have some indecipherable (to me) compiler error... What's wrong with the code below? == import std.algorithm; public: void remove(T)(ref T[]

Int within ranges

2011-06-13 Thread nrgyzer
Hi there, is there any possibility to get a sliced array from another array between two ranges like: int[uint] myArray; myArray[10] = 1000; myArray[20] = 2000; myArray[30] = 3000; myArray[40] = 4000; myArray[50] = 5000; int[] newArray = myArray[= 20 .. = 40]; // not able to do this

Re: Int within ranges

2011-06-13 Thread Steven Schveighoffer
On Mon, 13 Jun 2011 12:15:40 -0400, nrgyzer nrgy...@gmail.com wrote: Hi there, is there any possibility to get a sliced array from another array between two ranges like: int[uint] myArray; myArray[10] = 1000; myArray[20] = 2000; myArray[30] = 3000; myArray[40] = 4000; myArray[50] = 5000;

Re: Int within ranges

2011-06-13 Thread bearophile
Steven Schveighoffer: But the dcollections.TreeMap API is more polished. I think most people will want to use just Phobos, to avoid a dependency, even if the Phobos one is less polished... Bye, bearophile

Re: Int within ranges

2011-06-13 Thread Steven Schveighoffer
On Mon, 13 Jun 2011 13:25:39 -0400, bearophile bearophileh...@lycos.com wrote: Steven Schveighoffer: But the dcollections.TreeMap API is more polished. I think most people will want to use just Phobos, to avoid a dependency, even if the Phobos one is less polished... Sure, but it's

Re: Int within ranges

2011-06-13 Thread Jonathan M Davis
On 2011-06-13 09:15, nrgyzer wrote: Hi there, is there any possibility to get a sliced array from another array between two ranges like: int[uint] myArray; myArray[10] = 1000; myArray[20] = 2000; myArray[30] = 3000; myArray[40] = 4000; myArray[50] = 5000; int[] newArray = myArray[=

Re: Int within ranges

2011-06-13 Thread nrgyzer
On Mon, 13 Jun 2011 12:15:40 -0400, nrgyzer nrgy...@gmail.com wrote: Hi there, is there any possibility to get a sliced array from another array between two ranges like: int[uint] myArray; myArray[10] = 1000; myArray[20] = 2000; myArray[30] = 3000; myArray[40] = 4000;

Re: Int within ranges

2011-06-13 Thread Steven Schveighoffer
On Mon, 13 Jun 2011 14:52:24 -0400, nrgyzer nrgy...@gmail.com wrote: On Mon, 13 Jun 2011 12:15:40 -0400, nrgyzer nrgy...@gmail.com wrote: Hi there, is there any possibility to get a sliced array from another array between two ranges like: int[uint] myArray; myArray[10] = 1000;

Re: Int within ranges

2011-06-13 Thread nrgyzer
On Mon, 13 Jun 2011 14:52:24 -0400, nrgyzer nrgy...@gmail.com wrote: On Mon, 13 Jun 2011 12:15:40 -0400, nrgyzer nrgy...@gmail.com wrote: Hi there, is there any possibility to get a sliced array from another array between two ranges like: int[uint] myArray; myArray[10] =

Re: Int within ranges

2011-06-13 Thread Steven Schveighoffer
On Mon, 13 Jun 2011 15:44:01 -0400, nrgyzer nrgy...@gmail.com wrote: On Mon, 13 Jun 2011 14:52:24 -0400, nrgyzer nrgy...@gmail.com wrote: On Mon, 13 Jun 2011 12:15:40 -0400, nrgyzer nrgy...@gmail.com wrote: Hi there, is there any possibility to get a sliced array from another array

Re: Int within ranges

2011-06-13 Thread nrgyzer
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel On Mon, 13 Jun 2011 15:44:01 -0400, nrgyzer nrgy...@gmail.com wrote: On Mon, 13 Jun 2011 14:52:24 -0400, nrgyzer nrgy...@gmail.com wrote: On Mon, 13 Jun 2011 12:15:40 -0400, nrgyzer nrgy...@gmail.com wrote: Hi there,

Re: WindowsAPI Binding - Linker Errors

2011-06-13 Thread Nick Sabalausky
Loopback elliott.darf...@gmail.com wrote in message news:it4ud4$1kf5$1...@digitalmars.com... Hello! I've been test programming win32 applications recently, and since the phobos win32 library is so limited, I decided to download and test the WindowsAPI Binding

Re: WindowsAPI Binding - Linker Errors

2011-06-13 Thread Nick Sabalausky
Nick Sabalausky a@a.a wrote in message news:it5ui1$1l75$1...@digitalmars.com... Loopback elliott.darf...@gmail.com wrote in message news:it4ud4$1kf5$1...@digitalmars.com... Hello! I've been test programming win32 applications recently, and since the phobos win32 library is so limited, I

Undefined function, even though imported

2011-06-13 Thread Loopback
Hi! Let me begin by saying, I'm sorry if this is caused of some obvious error but since I am new to D, I am not aware of all the tricks and treats it offers. I am working with the WindowsAPI binding at dsource.org (though I do not believe this is related to the binding itself). However, in

Re: Undefined function, even though imported

2011-06-13 Thread Trass3r
Importing it means dmd knows about the function and emits a call but doesn't automatically generate the function code. This is only done if you also pass the file containing it to dmd.

Re: Undefined function, even though imported

2011-06-13 Thread Mafi
Am 13.06.2011 23:18, schrieb Loopback: Hi! Let me begin by saying, I'm sorry if this is caused of some obvious error but since I am new to D, I am not aware of all the tricks and treats it offers. I am working with the WindowsAPI binding at dsource.org (though I do not believe this is related

Re: Clear big AAs

2011-06-13 Thread bearophile
useo: toRender is my AA which contains the textures as key (instances of my class Texture) and the tiles (position of them) as values. When I remove the first two lines (clear and set null) it doesn't drops down to 1 FPS, it runs normal. I hope anyone know a solution :) Try to disable the

Re: Undefined function, even though imported

2011-06-13 Thread Jonathan M Davis
On 2011-06-13 14:18, Loopback wrote: Hi! Let me begin by saying, I'm sorry if this is caused of some obvious error but since I am new to D, I am not aware of all the tricks and treats it offers. I am working with the WindowsAPI binding at dsource.org (though I do not believe this is

Re: Undefined function, even though imported

2011-06-13 Thread Loopback
Thanks for your answer! Seems like supplying with the file location solved the problem, though I still wonder about one thing. The imported module is located in c:/d/dmd2/import/win32/windef.d and I have used this command line to the DMD compiler: -Ic:/d/dmd2/import/. Shouldn't the

Re: Undefined function, even though imported

2011-06-13 Thread Jonathan M Davis
On 2011-06-13 14:44, Loopback wrote: Thanks for your answer! Seems like supplying with the file location solved the problem, though I still wonder about one thing. The imported module is located in c:/d/dmd2/import/win32/windef.d and I have used this command line to the DMD compiler:

Running DMD tests

2011-06-13 Thread Peter Alexander
I'm trying to run the test suite for DMD, but I'm running into issues. I've cloned dmd from github, and successfully built dmd, but when I run 'make' from the dmd/test dir, I get: $ make Creating output directory: test_results Building d_do_test tool object.d: Error: module object is

Re: Undefined function, even though imported

2011-06-13 Thread Loopback
On 2011-06-13 23:51, Jonathan M Davis wrote: On 2011-06-13 14:44, Loopback wrote: Thanks for your answer! Seems like supplying with the file location solved the problem, though I still wonder about one thing. The imported module is located in c:/d/dmd2/import/win32/windef.d and I have used

Re: Undefined function, even though imported

2011-06-13 Thread Andrej Mitrovic
sc.ini is going to get overwritten when you upgrade DMD so changing it is a bad idea. An alternative is to copy sc.ini to your projects local directory, this way DMD will use that one instead of its own. But this is all working around the issue that you should be passing import directories via a

Re: Undefined function, even though imported

2011-06-13 Thread Trass3r
Shouldn't the linker/compiler be able to solve this on its own then? Use rdmd or xfBuild to automatically compile all needed modules.

Re: So how exactly does one make a persistent range object?

2011-06-13 Thread Ali Çehreli
On Sat, 04 Jun 2011 20:27:16 +0200, Andrej Mitrovic wrote: This is my #1 problem with ranges right now: import std.range; int[3] a = [1, 2, 3]; shared range = cycle(a[]); // nope void main() { foo(); } void foo() { // do something with range } test.d(6): Error:

Is there any convenient CopyMemory function in Phobos?

2011-06-13 Thread Andrej Mitrovic
Apparently in the Windows API there's a whole lot of byte-copying going around. Here's an example: int CALLBACK EnhMetaFileProc (HDC hdc, HANDLETABLE * pHandleTable, CONST ENHMETARECORD * pEmfRecord, int iHandles, LPARAM pData) {

Re: Is there any convenient CopyMemory function in Phobos?

2011-06-13 Thread Jonathan M Davis
On 2011-06-13 16:27, Andrej Mitrovic wrote: Apparently in the Windows API there's a whole lot of byte-copying going around. Here's an example: int CALLBACK EnhMetaFileProc (HDC hdc, HANDLETABLE * pHandleTable, CONST ENHMETARECORD * pEmfRecord, int iHandles, LPARAM pData) {

Re: Is there any convenient CopyMemory function in Phobos?

2011-06-13 Thread Andrej Mitrovic
Right, haven't thought about the C functions at all (silly me). Thanks, this did the trick: extern (C) void* memcpy(void*, const void*, size_t);

Re: Is there any convenient CopyMemory function in Phobos?

2011-06-13 Thread Jonathan M Davis
On 2011-06-13 17:01, Andrej Mitrovic wrote: Right, haven't thought about the C functions at all (silly me). Thanks, this did the trick: extern (C) void* memcpy(void*, const void*, size_t); core.stdc.string has memcpy's declaration in it. You should be able to just import it rather than

Re: Is there any convenient CopyMemory function in Phobos?

2011-06-13 Thread Andrej Mitrovic
So why's it in core.stdc.string, instead of say.. core.memory? Btw, I've had some imports already in the module and it seems these two conflict: import core.thread; import core.stdc.string; void main() { int* p, x; memcpy(p, x, 1); } test.d(9): Error: core.stdc.string.memcpy at

Re: Undefined function, even though imported

2011-06-13 Thread Loopback
Thanks for all the answers! Seems like rdmd did the trick. I don't see why this isn't built in to dmd though, or does it cause overhead when you are using rdmd? Benefits, Drawbacks? I've also stumbled upon an additional error with the win32 DirectX bindings, but this seems D related actually.

Re: Undefined function, even though imported

2011-06-13 Thread bearophile
Trass3r Wrote: Shouldn't the linker/compiler be able to solve this on its own then? Use rdmd or xfBuild to automatically compile all needed modules. Everyone we'll keep asking that question forever until the D compiler does this by itself :-) Bye, bearophile

Re: Is there any convenient CopyMemory function in Phobos?

2011-06-13 Thread bearophile
Andrej Mitrovic: Right, haven't thought about the C functions at all (silly me). Thanks, this did the trick: extern (C) void* memcpy(void*, const void*, size_t); Maybe you are able to wrap that memcpy in a templated D function (named copyMemory) that does what you want in a bit safer way,

Re: Is there any convenient CopyMemory function in Phobos?

2011-06-13 Thread Jonathan M Davis
On 2011-06-13 17:38, Andrej Mitrovic wrote: So why's it in core.stdc.string, instead of say.. core.memory? Btw, I've had some imports already in the module and it seems these two conflict: import core.thread; import core.stdc.string; void main() { int* p, x; memcpy(p, x, 1);

Re: Is it reasonable to learn D

2011-06-13 Thread Jose Armando Garcia
On Mon, Jun 13, 2011 at 6:33 AM, Lloyd Dupont ld-rem...@galador.net wrote: Let's learn together then! :P http://galador.net/codeblog/?tag=/D While my blog post are only about setting up the environment so far.. I have delved in the code for 2 weeks now! (Although I had some day off (work and

Should I bother porting Win32 threading examples?

2011-06-13 Thread Andrej Mitrovic
I'm in the process of porting WinAPI examples from Petzold's Windows Programming book to D. In the book there's a chapter on multithreading. It covers thread creation, messaging queues, critical sections, TLS (heh..), and event signaling. Since we pretty much have all of this in D already (+ its

Re: WindowsAPI Binding - Linker Errors

2011-06-13 Thread Mike Parker
On 6/13/2011 9:00 PM, Loopback wrote: Hello! I've been test programming win32 applications recently, and since the phobos win32 library is so limited, I decided to download and test the WindowsAPI Binding (http://www.dsource.org/projects/bindings/wiki/WindowsApi). Using the latest snapshot (as

[Issue 3765] User defined type contains few user defined types

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3765 yebblies yebbl...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 3746] Misleding error message OP has no effect in expression XXX), in void function

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3746 yebblies yebbl...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 3855] Misleading error messages for return expression in void methods.

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3855 yebblies yebbl...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 3746] Misleding error message OP has no effect in expression XXX), in void function

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3746 yebblies yebbl...@gmail.com changed: What|Removed |Added CC||s...@q1cc.net ---

[Issue 3630] bad error location in has no effect in expression error

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3630 yebblies yebbl...@gmail.com changed: What|Removed |Added CC||bary...@smp.if.uj.edu.pl

[Issue 3437] No way to make conversions to string in pure functions.

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3437 yebblies yebbl...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 3746] Misleding error message OP has no effect in expression XXX), in void function

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3746 --- Comment #7 from bearophile_h...@eml.cc 2011-06-13 03:22:41 PDT --- Issue 3922 contains some interesting comments. It seems this enhancement request for a better error message has many dupes! -- Configure issuemail:

[Issue 3746] Misleding error message OP has no effect in expression XXX), in void function

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3746 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc ---

[Issue 3922] Wrong error message with return in void function

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3922 bearophile_h...@eml.cc changed: What|Removed |Added Status|NEW |RESOLVED Resolution|

[Issue 6110] std.functional: unaryFun should take an array alias.

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6110 timon.g...@gmx.ch changed: What|Removed |Added Severity|normal |enhancement -- Configure

[Issue 6130] utf.toUTF16z needs to be callable with any string type

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6130 --- Comment #1 from Andrej Mitrovic andrej.mitrov...@gmail.com 2011-06-13 08:36:24 PDT --- Also, dstrings should be supported. It makes it much easier to deal with the windows api when you have access to the count of code points of a string:

[Issue 4163] if(bool = bool) results in ill-worded error

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4163 yebblies yebbl...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 2532] '=' does not give a boolean result

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2532 yebblies yebbl...@gmail.com changed: What|Removed |Added CC||schvei...@yahoo.com ---

[Issue 2442] opApply does not allow inferring parameter types when overloaded on const

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2442 yebblies yebbl...@gmail.com changed: What|Removed |Added Keywords||patch CC|

[Issue 4218] safe function cannot call opApply

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4218 yebblies yebbl...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 3180] Covariance of delegates/function pointers

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3180 yebblies yebbl...@gmail.com changed: What|Removed |Added CC||zan77...@nifty.com ---

[Issue 3746] Misleading error message OP has no effect in expression XXX), in void function

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3746 yebblies yebbl...@gmail.com changed: What|Removed |Added Keywords||patch

[Issue 2532] '=' does not give a boolean result

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2532 yebblies yebbl...@gmail.com changed: What|Removed |Added Keywords||patch CC|

[Issue 3746] Misleading error message OP has no effect in expression XXX), in void function

2011-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3746 --- Comment #9 from bearophile_h...@eml.cc 2011-06-13 14:31:09 PDT --- (In reply to comment #8) https://github.com/D-Programming-Language/dmd/pull/121 This adds the error message: testx.d(4): Error: expression with no side effects used

<    1   2