Re: Calling function within class.

2020-11-20 Thread Arafel via Digitalmars-d-learn
On 19/11/20 20:51, Vino wrote: Hi Ali, Thank you very much, your solution works for my example, but it does not work for the main goal, let me explain what we are trying to perform. Nut shell: Try to execute an aws command on sever accounts in parallel to get some data. Noe: each account h

Re: Calling function within class.

2020-11-19 Thread frame via Digitalmars-d-learn
On Thursday, 19 November 2020 at 19:51:24 UTC, Vino wrote: the moment we enable parallelism, it is throwing an error on the SQL part (Fetch the username/ password from the table for each account), as it could not execute the SQL query in parallel for different account. I see no reason for a S

Re: Calling function within class.

2020-11-19 Thread Vino via Digitalmars-d-learn
On Wednesday, 18 November 2020 at 21:33:58 UTC, Ali Çehreli wrote: On 11/18/20 7:01 AM, Vino wrote: >Request your help on how to call a function(listFile) from another > function(getFilelist) within the same class(GetDirlist), below is an > example code. That code looks unnecessarily comple

Re: Calling function within class.

2020-11-19 Thread frame via Digitalmars-d-learn
On Wednesday, 18 November 2020 at 19:25:06 UTC, Vino wrote: The above code is a sample code, but the logic is same, correct me if my understanding is wrong, in the above code "obj" is a an object for the class GetDirlist, so we are accessing the class member using "obj.listFile(st)" , so why

Re: Calling function within class.

2020-11-18 Thread Ali Çehreli via Digitalmars-d-learn
On 11/18/20 7:01 AM, Vino wrote: >Request your help on how to call a function(listFile) from another > function(getFilelist) within the same class(GetDirlist), below is an > example code. That code looks unnecessarily complex to me. First of all, parallel() already executes the loop body in

Re: Calling function within class.

2020-11-18 Thread Ali Çehreli via Digitalmars-d-learn
On 11/18/20 11:25 AM, Vino wrote: > why is this > so complicated in D where as in PHP it is simple like below > > PHP Code: > class PHPclass { >function test1 ($st) { return $st; } >function test2 () { return $this->test1("Test"); } > } > > $obj = new PHPclass(); > print_r($obj->

Re: Calling function within class.

2020-11-18 Thread Vino via Digitalmars-d-learn
On Wednesday, 18 November 2020 at 18:24:59 UTC, frame wrote: On Wednesday, 18 November 2020 at 17:55:36 UTC, Vino wrote: I made the changes as below , still not working auto fltask = task!listFile(st); to auto fltask = task!({listFile(st);})(this).executeInNewThread(); The syntax is just

Re: Calling function within class.

2020-11-18 Thread frame via Digitalmars-d-learn
On Wednesday, 18 November 2020 at 17:55:36 UTC, Vino wrote: I made the changes as below , still not working auto fltask = task!listFile(st); to auto fltask = task!({listFile(st);})(this).executeInNewThread(); The syntax is just wrong: auto fltask = task!({listFile(st);})(this).executeInNe

Re: Calling function within class.

2020-11-18 Thread Vino via Digitalmars-d-learn
On Wednesday, 18 November 2020 at 16:53:44 UTC, frame wrote: On Wednesday, 18 November 2020 at 15:01:53 UTC, Vino wrote: Hi All, Request your help on how to call a function(listFile) from another function(getFilelist) within the same class(GetDirlist), below is an example code. I think it

Re: Calling function within class.

2020-11-18 Thread frame via Digitalmars-d-learn
On Wednesday, 18 November 2020 at 15:01:53 UTC, Vino wrote: Hi All, Request your help on how to call a function(listFile) from another function(getFilelist) within the same class(GetDirlist), below is an example code. I think it's basically the same issue like that recently opened topic:

Calling function within class.

2020-11-18 Thread Vino via Digitalmars-d-learn
Hi All, Request your help on how to call a function(listFile) from another function(getFilelist) within the same class(GetDirlist), below is an example code. Code: class GetDirlist { @system private auto listFile(immutable string st) { auto fl = execute(["ls","-l"]); enforce(fl.status =