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());
}
}
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[]
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
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
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
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
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;
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
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
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
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
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)
{
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[]
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
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;
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
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
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[=
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;
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;
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] =
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
== 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,
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
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
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
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.
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
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
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
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
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:
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
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
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
Shouldn't the linker/compiler be able to solve this on its own then?
Use rdmd or xfBuild to automatically compile all needed modules.
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:
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)
{
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)
{
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);
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
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
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.
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
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,
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);
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
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
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
http://d.puremagic.com/issues/show_bug.cgi?id=3765
yebblies yebbl...@gmail.com changed:
What|Removed |Added
Status|NEW |RESOLVED
http://d.puremagic.com/issues/show_bug.cgi?id=3746
yebblies yebbl...@gmail.com changed:
What|Removed |Added
Status|NEW |RESOLVED
http://d.puremagic.com/issues/show_bug.cgi?id=3855
yebblies yebbl...@gmail.com changed:
What|Removed |Added
Status|NEW |RESOLVED
http://d.puremagic.com/issues/show_bug.cgi?id=3746
yebblies yebbl...@gmail.com changed:
What|Removed |Added
CC||s...@q1cc.net
---
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
http://d.puremagic.com/issues/show_bug.cgi?id=3437
yebblies yebbl...@gmail.com changed:
What|Removed |Added
Status|NEW |RESOLVED
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:
http://d.puremagic.com/issues/show_bug.cgi?id=3746
bearophile_h...@eml.cc changed:
What|Removed |Added
CC||bearophile_h...@eml.cc
---
http://d.puremagic.com/issues/show_bug.cgi?id=3922
bearophile_h...@eml.cc changed:
What|Removed |Added
Status|NEW |RESOLVED
Resolution|
http://d.puremagic.com/issues/show_bug.cgi?id=6110
timon.g...@gmx.ch changed:
What|Removed |Added
Severity|normal |enhancement
--
Configure
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:
http://d.puremagic.com/issues/show_bug.cgi?id=4163
yebblies yebbl...@gmail.com changed:
What|Removed |Added
Status|NEW |RESOLVED
http://d.puremagic.com/issues/show_bug.cgi?id=2532
yebblies yebbl...@gmail.com changed:
What|Removed |Added
CC||schvei...@yahoo.com
---
http://d.puremagic.com/issues/show_bug.cgi?id=2442
yebblies yebbl...@gmail.com changed:
What|Removed |Added
Keywords||patch
CC|
http://d.puremagic.com/issues/show_bug.cgi?id=4218
yebblies yebbl...@gmail.com changed:
What|Removed |Added
Status|NEW |RESOLVED
http://d.puremagic.com/issues/show_bug.cgi?id=3180
yebblies yebbl...@gmail.com changed:
What|Removed |Added
CC||zan77...@nifty.com
---
http://d.puremagic.com/issues/show_bug.cgi?id=3746
yebblies yebbl...@gmail.com changed:
What|Removed |Added
Keywords||patch
http://d.puremagic.com/issues/show_bug.cgi?id=2532
yebblies yebbl...@gmail.com changed:
What|Removed |Added
Keywords||patch
CC|
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
101 - 168 of 168 matches
Mail list logo