Re: Get specific functions of unknown type at runtime?

2012-12-16 Thread F i L
@Adam D. Ruppe Damn, I was afraid you where going to say to do something like that. It doesn't really work for what I'm thinking about, but thanks for confirming that my original code can't work. I have an alternative in mind, but first, is there a possible way for a Super class to ask about

error Nomber 55 in zlib1.dll did not founded

2012-12-16 Thread Suliman
I am writing some simple downloader App. After it's compiles ok, but when I run it's I got error 55 in zlib1.dll I had put zlib1.dll into my apps folder, but without success http://www.everfall.com/paste/id.php?68zzu6x37k6z

Re: Derelict SFML destructor crashes

2012-12-16 Thread Jacob Carlborg
On 2012-12-17 07:45, Nekroze wrote: So what i am getting here is that either A: having it in the destructor will work solong as the GC cleanup is called before the end of main because that is when sfml is unloaded OR B: I just have to have a manual destroy method in my class too to release the s

Re: Get specific functions of unknown type at runtime?

2012-12-16 Thread Jacob Carlborg
On 2012-12-17 02:39, F i L wrote: My goal is this, to have an XML file: and a D file: module person; import std.stdio; class Person { void greet() { writeln("hello"); } } and then another D file: modul

Re: Derelict SFML destructor crashes

2012-12-16 Thread Nekroze
On Monday, 17 December 2012 at 04:42:49 UTC, Mike Parker wrote: On Monday, 17 December 2012 at 04:40:39 UTC, Mike Parker wrote: First, please take all Derelict trouble-shooting problems to the Derelict forums[1]. I never check the sfml forums. I do check the newsgroups regularly, but these news

Re: phobos by ref or by value

2012-12-16 Thread Jonathan M Davis
On Monday, December 17, 2012 04:06:52 Dan wrote: > > They'll use ref when it's required for > > the semantics of what they're doing, but auto ref on function > > parameters is > > rare. > > When would ref be required for semantics? I am asking this to > learn the D way - so any guidelines are help

Re: Derelict SFML destructor crashes

2012-12-16 Thread Mike Parker
On Monday, 17 December 2012 at 04:40:39 UTC, Mike Parker wrote: First, please take all Derelict trouble-shooting problems to the Derelict forums[1]. I never check the sfml forums. I do check the newsgroups regularly, but these newsgroups are not generally the place to look for help with Derelic

Re: Derelict SFML destructor crashes

2012-12-16 Thread Mike Parker
First, please take all Derelict trouble-shooting problems to the Derelict forums[1]. I never check the sfml forums. I do check the newsgroups regularly, but these newsgroups are not generally the place to look for help with Derelict problems. Plus, by posting in other places, you are making it

Re: phobos by ref or by value

2012-12-16 Thread Dan
On Monday, 17 December 2012 at 03:23:13 UTC, bearophile wrote: Then I suggest you to not study std.random because it currently contains know flaws regarding what you are saying. Fine, thanks. But which would be recommended to study?

Re: phobos by ref or by value

2012-12-16 Thread bearophile
Dan: Usually the best place to learn the way of a language is studying its standard libraries, Then I suggest you to not study std.random because it currently contains know flaws regarding what you are saying. Bye, bearophile

Re: phobos by ref or by value

2012-12-16 Thread Dan
On Sunday, 16 December 2012 at 23:02:30 UTC, Jonathan M Davis wrote: You _don't_ take ranges by ref unless you want to alter the original, which is almost never the case. Functions like popFrontN are the exception. And since you _are_ going to mutate the parameter (since ranges iterate via mu

Re: Get specific functions of unknown type at runtime?

2012-12-16 Thread Adam D. Ruppe
The way I'd do it is to make an interface with a generic call method. The classes themselves fill this out using __traits. interface SceneObject { void _callFunction(string name); } mixin template SceneObjectReflection() { override void _callFunction(string name) { forea

Get specific functions of unknown type at runtime?

2012-12-16 Thread F i L
My goal is this, to have an XML file: and a D file: module person; import std.stdio; class Person { void greet() { writeln("hello"); } } and then another D file: module main; import person; import std.xml;

Re: Get class type parameters at compile time

2012-12-16 Thread js.mdnq
I see now why it was returning a bool as that is the type of the template argument passed. class A(bool x = true) then your TemplateArgs returns `tuple(bool)`. What I'm looking for is something that returns `(x)`. For class A(T1, T2, bool x = true) I would like `(T1, T2, x)`. To see why thi

Re: Get class type parameters at compile time

2012-12-16 Thread js.mdnq
On Saturday, 15 December 2012 at 21:49:51 UTC, Philippe Sigaud wrote: Oops ;/ How do I get the number of type arguments if I don't know them yet? I know this sort of seems wrong but somehow, to know how to alias the class I need to know it's number of arguments. (I don't think it makes too mu

Re: alias type reduction

2012-12-16 Thread js.mdnq
On Sunday, 16 December 2012 at 15:21:17 UTC, Philippe Sigaud wrote: The real issue I'm having now is not having to mangle the names and hide the `_NestLevel` and `_Offset` dependencies. alias works for the case of one template argument to _A. Simply `alias _A!(true) A`. But when I have more

Re: static code generation

2012-12-16 Thread js.mdnq
On Sunday, 16 December 2012 at 20:29:19 UTC, r_m_r wrote: On 12/16/2012 02:03 PM, js.mdnq wrote: That looks like it might be pretty close. I was also thinking that one could just use mixin templates of trying to do it with structs directly. i dunno if this is what u want, but have a look: ht

Re: phobos by ref or by value

2012-12-16 Thread Jonathan M Davis
On Sunday, December 16, 2012 16:09:45 Dan wrote: > Is there a general philosophy in D phobos on when to pass by > value or > reference? For instance, to find a slice using lowerBound many > copies > of the target item, as well as copies of items in the collection > are > made (see code example bel

Re: static code generation

2012-12-16 Thread js.mdnq
On Sunday, 16 December 2012 at 15:34:34 UTC, Philippe Sigaud wrote: One could also think of it as an algebra of structs. It would be nice to be able to do stuff like A + B, A - B(possibly useless), A*B(possibly useless), etc... A + B would just combine the members, A - B could remove the memb

Re: static code generation

2012-12-16 Thread r_m_r
On 12/16/2012 02:03 PM, js.mdnq wrote: That looks like it might be pretty close. I was also thinking that one could just use mixin templates of trying to do it with structs directly. i dunno if this is what u want, but have a look: http://dpaste.dzfl.pl/f5616d77 cheers, r_m_r

Re: recursive function call at compile time

2012-12-16 Thread Philippe Sigaud
> > > When you instantiate MyStruct!5, it tries to define ret, so it > instantiates MyStruct!4, MyStruct!3, ... and so on. You have to put a > static if or something else to stop that. > Like this: import std.stdio; struct MyStruct(uint K) if (K > 0) // Only to disable direct creation for K==0 {

Re: Unittest

2012-12-16 Thread Jacob Carlborg
On 2012-12-16 19:39, bioinfornatics wrote: Dear, I would like to understand if to have an empty main file ils need to use unittest. I explain i have a library with some unittest section -- foo.d-- void doFoo(){ ... } unittest{ scope(success) writeln( "ok" ); scope(failure) writeln( "no"

Re: Unittest

2012-12-16 Thread Dan
On Sunday, 16 December 2012 at 18:39:30 UTC, bioinfornatics wrote: Dear, I would like to understand if to have an empty main file ils need to use unittest. I explain i have a library with some unittest section -- foo.d-- void doFoo(){ ... } unittest{ scope(success) writeln( "ok" ); scop

Unittest

2012-12-16 Thread bioinfornatics
Dear, I would like to understand if to have an empty main file ils need to use unittest. I explain i have a library with some unittest section -- foo.d-- void doFoo(){ ... } unittest{ scope(success) writeln( "ok" ); scope(failure) writeln( "no" ); doFoo(); } -- to use unittest i nee

Re: recursive function call at compile time

2012-12-16 Thread bearophile
Oleg: at compile time i have errors ./recursion.d(7): Error: index 4294967295 overflow for static array ./recursion.d(7): Error: index 4294967294 overflow for static array etc It prints a little too many of those... call 'recursionAlgo()' where it should not be ( K == 1 ) The firs

recursive function call at compile time

2012-12-16 Thread Oleg
Hello. I want use recursion, but in my situation compiler doesn't correct work. import std.stdio; struct MyStruct(uint K) { real[K] data; auto getSmaller() { MyStruct!(K-1) ret; foreach( no, ref d; ret.data ) d = data[no]; return ret; }

Re: Derelict SFML destructor crashes

2012-12-16 Thread Nekroze
On Sunday, 16 December 2012 at 17:14:55 UTC, Maxim Fomin wrote: On Sunday, 16 December 2012 at 15:21:46 UTC, Nekroze wrote: On Sunday, 16 December 2012 at 14:59:32 UTC, Maxim Fomin wrote: On Sunday, 16 December 2012 at 14:42:57 UTC, Nekroze wrote: I am trying to do some wrapping of the CSFML de

Re: Derelict SFML destructor crashes

2012-12-16 Thread Maxim Fomin
On Sunday, 16 December 2012 at 15:21:46 UTC, Nekroze wrote: On Sunday, 16 December 2012 at 14:59:32 UTC, Maxim Fomin wrote: On Sunday, 16 December 2012 at 14:42:57 UTC, Nekroze wrote: I am trying to do some wrapping of the CSFML derelict bindings to classes however when i use the CSFML methods

Re: Derelict SFML destructor crashes

2012-12-16 Thread Nekroze
On Sunday, 16 December 2012 at 15:21:46 UTC, Nekroze wrote: On Sunday, 16 December 2012 at 14:59:32 UTC, Maxim Fomin wrote: On Sunday, 16 December 2012 at 14:42:57 UTC, Nekroze wrote: I am trying to do some wrapping of the CSFML derelict bindings to classes however when i use the CSFML methods

Re: bio parser

2012-12-16 Thread Simen Kjaeraas
On 2012-09-16 17:12, bioinfornatics wrote: Dear, I wrote a fasta format parser and fastq format parser. These parser used MmFile and do not load all file these will save memory. Fastq http://dpaste.dzfl.pl/9b23574d Fasta http://dpaste.dzfl.pl/228dba11 The way to iterate over it is really cl

bio parser

2012-12-16 Thread bioinfornatics
Dear, I wrote a fasta format parser and fastq format parser. These parser used MmFile and do not load all file these will save memory. Fastq http://dpaste.dzfl.pl/9b23574d Fasta http://dpaste.dzfl.pl/228dba11 The way to iterate over it is really close and i search a way to have one struct bySecti

Re: static code generation

2012-12-16 Thread Philippe Sigaud
> it would be real nice if I there was a compile time construct for this. > like "me" or something that would return type info inside the current scope. > > class A(T) { this() { writeln(me.typeinfo.name); } > > would print "A(T)". > > (of course me is probably a bad name but just an example :) >

Re: Derelict SFML destructor crashes

2012-12-16 Thread Nekroze
On Sunday, 16 December 2012 at 14:59:32 UTC, Maxim Fomin wrote: On Sunday, 16 December 2012 at 14:42:57 UTC, Nekroze wrote: I am trying to do some wrapping of the CSFML derelict bindings to classes however when i use the CSFML methods to destroy the objects it causes a crash. I have made a po

Re: alias type reduction

2012-12-16 Thread Philippe Sigaud
> > > The real issue I'm having now is not having to mangle the names and hide > the `_NestLevel` and `_Offset` dependencies. > > alias works for the case of one template argument to _A. Simply `alias > _A!(true) A`. But when I have more than one such as `class _A(T1, bool)` I > can't do `alias _A!

phobos by ref or by value

2012-12-16 Thread Dan
Is there a general philosophy in D phobos on when to pass by value or reference? For instance, to find a slice using lowerBound many copies of the target item, as well as copies of items in the collection are made (see code example below). This seems unnecessary - why not have functions like:

Re: Derelict SFML destructor crashes

2012-12-16 Thread Maxim Fomin
On Sunday, 16 December 2012 at 14:42:57 UTC, Nekroze wrote: I am trying to do some wrapping of the CSFML derelict bindings to classes however when i use the CSFML methods to destroy the objects it causes a crash. I have made a post in the SFML>D forum because they have syntax highlighting for

Re: static code generation

2012-12-16 Thread anonymous
On Sunday, 16 December 2012 at 08:49:10 UTC, js.mdnq wrote: On Sunday, 16 December 2012 at 06:38:13 UTC, anonymous wrote: On Saturday, 15 December 2012 at 16:32:27 UTC, r_m_r wrote: On 12/15/2012 08:57 PM, anonymous wrote: Note that here s1alpha and s2alpha are distinct types. what about thi

Re: Cross Compiler Lniux to Win32

2012-12-16 Thread Johannes Pfau
Am Sun, 16 Dec 2012 04:02:41 +0100 schrieb "Nekroze" : >This would be fine i guess > so long as i could get away with being able to compile without > using the llvm-config tool that gives you the library and include > paths based on command line input because i am assuming i cant do > somethin

Re: std.math.approxEqual, 'maxRelDiff' parameter?

2012-12-16 Thread js.mdnq
On Saturday, 15 December 2012 at 19:01:23 UTC, ref2401 wrote: What does means 'maxRelDiff' parameter? I looked at the source code of this method and I still didn't get it. return fabs((lhs - rhs) / rhs) <= maxRelDiff || maxAbsDiff != 0 && fabs(lhs - rhs) <= maxAbsDiff; In what cases can I use

Re: static code generation

2012-12-16 Thread js.mdnq
On Sunday, 16 December 2012 at 06:38:13 UTC, anonymous wrote: On Saturday, 15 December 2012 at 16:32:27 UTC, r_m_r wrote: On 12/15/2012 08:57 PM, anonymous wrote: Note that here s1alpha and s2alpha are distinct types. what about this: http://dpaste.dzfl.pl/95f7a74d Consider struct Foo {mix

Re: static code generation

2012-12-16 Thread js.mdnq
On Sunday, 16 December 2012 at 01:32:44 UTC, r_m_r wrote: On 12/16/2012 06:36 AM, r_m_r wrote: this is the closest I can get: http://dpaste.dzfl.pl/9d11d060 Cleaned up a bit: http://dpaste.dzfl.pl/d9f001db regards, r_m_r That looks like it might be pretty close. I was also thinking that on