Re: hasUDA with this

2018-07-20 Thread Timoses via Digitalmars-d-learn
On Friday, 20 July 2018 at 16:53:12 UTC, jmh530 wrote: Hmm, on that part about the attributes copying their values, I suppose it would be sufficient if I could apply the attributes to a group of declarations. However, it didn't seem to work properly for me with UDAs, and I noticed that even

Re: hasUDA with this

2018-07-20 Thread jmh530 via Digitalmars-d-learn
On Friday, 20 July 2018 at 14:11:23 UTC, jmh530 wrote: On Friday, 20 July 2018 at 07:25:23 UTC, Simen Kjærås wrote: UDAs apply to symbols. When you pass something to a function, the symbol does not go with the value, and thus that UDA goes away. It's similar to assigning to a different

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

2018-07-20 Thread Seb via Digitalmars-d-learn
On Friday, 20 July 2018 at 15:33:19 UTC, Radu wrote: On Thursday, 19 July 2018 at 18:16:17 UTC, kinke wrote: I'll go with Seb's suggestion and look at the betterC tests upstream for issues like this. FYI: I made a reboot of the old PR to a new one which just adds the betterC testsuite:

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-20 Thread jmh530 via Digitalmars-d-learn
On Friday, 20 July 2018 at 15:20:43 UTC, bachmeier wrote: Can confirm that dpp works to create mex files. Rewriting the mypow2.c example in D: [snip] This sounds really great. I assume if it works with Octave it is very likely to work with Matlab's mex.h without issues (I might get

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

2018-07-20 Thread Radu via Digitalmars-d-learn
On Thursday, 19 July 2018 at 18:16:17 UTC, kinke wrote: On Thursday, 19 July 2018 at 12:44:30 UTC, Radu wrote: [...] Removing some superfluous explicit druntime dependencies from Phobos would be a start. Your (nice) example compiles fine with this 4-lines Phobos hack: [...] Was able to

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-20 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 20 June 2018 at 18:47:10 UTC, Jordi Gutiérrez Hermoso wrote: Another possibility might be in dlopen'able functions. Currently Octave uses so-called oct functions, which are nothing more than C++ object code that is dynamically loaded by the interpreter at runtime. They are

Re: hasUDA with this

2018-07-20 Thread jmh530 via Digitalmars-d-learn
On Friday, 20 July 2018 at 07:25:23 UTC, Simen Kjærås wrote: UDAs apply to symbols. When you pass something to a function, the symbol does not go with the value, and thus that UDA goes away. It's similar to assigning to a different variable: import std.traits : hasUDA; @("foo")

Re: Trying to use the libclang Dub package

2018-07-20 Thread bachmeier via Digitalmars-d-learn
On Friday, 20 July 2018 at 10:31:44 UTC, Laurent Tréguier wrote: On Thursday, 19 July 2018 at 15:42:02 UTC, bachmeier wrote: Found the problem. The libclang package is looking for /usr/lib/llvm-3.9/lib/libclang.so. For some reason, Ubuntu has libclang.so.1. Creating a symlink in that directory

Re: Disabling struct destructor illegal?

2018-07-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/19/18 4:50 AM, 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 destructor would make it as

Re: Windows 64-bit import library

2018-07-20 Thread evilrat via Digitalmars-d-learn
On Friday, 20 July 2018 at 04:31:38 UTC, Jordan Wilson wrote: 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

Re: Disabling struct destructor illegal?

2018-07-20 Thread Jim Balter via Digitalmars-d-learn
On Thursday, 19 July 2018 at 10:04:34 UTC, RazvanN wrote: 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:

Re: Trying to use the libclang Dub package

2018-07-20 Thread Laurent Tréguier via Digitalmars-d-learn
On Thursday, 19 July 2018 at 15:42:02 UTC, bachmeier wrote: Found the problem. The libclang package is looking for /usr/lib/llvm-3.9/lib/libclang.so. For some reason, Ubuntu has libclang.so.1. Creating a symlink in that directory to libclang.so is a solution. Do you have the development

Re: hasUDA with this

2018-07-20 Thread Simen Kjærås via Digitalmars-d-learn
On Thursday, 19 July 2018 at 19:18:43 UTC, jmh530 wrote: 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. Am I missing something, or should I submit an enhancement request? UDAs apply to

Re: hasUDA with this

2018-07-20 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.