Re: hasUDA with this

2018-07-19 Thread Timoses via Digitalmars-d-learn
On Thursday, 19 July 2018 at 19:18:43 UTC, jmh530 wrote: I wanted to create a struct with a member function whose behavior was different depending on whether the struct instance had a particular UDA. However, it seems like hasUDA doesn't seem to produce the result I would have expected here.

Re: Member function passed through template alias only requiring `this` in certain conditions?

2018-07-19 Thread Timoses via Digitalmars-d-learn
On Thursday, 19 July 2018 at 22:16:22 UTC, Ali Çehreli wrote: On 07/19/2018 08:12 AM, Emma wrote: > [...] > If I try to compile it, dmd complains, which I guess makes sense: > > --- > Error: need this for bar of type void() > Error: need this for baz of type void() > --- > > [...] I think it's a

Re: Windows 64-bit import library

2018-07-19 Thread Mike Parker via Digitalmars-d-learn
On Friday, 20 July 2018 at 04:31:38 UTC, Jordan Wilson wrote: I don't have MSVC, so I built it using mingw, which generated a .a lib. I shall google some more, as I understand it DMD -m64 uses Mingw libs as a fall back when MSVC not found, I compiled Lua using mingw, I can't be too much furthe

Re: Windows 64-bit import library

2018-07-19 Thread Jordan Wilson via Digitalmars-d-learn
On Friday, 20 July 2018 at 01:34:39 UTC, Mike Parker wrote: On Thursday, 19 July 2018 at 21:43:35 UTC, Jordan Wilson wrote: Is there any way I can generate the appropriate lib? Else I think I'll need to get hold of the proper import libs that come with the Lua distribution. Lua is extreme

Re: Windows 64-bit import library

2018-07-19 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 19 July 2018 at 21:43:35 UTC, Jordan Wilson wrote: Is there any way I can generate the appropriate lib? Else I think I'll need to get hold of the proper import libs that come with the Lua distribution. Lua is extremely easy to build. That will generate the import lib for you.

Re: Member function passed through template alias only requiring `this` in certain conditions?

2018-07-19 Thread Ali Çehreli via Digitalmars-d-learn
On 07/19/2018 08:12 AM, Emma wrote: > void test(alias fn1, alias fn2)() > { > fn1(); > fn2(); > } > > struct Foo > { > void foo() > { > test!(bar, baz); > } > > void bar() > {} > > void baz() > {} > } > --- > > If I try to compile it, dmd comp

Windows 64-bit import library

2018-07-19 Thread Jordan Wilson via Digitalmars-d-learn
I'm trying to create an import library from a dll (in this case, a Lua dll). Using dumpbin, I end up with a .def file: EXPORTS luaL_addlstring luaL_addstring luaL_addvalue luaL_argerror luaL_buffinit ... I then use MS lib tool to generate a lib file: lib /def:lua53.def /out:lua53.lib /machine

hasUDA with this

2018-07-19 Thread jmh530 via Digitalmars-d-learn
I wanted to create a struct with a member function whose behavior was different depending on whether the struct instance had a particular UDA. However, it seems like hasUDA doesn't seem to produce the result I would have expected here. I tried using getAttributes, but that didn't work either.

Re: Is there any plan for a dependency-free subset of "core" runtime?

2018-07-19 Thread kinke via Digitalmars-d-learn
On Thursday, 19 July 2018 at 12:44:30 UTC, Radu wrote: --- int foo() { import std.algorithm, std.range; auto r = 100.iota.stride(2).take(5); return r.sum(); } --- ldc2 -mtriple=wasm32-unknown-unknown-wasm -betterC -link-internally -L-allow-undefined -release -Os wasm.d ldc\bin\..\imp

Re: I can has @nogc and throw Exceptions?

2018-07-19 Thread timotheecour via Digitalmars-d-learn
On Friday, 13 February 2015 at 19:03:10 UTC, Jonathan Marler wrote: This question comes from wanting to be able to throw an exception in code that is @nogc. https://dlang.org/changelog/2.079.0.html#dip1008 ```d void main() @nogc { throw new Exception("I'm @nogc now"); } ```

Re: Trying to use the libclang Dub package

2018-07-19 Thread bachmeier via Digitalmars-d-learn
On Thursday, 19 July 2018 at 14:21:51 UTC, bachmeier wrote: [...] .dub/build/unittest-unittest-linux.posix-x86_64-dmd_2081-A8A607969A46E4CDF45479E7A30874E9/ut.o: In function `_D5parse3raw17__unittest_L64_C9FZ12__dgliteral1MFNaNbNiNfZk': /home/office/.dub/packages/libclang-0.0.6/libclang/tests/

Member function passed through template alias only requiring `this` in certain conditions?

2018-07-19 Thread Emma via Digitalmars-d-learn
Hello, I’ve got this piece of code: --- import std.stdio; void test(alias fn1, alias fn2)() { fn1(); fn2(); } struct Foo { void foo() { test!(bar, baz); } void bar() {} void baz() {} } --- If I try to compile it, dmd complains, which I guess makes

Re: Is there any plan for a dependency-free subset of "core" runtime?

2018-07-19 Thread Seb via Digitalmars-d-learn
On Thursday, 19 July 2018 at 12:44:30 UTC, Radu wrote: Just tried something similar with new LDC Webassembly support [1] and it fails to compile ... This is a prime example of stuff that should just workTM on targets like that. I would like to submit some fixes but I think there needs to be

Trying to use the libclang Dub package

2018-07-19 Thread bachmeier via Digitalmars-d-learn
I haven't been able to get dpp to build. I've discovered that the problem is with libclang. It installs, but when running the tests, I get the lengthy message below. Obviously I need to install something (running Ubuntu 16.04) but I've got numerous libclang related packages installed already an

Re: Is there any plan for a dependency-free subset of "core" runtime?

2018-07-19 Thread Seb via Digitalmars-d-learn
On Thursday, 19 July 2018 at 12:40:09 UTC, Zheng (Vic) Luo wrote: On Thursday, 19 July 2018 at 11:35:00 UTC, Seb wrote: Well, since 2.079 it's actually possible to use D without a dependency any runtime (even libc): https://dlang.org/changelog/2.079.0.html#minimal_runtime Also with -betterC

Re: Configuring DerelictGL3

2018-07-19 Thread Entity325 via Digitalmars-d-learn
On Thursday, 19 July 2018 at 09:41:34 UTC, Mike Parker wrote: Are you doing all of that in the main thread, or a separate one? It's all on a separate thread, but I checked every single reference I could find after posting yesterday, and the OGL context is never referenced outside of the thre

Re: Disabling struct destructor illegal?

2018-07-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 19, 2018 10:04:34 RazvanN via Digitalmars-d-learn wrote: > I just don't understand why you would ever mark the destructor of > a struct with @disable. When is that useful? If it's not, why not > just forbit it? There's nothing special about destructors here. You can @disable any

Re: Is there any plan for a dependency-free subset of "core" runtime?

2018-07-19 Thread Zheng Luo (Vic) via Digitalmars-d-learn
On Thursday, 19 July 2018 at 11:35:00 UTC, Seb wrote: Well, since 2.079 it's actually possible to use D without a dependency any runtime (even libc): https://dlang.org/changelog/2.079.0.html#minimal_runtime Also with -betterC you can actually use lots of things from core that don't depend o

Re: Is there any plan for a dependency-free subset of "core" runtime?

2018-07-19 Thread Radu via Digitalmars-d-learn
On Thursday, 19 July 2018 at 11:35:00 UTC, Seb wrote: On Thursday, 19 July 2018 at 10:27:36 UTC, Zheng (Vic) Luo wrote: Current implementation of d-runtime relies on a lot of symbols from libc, librt, libpthread, which makes it hard to create a minimal runtime used for embedded devices. Althoug

Re: taskPool.reduce vs algorithm.reduce

2018-07-19 Thread Malte via Digitalmars-d-learn
On Wednesday, 11 July 2018 at 10:07:33 UTC, Timoses wrote: On Wednesday, 11 July 2018 at 08:31:30 UTC, Dorian Haglund wrote: [...] As the error message says taskPool.reduce is a non-global template. It's embedded in a taskPool struct. I can't say what the reason is that a delegate cannot be

Re: Disabling struct destructor illegal?

2018-07-19 Thread Simen Kjærås via Digitalmars-d-learn
On Thursday, 19 July 2018 at 10:04:34 UTC, RazvanN wrote: I just don't understand why you would ever mark the destructor of a struct with @disable. When is that useful? If it's not, why not just forbit it? struct S1 { ~this() { /* stuff */ } } struct S2 { S1 s; @disable ~this(); }

Re: Is there any plan for a dependency-free subset of "core" runtime?

2018-07-19 Thread Seb via Digitalmars-d-learn
On Thursday, 19 July 2018 at 10:27:36 UTC, Zheng (Vic) Luo wrote: Current implementation of d-runtime relies on a lot of symbols from libc, librt, libpthread, which makes it hard to create a minimal runtime used for embedded devices. Although there are some unofficial minimal versions of d-runt

Is there any plan for a dependency-free subset of "core" runtime?

2018-07-19 Thread Zheng Luo (Vic) via Digitalmars-d-learn
Current implementation of d-runtime relies on a lot of symbols from libc, librt, libpthread, which makes it hard to create a minimal runtime used for embedded devices. Although there are some unofficial minimal versions of d-runtime, many of them lack maintenance and outdates rapidly. I was won

Re: Disabling struct destructor illegal?

2018-07-19 Thread RazvanN via Digitalmars-d-learn
On Thursday, 19 July 2018 at 09:50:32 UTC, Jim Balter wrote: On Thursday, 19 July 2018 at 08:50:15 UTC, RazvanN wrote: struct A { int a; @disable ~this() {} } void main() { A a = A(2); } Currently, this code yields: Error: destructor `A.~this` cannot be used because it is annotat

Re: Disabling struct destructor illegal?

2018-07-19 Thread Jim Balter via Digitalmars-d-learn
On Thursday, 19 July 2018 at 08:50:15 UTC, RazvanN wrote: struct A { int a; @disable ~this() {} } void main() { A a = A(2); } Currently, this code yields: Error: destructor `A.~this` cannot be used because it is annotated with @disable I was expecting that disabling the destruct

Re: Configuring DerelictGL3

2018-07-19 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 19 July 2018 at 00:27:58 UTC, Entity325 wrote: So I'm using the standard process: DerelictGL3.load(); glContext = SDL_GL_CreateContext(sdlWindow); GLVersion glVersion = DerelictGL3.reload(); About 1/3 of the time, the program hangs on the 3rd line and never gets past it. Curren

Disabling struct destructor illegal?

2018-07-19 Thread RazvanN via Digitalmars-d-learn
struct A { int a; @disable ~this() {} } void main() { A a = A(2); } Currently, this code yields: Error: destructor `A.~this` cannot be used because it is annotated with @disable I was expecting that disabling the destructor would make it as if the struct does not have a destruct

Re: Implicit conversion of struct with methods to immutable in pure function fails

2018-07-19 Thread Timoses via Digitalmars-d-learn
On Thursday, 19 July 2018 at 06:35:36 UTC, Simen Kjærås wrote: On Wednesday, 18 July 2018 at 11:28:54 UTC, Timoses wrote: But why is a context pointer a problem? Is it problematic because the context pointer to the main scope can not guarantee `immutable`? E.g. if I happened to use data from m