Why 'getSymbolsByUDA' filters private members?

2018-05-27 Thread Sobaya via Digitalmars-d-learn
I'd like to get symbols that have an UDA. But when the member is private, it is not obtained. And I found a comment saying "Filtering inaccessible members" in the source. Why is it necessary to filter out private members?

How to use math functions in dcompute?

2018-08-27 Thread Sobaya via Digitalmars-d-learn
I'm using dcompute(https://github.com/libmir/dcompute). In the development, I have got to use math functions such as sqrt in @compute function. But LDC says "can only call functions from other @compute modules in @compute code", so can't I call any math functions with dcompute? Is there an

Re: How to use math functions in dcompute?

2018-08-27 Thread Sobaya via Digitalmars-d-learn
On Monday, 27 August 2018 at 09:41:34 UTC, 9il wrote: On Monday, 27 August 2018 at 08:25:14 UTC, Sobaya wrote: I'm using dcompute(https://github.com/libmir/dcompute). In the development, I have got to use math functions such as sqrt in @compute function. But LDC says "can only call functions

Re: How to use math functions in dcompute?

2018-08-30 Thread Sobaya via Digitalmars-d-learn
On Monday, 27 August 2018 at 12:47:45 UTC, Nicholas Wilson wrote: On Monday, 27 August 2018 at 09:57:18 UTC, Sobaya wrote: On Monday, 27 August 2018 at 09:41:34 UTC, 9il wrote: On Monday, 27 August 2018 at 08:25:14 UTC, Sobaya wrote: I'm using dcompute(https://github.com/libmir/dcompute). In

Re: How to use math functions in dcompute?

2018-09-06 Thread Sobaya via Digitalmars-d-learn
On Friday, 31 August 2018 at 13:30:10 UTC, Nicholas Wilson wrote: On Thursday, 30 August 2018 at 10:34:33 UTC, Sobaya wrote: On Monday, 27 August 2018 at 12:47:45 UTC, Nicholas Wilson wrote: On Monday, 27 August 2018 at 09:57:18 UTC, Sobaya wrote: On Monday, 27 August 2018 at 09:41:34 UTC, 9il

Re: How to use math functions in dcompute?

2018-09-07 Thread Sobaya via Digitalmars-d-learn
On Friday, 7 September 2018 at 10:17:47 UTC, Nicholas Wilson wrote: On Friday, 7 September 2018 at 06:45:32 UTC, Sobaya wrote: [...] You're missing an "m" in "nvvm", dunno if that will fix it. [...] I'll be adding these to DCompute soon (probably Sunday), LLVM7.0 has just been released an

Re: How to use math functions in dcompute?

2018-09-17 Thread Sobaya via Digitalmars-d-learn
On Friday, 7 September 2018 at 10:53:25 UTC, Sobaya wrote: On Friday, 7 September 2018 at 10:17:47 UTC, Nicholas Wilson wrote: On Friday, 7 September 2018 at 06:45:32 UTC, Sobaya wrote: [...] You're missing an "m" in "nvvm", dunno if that will fix it. [...] I'll be adding these to DComput

Re: How to use math functions in dcompute?

2018-09-17 Thread Sobaya via Digitalmars-d-learn
On Tuesday, 18 September 2018 at 01:39:51 UTC, Nicholas Wilson wrote: On Tuesday, 18 September 2018 at 00:25:33 UTC, Sobaya wrote: I'm waiting for the update. How's your progress? I t appears I have broke SPIR-V completely somewhere along the line, I may release a v0.2 with out it, hopefully

Re: How to use math functions in dcompute?

2018-09-19 Thread Sobaya via Digitalmars-d-learn
On Wednesday, 19 September 2018 at 00:22:44 UTC, Nicholas Wilson wrote: On Wednesday, 19 September 2018 at 00:11:13 UTC, Nicholas Wilson wrote: On Tuesday, 18 September 2018 at 06:25:33 UTC, Sobaya wrote: On Tuesday, 18 September 2018 at 01:39:51 UTC, Nicholas Wilson wrote: On Tuesday, 18 Sept

Re: How to use math functions in dcompute?

2018-09-24 Thread Sobaya via Digitalmars-d-learn
On Thursday, 20 September 2018 at 12:48:14 UTC, Nicholas Wilson wrote: On Thursday, 20 September 2018 at 12:43:02 UTC, Nicholas Wilson wrote: Hmm, I can reproduce. Will look into it. pragma(LDC_intrinsic, "llvm.nvvm.cos.approx.f") float cos(float val); does work but is an approximation. It

How can I induce implicit type convesion with alias this on calling template function?

2018-10-14 Thread Sobaya via Digitalmars-d-learn
void func(T : int)(T value) if (is(T == int)) { } struct S { int x; alias x this; } void main() { func(S()); // error } In above code, 'func' can accept only int as its argument type, so when 'S', which can be implicitly convertible into int, is passed on 'func', I expect S.x is p

Re: How can I induce implicit type convesion with alias this on calling template function?

2018-10-15 Thread Sobaya via Digitalmars-d-learn
On Monday, 15 October 2018 at 06:16:34 UTC, Alex wrote: On Monday, 15 October 2018 at 04:51:39 UTC, Sobaya wrote: [...] Removing constraint, but retaining specialization should be enough, no? Then, func is still a template, requiring the argument to be convertible to an int. When S is passed

Is there any way for non-blocking IO with phobos?

2018-11-13 Thread Sobaya via Digitalmars-d-learn
I want to connect to a server and communicate with ssh. So I tried to spawn the process of ssh using pipeProcess function, and read/write with its pipe's stdin and stdout. But I don't know how many lines are sent from the server for an input, so readln function blocks. I think this can be s

How can I express the type of a function in D?

2019-01-29 Thread Sobaya via Digitalmars-d-learn
I want to get a mangled name of a D function by `core.demangle.mangle`, but I'm in trouble because there are no ways to express a type of a function, which is used for a template argument of `mangle`. For example, it is wrong to use the type `int function(int,int)` to express the type of `int

Re: How can I express the type of a function in D?

2019-01-29 Thread Sobaya via Digitalmars-d-learn
On Wednesday, 30 January 2019 at 06:02:02 UTC, FrankLike wrote: On Wednesday, 30 January 2019 at 05:40:50 UTC, FrankLike wrote: On Wednesday, 30 January 2019 at 05:14:20 UTC, Sobaya wrote: [...] import std.stdio; import std.process:executeShell; import core.demangle; void main() {

Shared library loading and static constructor

2019-03-22 Thread Sobaya via Digitalmars-d-learn
I fail to load the shared library created in a specific situation, but I do not know the cause. a.d import b.d b.d static this() {} for above 2 files, I created shared library by following command. dmd a.d -shared -of=a.so And I ran below code, but the library is not load

Re: Shared library loading and static constructor

2019-03-22 Thread Sobaya via Digitalmars-d-learn
On Friday, 22 March 2019 at 11:00:32 UTC, Andre Pany wrote: On Friday, 22 March 2019 at 10:51:58 UTC, Sobaya wrote: [...] As far as I know different to windows, linus will not search current working directory for a.so. if this is the issue here, you have different possibilities. You could de

Re: Shared library loading and static constructor

2019-03-23 Thread Sobaya via Digitalmars-d-learn
On Saturday, 23 March 2019 at 09:37:16 UTC, Andre Pany wrote: On Friday, 22 March 2019 at 17:52:34 UTC, Sobaya wrote: On Friday, 22 March 2019 at 11:00:32 UTC, Andre Pany wrote: On Friday, 22 March 2019 at 10:51:58 UTC, Sobaya wrote: [...] As far as I know different to windows, linus will no

Re: Shared library loading and static constructor

2019-03-23 Thread Sobaya via Digitalmars-d-learn
On Saturday, 23 March 2019 at 16:56:28 UTC, tchaloupka wrote: On Saturday, 23 March 2019 at 15:58:07 UTC, Sobaya wrote: What I am saying is that it can not be read when a code importing (a.d) a code including the static constructor (b.d) is compiled into shared library. Hi. I've tried to add

What is 'scope' in function parameter?

2017-12-25 Thread Sobaya via Digitalmars-d-learn
What means 'scope' in function parameter? I made a test code. ``` import std.stdio; int[] x; void func(scope int[] a) { x = a; } void main() { func([0,1,2]); writeln(x); } ``` This code was successfully compiled and printed '[0, 1, 2]'. But according to https://dlang.org/spec/fu

Re: What is 'scope' in function parameter?

2017-12-26 Thread Sobaya via Digitalmars-d-learn
On Tuesday, 26 December 2017 at 00:17:33 UTC, Mike Franklin wrote: After a few hours trying to figure out why the compiler didn't catch this, I finally figured it out. You have to add `@safe`. import std.stdio; int[] x; void func(scope int[] a) @safe { x = a; } void main() @safe { f

How to manage function's parameter storage class?

2018-01-20 Thread Sobaya via Digitalmars-d-learn
I'm using opDispatch for wrapping a function like below. ``` import std.stdio; void func(ref int x, int y) { x++; } struct B { // wraps 'func'. I want to implement this function. template opDispatch(string fn) { void opDispatch(Args...)(Args args) { mixin(fn~"(ar

Re: How to manage function's parameter storage class?

2018-01-20 Thread Sobaya via Digitalmars-d-learn
On Saturday, 20 January 2018 at 17:05:40 UTC, Simen Kjærås wrote: On Saturday, 20 January 2018 at 14:31:59 UTC, Sobaya wrote: How can I wrap function whose arguments contain both ref and normal like 'func' ? With normal 'Args', x is not increased because x is copied when passed to opDispatch. I

the behavior of opAssign

2018-01-29 Thread Sobaya via Digitalmars-d-learn
I found a strange behavior. class A { void opAssign(int v) {} } class Test { A a; this() { a = new A(); // removing this causes compile error. a = 3; // cannot implicitly convert expression `3` of `int` to `A` } } void main() { // this is allowed. A a;

Re: the behavior of opAssign

2018-01-29 Thread Sobaya via Digitalmars-d-learn
On Monday, 29 January 2018 at 10:06:23 UTC, Simen Kjærås wrote: On Monday, 29 January 2018 at 09:23:55 UTC, Sobaya wrote: I found a strange behavior. class A { void opAssign(int v) {} } class Test { A a; this() { a = new A(); // removing this causes compile error. a

cast problem about alias this

2018-01-29 Thread Sobaya via Digitalmars-d-learn
class Parent { int x; alias x this; } class Child : Parent { } void main() { Parent p = new Child; Child c = cast(Child)p; // cannot cast `int` to `Child` } In this code, I got a compile error. How can I cast p to Child?

Re: cast problem about alias this

2018-01-29 Thread Sobaya via Digitalmars-d-learn
On Monday, 29 January 2018 at 19:59:31 UTC, Steven Schveighoffer wrote: On 1/29/18 2:40 PM, Sobaya wrote: class Parent {     int x;     alias x this; } class Child : Parent { } void main() {     Parent p = new Child;     Child c = cast(Child)p; // cannot cast `int` to `Child` } In this co