RAII trouble

2015-11-20 Thread Spacen Jasset via Digitalmars-d-learn
I have the following code in attempt to create an RAII object wrapper, but it seems that it might be impossible. The problem here is that FT_Init_FreeType is a static which is set at some previous time to a function entry point in the FreeType library. I could use a scope block, but would

Re: RAII trouble

2015-11-20 Thread Spacen Jasset via Digitalmars-d-learn
On Friday, 20 November 2015 at 23:21:03 UTC, anonymous wrote: [...] FT_Init_FreeType must be read at compile time, because freeType is a module level variable, and initializers for module variables must be static values. The initializer is run through CTFE (Compile Time Function Evaluation).

Re: RAII trouble

2015-11-20 Thread Spacen Jasset via Digitalmars-d-learn
On Friday, 20 November 2015 at 23:35:50 UTC, Spacen Jasset wrote: On Friday, 20 November 2015 at 23:21:03 UTC, anonymous wrote: [...] FT_Init_FreeType must be read at compile time, because freeType is a module level variable, and initializers for module variables must be static values. The

Re: char[] == null

2015-11-19 Thread Spacen Jasset via Digitalmars-d-learn
On Thursday, 19 November 2015 at 08:30:54 UTC, Jonathan M Davis wrote: On Wednesday, November 18, 2015 22:15:19 anonymous via Digitalmars-d-learn wrote: [...] Exactly. T[] _is_ a dynamic array. Steven's otherwise wonderful article on arrays in D ( http://dlang.org/d-array-article.html )

scope keyword

2015-11-19 Thread Spacen Jasset via Digitalmars-d-learn
I thought scope was deprecated, but I see that this is still here: http://dlang.org/attribute.html#scope Is it just the uses on classes and local variables that are discouraged, but the use in a function signature will continue? in == const scope?

char[] == null

2015-11-18 Thread Spacen Jasset via Digitalmars-d-learn
Should this be allowed? What is it's purpose? It could compare two arrays, but surely not that each element of type char is null? char[] buffer; if (buffer == null) {}

Re: Deprecation: module std.stream is deprecated

2015-11-10 Thread Spacen Jasset via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 11:57:03 UTC, Jonathan M Davis wrote: ... building blocks rather than kitchen sinks. And most range-based ... I still can't really see why byChunk and byLine are part of the File API? Especially byLine, I'll get byChunk go for now. I think what I am trying

Split range that has no length or slice?

2015-11-09 Thread Spacen Jasset via Digitalmars-d-learn
I can't seem to find a way of splitting a range of characters into lines unless the range has a length or can be sliced? This presumably is because i is a range of chunks, which cannot have a length or a slice. I do not see how to get anything else from the File object at the moment. import

Re: Split range that has no length or slice?

2015-11-09 Thread Spacen Jasset via Digitalmars-d-learn
On Monday, 9 November 2015 at 18:04:23 UTC, Alex Parrill wrote: On Monday, 9 November 2015 at 17:56:14 UTC, Alex Parrill wrote: On Monday, 9 November 2015 at 15:23:21 UTC, Spacen Jasset wrote: On Monday, 9 November 2015 at 14:58:19 UTC, Adam D. Ruppe wrote: File has a .byLine and .byLineCopy

Re: Split range that has no length or slice?

2015-11-09 Thread Spacen Jasset via Digitalmars-d-learn
On Monday, 9 November 2015 at 14:58:19 UTC, Adam D. Ruppe wrote: File has a .byLine and .byLineCopy method you could use to just get lines from it. Ah yes. but unfortunately I don't want to do that. I want to pass a range into my print function. i.e. Sometimes it may not be a File, it might

Re: Deprecation: module std.stream is deprecated

2015-11-08 Thread Spacen Jasset via Digitalmars-d-learn
On Sunday, 8 November 2015 at 08:29:30 UTC, BBaz wrote: On Sunday, 8 November 2015 at 08:21:38 UTC, BBaz wrote: On Saturday, 7 November 2015 at 13:52:29 UTC, Spacen Jasset wrote: [...] I have a used a template, because I cannot directly use the InputRange(char) interface as a type, and auto

Re: Deprecation: module std.stream is deprecated

2015-11-07 Thread Spacen Jasset via Digitalmars-d-learn
On Saturday, 7 November 2015 at 13:30:44 UTC, Jonathan M Davis wrote: On Saturday, November 07, 2015 12:10:05 Spacen Jasset via Digitalmars-d-learn wrote: Deprecation: module std.stream is deprecated - It will be removed from Phobos in October 2016. The std.stream module documentation doesn't

Deprecation: module std.stream is deprecated

2015-11-07 Thread Spacen Jasset via Digitalmars-d-learn
Deprecation: module std.stream is deprecated - It will be removed from Phobos in October 2016. The std.stream module documentation doesn't give any clues as to what an alternative might be. I have this sort of code: this(InputStream input) { int

Re: struct constructor co nfusion

2015-11-06 Thread Spacen Jasset via Digitalmars-d-learn
On Friday, 6 November 2015 at 17:50:17 UTC, Atila Neves wrote: On Friday, 6 November 2015 at 17:34:29 UTC, Spacen Jasset wrote: Hello, I have read various things about struct constructors, specifically 0 argument constructors, and using opCall and @disable this(); which no longer seems to

Re: Working Windows GUI library - no console Window

2015-11-06 Thread Spacen Jasset via Digitalmars-d-learn
On Friday, 6 November 2015 at 15:52:10 UTC, johann wrote: hi, i like to use a window gui library and i think i found a working one. https://github.com/FrankLIKE/dfl2 - works with x64 the problem is, that with DMD 2.069.0, VS2015 and visualD the trick of using "-L/SUBSYSTEM:windows,6.00

struct constructor co nfusion

2015-11-06 Thread Spacen Jasset via Digitalmars-d-learn
Hello, I have read various things about struct constructors, specifically 0 argument constructors, and using opCall and @disable this(); which no longer seems to work. What I am after I think is the behavior of C++'s structs on the stack, namely for some or all of these uses at a given

Re: std.utf.decode behaves unexpectedly - Bug?

2015-11-06 Thread Spacen Jasset via Digitalmars-d-learn
On Friday, 6 November 2015 at 19:26:50 UTC, HeiHon wrote: Consider this: [code] import std.stdio, std.utf, std.exception; void do_decode(string txt) { try { size_t idx; writeln("decode ", txt); for (size_t i = 0; i < txt.length; i++) { dchar

version and configuration

2015-09-12 Thread Spacen Jasset via Digitalmars-d-learn
If I say this in one module: version = current version (Current) { version = featurea; version = featureb; version = featurec; } It appears that I can't put this in a module and import it elsewhere to test the version specifications as they are all in their own namespaces. Is this

Re: stuck on opDiv / opBinary

2015-08-30 Thread Spacen Jasset via Digitalmars-d-learn
On Sunday, 30 August 2015 at 18:12:40 UTC, BBasile wrote: On Sunday, 30 August 2015 at 17:02:58 UTC, Spacen Jasset wrote: [...] try --- Vector3 opBinary(string op)(Vector3 rhs) { static if (op ==/){} else static assert(0, op ~ not implemented); } --- you used the char litteral

Re: observation: D getting a bit complex

2015-08-30 Thread Spacen Jasset via Digitalmars-d-learn
On Sunday, 30 August 2015 at 07:36:55 UTC, BBasile wrote: On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote: immutable(ElementEncodingType!(ElementType!Range))[] buildPath(Range)(Range segments) if (isInputRange!Range isSomeString!(ElementType!Range)); pure nothrow @safe

stuck on opDiv / opBinary

2015-08-30 Thread Spacen Jasset via Digitalmars-d-learn
I have just added an opDiv to this class, but it doesn't seem to pick it up. math/vector.d(30): Error: 'this /= mag' is not a scalar, it is a Vector3 I can't see why that is, becuase my opMul works in the same place. Can anyone point out what I have done wrong? Class Matrix { void

Re: stuck on opDiv / opBinary

2015-08-30 Thread Spacen Jasset via Digitalmars-d-learn
On Sunday, 30 August 2015 at 20:09:25 UTC, Timon Gehr wrote: On 08/30/2015 07:02 PM, Spacen Jasset wrote: [...] import std.math: sqrt; import std.algorithm: map,sum,canFind; struct Vector3{ float[3] xyz; void normalise(){ this/=magnitude(); } float magnitude(){ return

observation: D getting a bit complex

2015-08-29 Thread Spacen Jasset via Digitalmars-d-learn
The following reminds me of the good old C++ template errors the C++ compiler spits out. Whilst D has fixed that problem, some things have gotten more complex. I just wanted to find a replacement for D1 path join, and found this, but it doesn't seem very easy to wade though this stuff.

Re: GLU in DerelictOrg

2015-07-24 Thread Spacen Jasset via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 00:49:29 UTC, Mike Parker wrote: On Tuesday, 21 July 2015 at 16:34:35 UTC, Spacen Jasset wrote: On Tuesday, 21 July 2015 at 15:17:13 UTC, Alex Parrill wrote: On Tuesday, 21 July 2015 at 14:51:47 UTC, John Colvin wrote: Isn't glu considered legacy these days? I

Re: GLU in DerelictOrg

2015-07-21 Thread Spacen Jasset via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 15:17:13 UTC, Alex Parrill wrote: On Tuesday, 21 July 2015 at 14:51:47 UTC, John Colvin wrote: Isn't glu considered legacy these days? I think it's entirely OpenGL 2.x. For the maths stuff see http://code.dlang.org/packages/gl3n Yep. It still uses immediate mode,

GLU in DerelictOrg

2015-07-21 Thread Spacen Jasset via Digitalmars-d-learn
Hello, Can anyone tell me if the GLU functions, gluSpehere etc are availble in DerelictOrg or have they been removed. I can replace these with my own versions, but was hoping to do a quick port to DerelictOrg

Re: GLU in DerelictOrg

2015-07-21 Thread Spacen Jasset via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 11:23:23 UTC, John Colvin wrote: On Tuesday, 21 July 2015 at 11:08:13 UTC, Spacen Jasset wrote: Hello, Can anyone tell me if the GLU functions, gluSpehere etc are availble in DerelictOrg or have they been removed. I can replace these with my own versions, but was

Re: GLU in DerelictOrg

2015-07-21 Thread Spacen Jasset via Digitalmars-d-learn
It seems that Derelict3 contains GLUT whereas derelict2 containss GLU. It appears I need GLU but I am somewhat confused as to what the diffrence is.

have function must pass delegate.

2014-11-13 Thread Spacen Jasset via Digitalmars-d-learn
A method call in the GTK API takes a delegate as an argument(addOnActivate) I would like to be able to pass a function instead (address of). What is the solution, at present I have a wrapper class around the function.