OPTLINK checkpoint(256)

2015-07-20 Thread Lemonfiend via Digitalmars-d-learn
I was still using 2.066.1. When I try to build using 2.067.0 or 2.067.1 I get: Linking... checkpoint(256) --- errorlevel 1 with an "Unexpected OPTLINK Termination" popup which lists a bunch of registers. I'm not sure how to proceed..

Re: Static function template

2015-05-07 Thread Lemonfiend via Digitalmars-d-learn
On Thursday, 7 May 2015 at 10:43:28 UTC, Daniel Kozak wrote: On Thursday, 7 May 2015 at 10:39:09 UTC, Daniel Kozák wrote: On Thu, 07 May 2015 10:33:44 + Vadim Lopatin via Digitalmars-d-learn wrote: struct S { int i; auto foo2(T)(int j) { i=j; } static S foo(T)(i

Static function template

2015-05-07 Thread Lemonfiend via Digitalmars-d-learn
Is it not possible to have a static function template with the same name as the non-static version? struct S { int i; auto foo(T)(int j) { i=j; } static auto foo(T)(int j) { S s; s.foo!T(j); return s; } } void main() { auto s = S.foo!boo

Re: Template mixin enum stringof

2014-12-10 Thread Lemonfiend via Digitalmars-d-learn
On Wednesday, 10 December 2014 at 14:25:30 UTC, ketmar via Digitalmars-d-learn wrote: On Wed, 10 Dec 2014 13:58:20 + Lemonfiend via Digitalmars-d-learn wrote: On Wednesday, 10 December 2014 at 12:57:16 UTC, ketmar via Digitalmars-d-learn wrote: > On Wed, 10 Dec 2014 12:35:44 +0

Re: Template mixin enum stringof

2014-12-10 Thread Lemonfiend via Digitalmars-d-learn
On Wednesday, 10 December 2014 at 12:57:07 UTC, Daniel Kozák via Digitalmars-d-learn wrote: V Wed, 10 Dec 2014 12:35:44 + Lemonfiend via Digitalmars-d-learn napsáno: On Wednesday, 10 December 2014 at 12:08:34 UTC, ketmar via Digitalmars-d-learn wrote: > On Wed, 10 Dec 2014 11:52

Re: Template mixin enum stringof

2014-12-10 Thread Lemonfiend via Digitalmars-d-learn
On Wednesday, 10 December 2014 at 12:57:16 UTC, ketmar via Digitalmars-d-learn wrote: On Wed, 10 Dec 2014 12:35:44 + Lemonfiend via Digitalmars-d-learn wrote: On Wednesday, 10 December 2014 at 12:08:34 UTC, ketmar via Digitalmars-d-learn wrote: > On Wed, 10 Dec 2014 11:52:11 +0

Re: Template mixin enum stringof

2014-12-10 Thread Lemonfiend via Digitalmars-d-learn
On Wednesday, 10 December 2014 at 12:08:34 UTC, ketmar via Digitalmars-d-learn wrote: On Wed, 10 Dec 2014 11:52:11 + Lemonfiend via Digitalmars-d-learn wrote: Consider the following: --- enum Foo { BAR, } mixin template S(string s_) { enum s = s_; } void main() { mixin S

Template mixin enum stringof

2014-12-10 Thread Lemonfiend via Digitalmars-d-learn
Consider the following: --- enum Foo { BAR, } mixin template S(string s_) { enum s = s_; } void main() { mixin S!(Foo.BAR.stringof); // Error: identifier 'stringof' of 'Foo.BAR.stringof' is not defined enum e = Foo.BAR.stringof; mixin S!(e); // works fine } --- Why

Re: alias overloaded function template

2014-11-12 Thread Lemonfiend via Digitalmars-d-learn
The problem is not the alias. The error message is about using the same identifier for two different things: C:\...\temp_0186F968.d(13,1): Error: declaration foo(T)(T t, int i) is already defined. I'm not sure what is giving you that particular error. Without the alias it compiles and runs fin

alias overloaded function template

2014-11-11 Thread Lemonfiend via Digitalmars-d-learn
D is fine with alias this overloaded function: --- void foo(int t) {} void foo(int t, int i) {} alias bar = foo; --- But isn't as happy aliasing these function templates: --- void foo(T)(T t) {} void foo(T)(T t, int i) {} alias bar = foo!int; --- Is there some way/other syntax to make an alias

Re: How to use map?

2014-11-11 Thread Lemonfiend via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 15:53:37 UTC, Marc Schütz wrote: Don't know whether it's documented, but it's a consequence of using string mixins. unaryFun (which is used internally by map) is implemented this way: auto unaryFun(ElementType)(auto ref ElementType __a) { mixin

Re: How to use map?

2014-11-11 Thread Lemonfiend via Digitalmars-d-learn
Oh, no it doesn't. My bad. It was all about !(Foo) vs !(`Foo(a)`). Is there somewhere I can read more about this?

Re: How to use map?

2014-11-11 Thread Lemonfiend via Digitalmars-d-learn
The code you were trying to write: struct Foo(T) { T t; } void main() { import std.stdio, std.algorithm, std.array; float[] vals = [1.1, 2.1, 3.1, 4.1]; auto arr = vals.map!(Foo!float).array; arr.writeln; } Sorry, my example had an unneeded template. Simply this (and also

How to use map?

2014-11-11 Thread Lemonfiend via Digitalmars-d-learn
I'm trying to do something simple like creating an array of struct S from a float array via map: --- void main() { float[] vals = [1.1, 2.1, 3.1, 4.1]; import std.algorithm: map; auto arr = vals.map!`S(a)`.array; writeln(arr); } struct S(T) { T t; } ---

Bug when overload function in multiple modules?

2014-08-27 Thread Lemonfiend via Digitalmars-d-learn
I get: src\app.d(19): Error: None of the overloads of 'foo' are callable using argument types (C3), candidates are: src\app.d(28):main.foo(C1 c) src\app.d(38):main.foo(C2 c) It does work when I explicitly import c3.foo. --- file app.d module app; import std.stdio; import c3;

Re: SList: How do I use linearRemove?

2014-06-26 Thread Lemonfiend via Digitalmars-d-learn
unittest { auto s = SList!int(1, 2, 3, 4, 5); auto r = s[]; popFrontN(r, 3); auto r1 = s.linearRemove(r); assert(s == SList!int(1, 2, 3)); assert(r1.empty); } This works: auto s = SList!int(1, 2, 3, 4, 5); auto r = s[]; popFrontN(r, 1); auto r1 = s.linearRemove(r); This

Re: SList: How do I use linearRemove?

2014-06-26 Thread Lemonfiend via Digitalmars-d-learn
linearRemove is linear, so I think it accepts a range. Perhaps the "once" range is enough. I cannot find once in the docs. Did you mean std.range.only? Error: function std.container.SList!(Tree).SList.linearRemove (Range r) is not callable using argument types (OnlyResult!(Tree, 1u))

SList: How do I use linearRemove?

2014-06-26 Thread Lemonfiend via Digitalmars-d-learn
--- module main; void main() { struct Tree { int apples; } import std.container; SList!Tree list; Tree tree = Tree(5); list.insert(tree); //list.linearRemove(tree); // <-- Error. What is the correct way? } ---

import expression with paths

2014-01-30 Thread Lemonfiend
This does not compile on Windows, but does compile on Mac: --- module main; void main() { import std.path; enum bar = import(`dir` ~ dirSeparator ~ `bar.txt`); } --- The docs say: http://dlang.org/expression.html#ImportExpression "Implementations may restrict the file name in or

struct postblit not called, but still destructed

2014-01-19 Thread Lemonfiend
When a struct is passed to a function as argument, it is first copied and at the end destructed. But in the following code it is not copied, yet still destructed? module main; import std.stdio; struct C { A[] _objs; this(A[] objs...) { writeln(` C thi

Re: struct postblit not called, but still destructed

2014-01-19 Thread Lemonfiend
I just tried the new beta, and the issue remains.

Re: package.d imports

2014-01-17 Thread Lemonfiend
I think this is what you are looking for: http://dlang.org/changelog.html#import_package What an odd place to put it.. Too bad, it doesn't mention anything about calling the functions like in my example, and why some do/don't work. I'd hoped for more.

package.d imports

2014-01-16 Thread Lemonfiend
The following behavior seems odd to me. Could anyone explain why it works as it does? (Does package.d have a page on dlang.org?) --- main.d module main; void main() { test1(); test2(); } void test1() { import pack; // works foo(); // works, did

Re: package.d imports

2014-01-16 Thread Lemonfiend
Sorry, that's --- pack/package.d and --- pack/sub.d

Re: getting __DIR__ and __TIME__ of compilation?

2013-12-27 Thread Lemonfiend
On Friday, 27 December 2013 at 08:57:02 UTC, Ravn wrote: On Friday, 27 December 2013 at 07:31:19 UTC, nazriel wrote: On Friday, 27 December 2013 at 06:39:54 UTC, Ravn wrote: Hi, I'm trying get the directory path and time at which the compilation was made (not when the program is run), something

Re: rmdirRecurse vs readonly

2013-12-25 Thread Lemonfiend
On Tuesday, 24 December 2013 at 16:11:15 UTC, Ali Çehreli wrote: On 12/24/2013 04:13 AM, Lemonfiend wrote: std.file.rmdirRecurse refuses to remove readonly files. How would I go about deleting them anyway? Call std.file.setAttributes() first, which has apparently been added just three days

rmdirRecurse vs readonly

2013-12-24 Thread Lemonfiend
std.file.rmdirRecurse refuses to remove readonly files. How would I go about deleting them anyway?

Re: Reuse C memory for D struct?

2013-11-25 Thread Lemonfiend
On Monday, 25 November 2013 at 17:57:21 UTC, Dicebot wrote: On Monday, 25 November 2013 at 17:38:00 UTC, Lemonfiend wrote: &_this vs _this.ptr I had thought those would give the same result, but apparently not? Think about slice as a struct with two fields - data pointer and data le

Re: Reuse C memory for D struct?

2013-11-25 Thread Lemonfiend
On Thursday, 21 November 2013 at 19:21:10 UTC, Ali Çehreli wrote: On 11/21/2013 07:22 AM, Lemonfiend wrote: > I'm wondering if it's possible to have a struct in D which uses the same > pointer and memory as returned by the extern C function. > This would allow me to manip

Re: Derelict Assimp RemoveComponent

2013-10-01 Thread Lemonfiend
On Thursday, 26 September 2013 at 23:08:15 UTC, David Nadlinger wrote: On Wednesday, 25 September 2013 at 15:32:08 UTC, Lemonfiend wrote: The docs only mention http://assimp.sourceforge.net/lib_html/config_8h.html#afc0a4c00fb90c345eb38fe3f7d7c8637 which is less than helpful.. I'm not

Derelict Assimp RemoveComponent

2013-09-25 Thread Lemonfiend
This might be OT, or missing in Derelict's Assimp bindings, I'm not sure. The aiPostProcessSteps.RemoveComponent flag signals that I want Assimp to skip importing certain components. But where/how do I specify these? The docs only mention http://assimp.sourceforge.net/lib_html/config_8h.html

Re: VisualD import

2013-09-11 Thread Lemonfiend
On Wednesday, 11 September 2013 at 20:36:39 UTC, Rainer Schuetze wrote: On 11.09.2013 18:13, Lemonfiend wrote: Oops, I forgot to say what I actually did. I added derelict to Compiler->General->Additional Imports. The code is just this: module main; import std.stdio;

Re: VisualD import

2013-09-11 Thread Lemonfiend
Oops, I forgot to say what I actually did. I added derelict to Compiler->General->Additional Imports. The code is just this: module main; import std.stdio; import derelict.opengl3.gl3; void main() { writeln("Hello D-World!"); } And the build output is a symbol undefined linker issue

VisualD import

2013-09-11 Thread Lemonfiend
Now that VisualD has been officially accepted onto the d-programming-language github, I decided to give it a try. And failed. Say I want to import derelict, how would I go about it? Thanks.

Re: InstanceOf

2013-06-24 Thread Lemonfiend
On Monday, 24 June 2013 at 15:46:05 UTC, Steven Schveighoffer wrote: On Sun, 23 Jun 2013 11:29:10 -0400, Lemonfiend wrote: On Sunday, 23 June 2013 at 15:15:16 UTC, Jacob Carlborg wrote: On 2013-06-23 13:26, Lemonfiend wrote: foreach (I i; array) { if (B b = cast(B) i) { ... } } Thanks

Re: InstanceOf

2013-06-23 Thread Lemonfiend
On Sunday, 23 June 2013 at 15:15:16 UTC, Jacob Carlborg wrote: On 2013-06-23 13:26, Lemonfiend wrote: foreach (I i; array) { if (B b = cast(B) i) { ... } } Thanks all 3 of you for the quick and identical answers. :) It had not occurred to me to use a cast for this, but indeed the

Re: InstanceOf

2013-06-23 Thread Lemonfiend
foreach (I i; array) { if (B b = cast(B) i) { ... } } Thanks all 3 of you for the quick and identical answers. :) It had not occurred to me to use a cast for this, but indeed the language ref says the same: "In order to determine if an object o is an instance of a class B use a cast" It

InstanceOf

2013-06-23 Thread Lemonfiend
I'm trying to create a fairly generic component system, where an object iterates over a bunch of other objects that all implement a certain interface. And this all works fine, however, I would also like to be able to get objects of a specific type (a la instanceOf), and I can't figure out how t

Re: OpenCL bindings

2013-03-19 Thread Lemonfiend
On Tuesday, 19 March 2013 at 14:55:10 UTC, Mike Parker wrote: On Tuesday, 19 March 2013 at 14:30:19 UTC, Lemonfiend wrote: Hi, I'm interested in updating the existing OpenCL bindings (https://github.com/Trass3r/cl4d) so they work with Derelict3, but have never undertaken such a task.

OpenCL bindings

2013-03-19 Thread Lemonfiend
Hi, I'm interested in updating the existing OpenCL bindings (https://github.com/Trass3r/cl4d) so they work with Derelict3, but have never undertaken such a task. I'm not sure where/how to begin. Does anyone have any advice? :)

Re: Callbacks or similar?

2013-02-16 Thread Lemonfiend
On Saturday, 16 February 2013 at 21:31:05 UTC, Jonathan M Davis wrote: On Saturday, February 16, 2013 22:24:19 Lemonfiend wrote: On Saturday, 16 February 2013 at 21:03:54 UTC, Dicebot wrote: > http://dlang.org/expression.html#FunctionLiteral > > Function parameters/variables are decl

Re: Callbacks or similar?

2013-02-16 Thread Lemonfiend
On Saturday, 16 February 2013 at 21:03:54 UTC, Dicebot wrote: http://dlang.org/expression.html#FunctionLiteral Function parameters/variables are declared in D using "ReturnType function(ParameterTypes) symbol". "function" is a keyword here, it can be swapped for "delegate" to get, em, delegat

Callbacks or similar?

2013-02-16 Thread Lemonfiend
Hi, I'm looking for a way to do call different functions within a loop, so I won't have to write multiple functions with the same looping mechanism. I'm not sure if I'm explaing this very well, but this very simple example should clarify: void foo(int[] arr) { foreach(int val; arr)

Re: Compilation failure

2012-07-18 Thread Lemonfiend
On Wednesday, 18 July 2012 at 12:15:52 UTC, Lemonfiend wrote: On Wednesday, 11 July 2012 at 02:30:47 UTC, Timon Gehr wrote: On 07/11/2012 04:25 AM, ixid wrote: in some way it sees global immutables almost as enums This seems like a bad idea. Consistency of behaviour would seem to be a good

Re: Compilation failure

2012-07-18 Thread Lemonfiend
On Wednesday, 11 July 2012 at 02:30:47 UTC, Timon Gehr wrote: On 07/11/2012 04:25 AM, ixid wrote: in some way it sees global immutables almost as enums This seems like a bad idea. Consistency of behaviour would seem to be a good principle to expect of a language. You are right; this is a b

Re: conv parse imported file bug?

2012-07-16 Thread Lemonfiend
On Monday, 16 July 2012 at 19:46:21 UTC, Jonathan M Davis wrote: On Monday, July 16, 2012 19:02:48 Lemonfiend wrote: According to the bugzilla referenced in the error this was fixed; perhaps not? The commit date for the fix is after the release of 2.059, so presumably, it works just fine

Re: conv parse imported file bug?

2012-07-16 Thread Lemonfiend
On Monday, 16 July 2012 at 17:02:52 UTC, Lemonfiend wrote: [DMD32 D Compiler v2.059] Hello, I was rewriting some code so some large data array was a separate data file, and got an abnormal program termination, with the error: C:\D\dmd2\windows\bin\..\..\src\phobos\std\conv.d(2704): Error

conv parse imported file bug?

2012-07-16 Thread Lemonfiend
[DMD32 D Compiler v2.059] Hello, I was rewriting some code so some large data array was a separate data file, and got an abnormal program termination, with the error: C:\D\dmd2\windows\bin\..\..\src\phobos\std\conv.d(2704): Error: function std.conv.parse!(float[],string).parse compiler erro

Re: Compilation failure

2012-07-10 Thread Lemonfiend
On Sunday, 8 July 2012 at 22:10:32 UTC, bearophile wrote: When tmp1 is defined globally, dmd is doing something different, in some way it sees global immutables almost as enums... I don't know if this is present in D specs. You see it well with this test program: immutable int[] A = [1]; te

Re: Compilation failure

2012-07-10 Thread Lemonfiend
On Sunday, 8 July 2012 at 22:10:32 UTC, bearophile wrote: When tmp1 is defined globally, dmd is doing something different, in some way it sees global immutables almost as enums... I don't know if this is present in D specs. You see it well with this test program: immutable int[] A = [1]; te

Compilation failure

2012-07-08 Thread Lemonfiend
Hi, I seem to have run into a strange error.. When I put tmp1 outside the main loop, it compiles fine and gives the expected output. When tmp1 is put inside the main loop, the compiler seems to get stuck in a loop? I've tested it on: http://dlang.org/index.html See error on bottom (lol) ---