Re: Building basic gtkd,opengl application

2015-09-20 Thread BBasile via Digitalmars-d-learn
On Monday, 21 September 2015 at 03:26:36 UTC, BBasile wrote: On Sunday, 20 September 2015 at 22:30:54 UTC, Michał wrote: I am trying to make some application using gtkd and opengl. I have made simple program but it didn't work and I have no idea why. I have never used gtk so maybe I'm doing s

Re: Building basic gtkd,opengl application

2015-09-20 Thread BBasile via Digitalmars-d-learn
On Sunday, 20 September 2015 at 22:30:54 UTC, Michał wrote: I am trying to make some application using gtkd and opengl. I have made simple program but it didn't work and I have no idea why. I have never used gtk so maybe I'm doing something stupid : / The code: http://pastebin.com/7NfbMqaK E

Building basic gtkd,opengl application

2015-09-20 Thread Michał via Digitalmars-d-learn
I am trying to make some application using gtkd and opengl. I have made simple program but it didn't work and I have no idea why. I have never used gtk so maybe I'm doing something stupid : / The code: http://pastebin.com/7NfbMqaK Error: http://pastebin.com/vaFAP0bu Some ideas? Any tips to g

Re: What difference between std.typecons.Tuple and std.meta.AliasSeq

2015-09-20 Thread John Colvin via Digitalmars-d-learn
On Sunday, 20 September 2015 at 18:28:13 UTC, Alex Parrill wrote: (though you can declare a variable using an AliasSeq containing only types; I think this acts like defining one variable for each type in the seq). This is what is used inside std.typecons.Tuple

Re: Weird behaviour with File.eof

2015-09-20 Thread Daniel Kozák via Digitalmars-d-learn
V Sun, 20 Sep 2015 20:17:36 + Dandyvica via Digitalmars-d-learn napsáno: > Hi all, > > I can't explain to myself this weird behavior: > > void main(string[] argv) > { > char[] line; > auto fh = File(argv[1]); > while (!fh.eof) { > writef("before readln eof=%s

Weird behaviour with File.eof

2015-09-20 Thread Dandyvica via Digitalmars-d-learn
Hi all, I can't explain to myself this weird behavior: void main(string[] argv) { char[] line; auto fh = File(argv[1]); while (!fh.eof) { writef("before readln eof=%s, ", fh.eof); fh.readln(line,std.ascii.newline); writefln(

Re: Question about Object.destroy

2015-09-20 Thread Lambert Duijst via Digitalmars-d-learn
Thank you, this clarified a lot.

Re: Question about Object.destroy

2015-09-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 20 September 2015 at 18:52:17 UTC, Lambert Duijst wrote: Just want to know if D protects against dangling pointers or is this just something you should never do. The answer is both: it tries to protect you but you still shouldn't do it. If we are not supposed to use Object.destroy

Re: Identifying and dealing with deprecated/removed language features

2015-09-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-09-20 13:17, Martin Krejcirik wrote: __VERSION__ ? Will only solve identifying if a feature is supported or not. When the features is actually used a string mixin will still be required, as far as I know. -- /Jacob Carlborg

Re: Question about Object.destroy

2015-09-20 Thread Lambert Duijst via Digitalmars-d-learn
On Sunday, 20 September 2015 at 18:50:44 UTC, Adam D. Ruppe wrote: On Sunday, 20 September 2015 at 18:41:18 UTC, anonymous wrote: But that doesn't change either. I think Adam is mistaken here. huh, I just checked the source... and you are right, it doesn't set classes to null itself, but does

Re: Question about Object.destroy

2015-09-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 20 September 2015 at 18:41:18 UTC, anonymous wrote: But that doesn't change either. I think Adam is mistaken here. huh, I just checked the source... and you are right, it doesn't set classes to null itself, but does null out the vtable inside. *ppv = null; // zero vptr eve

Re: Question about Object.destroy

2015-09-20 Thread Lambert Duijst via Digitalmars-d-learn
On Sunday, 20 September 2015 at 18:39:57 UTC, Adam D. Ruppe wrote: On Sunday, 20 September 2015 at 18:34:37 UTC, Lambert Duijst wrote: Oh that surprises me a bit, because I read in the list of deprecated features that delete is deprecated and that the right thing to do is to use destroy instead

Re: Question about Object.destroy

2015-09-20 Thread anonymous via Digitalmars-d-learn
On Sunday 20 September 2015 20:34, Lambert Duijst wrote: > On Sunday, 20 September 2015 at 18:21:52 UTC, Adam D. Ruppe wrote: [...] >> So after calling destroy(s), s is null, so it segfaults when >> you try to use it. [...] > Also when I print the address of s it gives me some hex number, > but

Re: Question about Object.destroy

2015-09-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 20 September 2015 at 18:34:37 UTC, Lambert Duijst wrote: Oh that surprises me a bit, because I read in the list of deprecated features that delete is deprecated and that the right thing to do is to use destroy instead. Right. One of the benefits of destroy is that it nulls the refe

Re: Question about Object.destroy

2015-09-20 Thread Lambert Duijst via Digitalmars-d-learn
On Sunday, 20 September 2015 at 18:21:52 UTC, Adam D. Ruppe wrote: Very simple: destroy(s) (or s.destroy but i prefer destroy(s)) will set the reference it is passed to null because you aren't supposed to use it anymore. So after calling destroy(s), s is null, so it segfaults when you try to

Re: What difference between std.typecons.Tuple and std.meta.AliasSeq

2015-09-20 Thread Alex Parrill via Digitalmars-d-learn
On Sunday, 20 September 2015 at 18:10:49 UTC, Suliman wrote: Sometimes it's hard to understand the D philosophy, for example now I can't understand diffrence between std.typecons.Tuple and std.meta.AliasSeq. I know that in language like Python there is spatial data type named tuple like: tup1

Re: What difference between std.typecons.Tuple and std.meta.AliasSeq

2015-09-20 Thread Adam D. Ruppe via Digitalmars-d-learn
AliasSeq is just a random collection of stuff. A Tuple is more like a struct.

Re: Debugging D shared libraries

2015-09-20 Thread ponce via Digitalmars-d-learn
On Saturday, 19 September 2015 at 17:02:37 UTC, Russel Winder wrote: English and Spanish meanings of the word are very different. In UK (not sure about Canada, USA, Australia, New Zealand, South Africa,…) it is generally a somewhat derogatory term. In French it means "to rub down with abrasive

Re: Question about Object.destroy

2015-09-20 Thread Adam D. Ruppe via Digitalmars-d-learn
Very simple: destroy(s) (or s.destroy but i prefer destroy(s)) will set the reference it is passed to null because you aren't supposed to use it anymore. So after calling destroy(s), s is null, so it segfaults when you try to use it.

What difference between std.typecons.Tuple and std.meta.AliasSeq

2015-09-20 Thread Suliman via Digitalmars-d-learn
Sometimes it's hard to understand the D philosophy, for example now I can't understand diffrence between std.typecons.Tuple and std.meta.AliasSeq. I know that in language like Python there is spatial data type named tuple like: tup1 = ('physics', 'chemistry', 1997, 2000); But what in D? That w

Re: Question about Object.destroy

2015-09-20 Thread ponce via Digitalmars-d-learn
On Sunday, 20 September 2015 at 17:43:01 UTC, Lambert Duijst wrote: Is it because: - The GC did decide to run and cleanup memory straight after the call to s.destroy() - An object being in an invalid state means the program segfaults when the object is used ? - Another reason.. All meth

Question about Object.destroy

2015-09-20 Thread Lambert Duijst via Digitalmars-d-learn
Hi all, I have a question about the following piece of code that I wrote to experiment with explicit deletion of objects. I am interested in this because, even though D has a garbage collection, sometimes an object holds a non-memory resource, such as a file handle. In these cases explicit ca

Re: This is probably trivial or impossible Code Introspection...

2015-09-20 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 20 September 2015 at 05:50:16 UTC, Ali Çehreli wrote: On 09/19/2015 10:30 PM, H. S. Teoh via Digitalmars-d-learn wrote: On Sun, Sep 20, 2015 at 05:21:03AM +, WhatMeWorry via Digitalmars-d-learn wrote: [...] Thanks. But now I have an even more fundamental problem. I keep gettin

Re: Debugging D shared libraries

2015-09-20 Thread Johannes Pfau via Digitalmars-d-learn
Am Sun, 20 Sep 2015 17:47:00 +0200 schrieb Johannes Pfau : > Am Sat, 19 Sep 2015 17:41:41 +0100 > schrieb Russel Winder via Digitalmars-d-learn > : > > > On Sat, 2015-09-19 at 16:33 +, John Colvin via > > Digitalmars-d-learn wrote: > > > On Saturday, 19 September 2015 at 16:15:45 UTC, Russel

Re: Debugging D shared libraries

2015-09-20 Thread Johannes Pfau via Digitalmars-d-learn
Am Sat, 19 Sep 2015 17:41:41 +0100 schrieb Russel Winder via Digitalmars-d-learn : > On Sat, 2015-09-19 at 16:33 +, John Colvin via Digitalmars-d-learn > wrote: > > On Saturday, 19 September 2015 at 16:15:45 UTC, Russel Winder > > wrote: > > > Sadly the: > > > > > > pragma(LDC_global_crt_ct

Re: How do you handle OutOfMemoryError?

2015-09-20 Thread John Colvin via Digitalmars-d-learn
On Sunday, 20 September 2015 at 00:16:50 UTC, Enjoys Math wrote: Here's my code: https://drive.google.com/file/d/0B3LYxKGJ4ZI_MV91SkxPVVlSOW8/view?usp=sharing I don't have access to a debugger. Run the code for a few minutes and it tends to crash with a core OutOfMemoryError. Any suggestion

Re: Get AA key and value type

2015-09-20 Thread Pierre via Digitalmars-d-learn
On Sunday, 20 September 2015 at 09:34:15 UTC, Ali Çehreli wrote: On 09/20/2015 12:47 AM, Pierre wrote: I see, maybe .KeyType and .ValueType should be integrated in AA. Or like C++ with map, make a ValueType(::value_type) field wich contain a pair of type. Currently, they are templates in st

Re: Identifying and dealing with deprecated/removed language features

2015-09-20 Thread Martin Krejcirik via Digitalmars-d-learn
Dne 20. 9. 2015 v 11:55 Jacob Carlborg napsal(a): > I guess I can use __traits(compiles) to check if typedef and then insert > the "static if" with a string mixing. But is there a better way to do this? __VERSION__ ? -- mk

Re: Debugging D shared libraries

2015-09-20 Thread Martin Krejcirik via Digitalmars-d-learn
Dne 19. 9. 2015 v 18:41 Russel Winder via Digitalmars-d-learn napsal(a): > Indeed, it works well. Well for LDC. DMD and GDC are still broken. My > GDC problems are deeper that this code: Debian packages seem to have > weird problems and Fedora do not package GDC. All I need to do to make your exam

Identifying and dealing with deprecated/removed language features

2015-09-20 Thread Jacob Carlborg via Digitalmars-d-learn
I have a library that needs to check if a type is a typedef. Something like: static if (is(T == typedef)) But now typedef is deprecated or even removed. I want my library to compile with the latest version of DMD without any deprecation warnings but at the same time be backwards compatible. Wh

Re: Get AA key and value type

2015-09-20 Thread Ali Çehreli via Digitalmars-d-learn
On 09/20/2015 12:47 AM, Pierre wrote: I see, maybe .KeyType and .ValueType should be integrated in AA. Or like C++ with map, make a ValueType(::value_type) field wich contain a pair of type. Currently, they are templates in std.traits: http://dlang.org/phobos/std_traits.html#KeyType Ali

Re: Anybody use Derelict FreeType recently (successfully)

2015-09-20 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 20 September 2015 at 02:58:21 UTC, WhatMeWorry wrote: For my D programming I use the Visual D Studio package (plug-in?) with the "free Visual Studio Shell (2013). I download Visual Studio Express 2015 and used the FreeType 2.6 solution file. (So no makefile). I tried making both

Re: Get AA key and value type

2015-09-20 Thread NX via Digitalmars-d-learn
On Saturday, 19 September 2015 at 18:13:09 UTC, Marc Schütz wrote: You can also do it with built-in syntax: template AATypes(AA : K[V], K, V) { alias Key = K; alias Value = V; } K[V] supposed to be V[K] btw...

Re: Get AA key and value type

2015-09-20 Thread Pierre via Digitalmars-d-learn
On Saturday, 19 September 2015 at 18:13:09 UTC, Marc Schütz wrote: On Saturday, 19 September 2015 at 12:50:51 UTC, Pierre wrote: Hi everybody, I would like to extract key and value type from AA. You can also do it with built-in syntax: template AATypes(AA : K[V], K, V) { alias Key = K;

Re: Debugging D shared libraries

2015-09-20 Thread rom via Digitalmars-d-learn
On Saturday, 19 September 2015 at 10:45:22 UTC, Russel Winder wrote: Calling D from Python. I have two functions in D, compiled to a shared object on Linux using LDC (but I get same problem using DMD). The sequential code: extern(C) double sequential(const int n, const double delta) {