Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-27 Thread zjh via Digitalmars-d-learn

On Friday, 28 May 2021 at 00:07:41 UTC, zjh wrote:

On Friday,


maybe you can try nana.


Re: where do I find the complete phobos function list names ?

2021-05-27 Thread someone via Digitalmars-d-learn

On Thursday, 27 May 2021 at 21:21:46 UTC, Christian Köstlin wrote:

e.g. I found this file https://dlang.org/library/symbols.js 
which is used e.g. by 
https://dlang.org/library/std/algorithm/sorting/sort.html to 
implement the search. Perhaps that helps.


Thanks Christian !

I downloaded the symbols.js file you pointed at, loaded it in 
VIM, and after 10-or-so minutes (of manual labor) I ended up with 
symbols.xml sorted alphabetically by symbol name and this is 
pretty much what I was looking for. It is not the right way to do 
it, I know, but from now on periodically checking the changes in 
the spec release notes I can maintain it by myself -I don't 
expect a lot of changes here anyway.


Once in XML form I can output VIM-compatible-syntax directly by 
way of XSLT and I can do pretty much anything I want with it :)


PS: Is there a way to upload a file here in the forum ? Maybe 
someone could make use of it.


Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-27 Thread zjh via Digitalmars-d-learn

On Friday, 28 May 2021 at 00:05:36 UTC, zjh wrote:

If there is a binding of wxWidgets.
then is good.




Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-27 Thread zjh via Digitalmars-d-learn

On Thursday, 27 May 2021 at 17:04:07 UTC, Alain De Vos wrote:

Let's


+10




Re: How long does the context of a delegate exist?

2021-05-27 Thread Steven Schveighoffer via Digitalmars-d-learn

On 5/27/21 4:46 PM, IGotD- wrote:

On Thursday, 27 May 2021 at 18:13:17 UTC, Adam D. Ruppe wrote:


If the delegate is created by the GC and stored it will still be 
managed by the GC, along with its captured vars.


As long as the GC can see the delegate in your example you should be 
OK. But if it is held on to by a C or OS lib, the GC might not see it 
and you'd have to addRoot or something to ensure it stays in.


With lambdas in C++ you can cherrypick captures the way you want, then 
somehow this can be converted to an std::function and this is where it 
goes on the heap as well.


In D, how does the compiler know what captures it is supposed to store, 
or does it take the whole lot?


For closures, it uses semantic analysis to see which variables are used 
in the lambda, and then allocates a block at the start of the function 
to hold those variables.


-Steve


Re: where do I find the complete phobos function list names ?

2021-05-27 Thread Christian Köstlin via Digitalmars-d-learn

On 2021-05-26 01:46, Paul Backus wrote:

On Tuesday, 25 May 2021 at 22:05:16 UTC, someone wrote:
I was unsuccessfully searching the site for them in the form of a 
master index to begin with.


I need them, in plain text, in order to add them to a VIM custom 
syntax highlight plugin I already made which I am already using but is 
lacking phobos support.


Can anyone point me to the right place please ?


There is no global index in the online documentation; the best you can 
get is an index of each module.


If you really want this, your best bet is probably to run a source-code 
indexer like `ctags` on the Phobos source tree, and do some scripting to 
transform the results into something usable in your Vim plugin.
e.g. I found this file https://dlang.org/library/symbols.js which is 
used e.g. by https://dlang.org/library/std/algorithm/sorting/sort.html 
to implement the search. Perhaps that helps.


Kind regards,
Christian



Re: How to work around the infamous dual-context when using delegates together with std.parallelism

2021-05-27 Thread Christian Köstlin via Digitalmars-d-learn

On 2021-05-27 18:56, Ali Çehreli wrote:

On 5/27/21 9:19 AM, Ali Çehreli wrote:


   auto result = new string[users.length];
   users.enumerate.parallel.each!(en => result[en.index] = 
servers.doSomething(en.value));

   writeln(result);


I still like the foreach version more:

     auto result = new string[users.length];
     foreach (i, user; users.parallel) {
   result[i] = servers.doSomething(user);
     }
     writeln(result);

Ali


Hi Ali,

both of those variants do work for me, thanks a lot!
Still not sure which I prefer (almost too many options now :) ).

I am so happy that I asked in this forum, help is much appreciated!

Christian


Re: ChromeOS and DLang

2021-05-27 Thread Alain De Vos via Digitalmars-d-learn

If you have a compiler you can go.


Re: How long does the context of a delegate exist?

2021-05-27 Thread IGotD- via Digitalmars-d-learn

On Thursday, 27 May 2021 at 18:13:17 UTC, Adam D. Ruppe wrote:


If the delegate is created by the GC and stored it will still 
be managed by the GC, along with its captured vars.


As long as the GC can see the delegate in your example you 
should be OK. But if it is held on to by a C or OS lib, the GC 
might not see it and you'd have to addRoot or something to 
ensure it stays in.


With lambdas in C++ you can cherrypick captures the way you want, 
then somehow this can be converted to an std::function and this 
is where it goes on the heap as well.


In D, how does the compiler know what captures it is supposed to 
store, or does it take the whole lot?


Re: How long does the context of a delegate exist?

2021-05-27 Thread Adam D. Ruppe via Digitalmars-d-learn

On Thursday, 27 May 2021 at 20:44:21 UTC, frame wrote:

Did you mean to add the delegate as GC root or the data?


The delegate.ptr property.



Re: How long does the context of a delegate exist?

2021-05-27 Thread frame via Digitalmars-d-learn

On Thursday, 27 May 2021 at 18:13:17 UTC, Adam D. Ruppe wrote:

On Thursday, 27 May 2021 at 12:59:02 UTC, frame wrote:

But what about the data used in the context of the delegate?


If the delegate is created by the GC and stored it will still 
be managed by the GC, along with its captured vars.


As long as the GC can see the delegate in your example you 
should be OK. But if it is held on to by a C or OS lib, the GC 
might not see it and you'd have to addRoot or something to 
ensure it stays in.


Did you mean to add the delegate as GC root or the data? It would 
be nicer to just add the delegate but addRoot does not accept it 
and casting to void* is deprecated. Does it work if I supply the 
.ptr property instead? This "GC silently no-op on wrong data" is 
annoying.


Re: where do I find the complete phobos function list names ?

2021-05-27 Thread Christian Köstlin via Digitalmars-d-learn

On 2021-05-26 01:46, Paul Backus wrote:

On Tuesday, 25 May 2021 at 22:05:16 UTC, someone wrote:
I was unsuccessfully searching the site for them in the form of a 
master index to begin with.


I need them, in plain text, in order to add them to a VIM custom 
syntax highlight plugin I already made which I am already using but is 
lacking phobos support.


Can anyone point me to the right place please ?


There is no global index in the online documentation; the best you can 
get is an index of each module.


If you really want this, your best bet is probably to run a source-code 
indexer like `ctags` on the Phobos source tree, and do some scripting to 
transform the results into something usable in your Vim plugin.
Where is the index for the search functionality on dlang.org located? 
Could that be used?


Kind regards,
Christian


Re: How long does the context of a delegate exist?

2021-05-27 Thread frame via Digitalmars-d-learn

On Thursday, 27 May 2021 at 16:17:12 UTC, Alain De Vos wrote:
I think of a dynamic array as a value-type consisting of a 
pointer to the actual data and a length, which gets copied.

The data pointing to will continue to live.
The pointer and length might disappear from the stack or get 
copied.

I think there is no problem.


Seems logical, I just do not know exactly what a delegate 
internally does with captured variables from the function body. 
But you are right it must be something like that.


ChromeOS and DLang

2021-05-27 Thread Ozan Sueel via Digitalmars-d-learn

Hi
I think about writing apps vor ChromeOS, but before running in a 
death end, I ask by myself, is D a good choice for this approach?


Any experience with this new upcoming operating system?

Regards Ozan



Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-27 Thread Alain De Vos via Digitalmars-d-learn

I think dlangui is a dead monkey.




Re: How long does the context of a delegate exist?

2021-05-27 Thread Adam D. Ruppe via Digitalmars-d-learn

On Thursday, 27 May 2021 at 12:59:02 UTC, frame wrote:

But what about the data used in the context of the delegate?


If the delegate is created by the GC and stored it will still be 
managed by the GC, along with its captured vars.


As long as the GC can see the delegate in your example you should 
be OK. But if it is held on to by a C or OS lib, the GC might not 
see it and you'd have to addRoot or something to ensure it stays 
in.


Re: Passing lots of C flas to the D compilers and DUB

2021-05-27 Thread Alain De Vos via Digitalmars-d-learn

I pass many flags using dub.
Relevant line in my dub.json,
```
"name": "gparted",
	"dflags-ldc": 
["--gcc=cc","--vcolumns","--oq","--dip1000","--dip25","--safe-stack-layout","--boundscheck=on","--D","--g","--w","--de","--d-debug"]

```

Or just direct command,
```
ldc2 --gcc=cc --vcolumns --oq --dip1000 --dip25 
--safe-stack-layout --boundscheck=on --D --g --w --de --d-debug 
`find . -name \*.d -print`

```


Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-27 Thread Alain De Vos via Digitalmars-d-learn
Let's also not forget other languages have problems with 
gui-toolkits.
For instance, gtk-ada binding has memory leaks. gtk-crystal 
binding is broken.
I would like to see a binding to wxwidgets which is a very cool 
toolkit.


Re: How to work around the infamous dual-context when using delegates together with std.parallelism

2021-05-27 Thread Ali Çehreli via Digitalmars-d-learn

On 5/27/21 9:19 AM, Ali Çehreli wrote:


   auto result = new string[users.length];
   users.enumerate.parallel.each!(en => result[en.index] = 
servers.doSomething(en.value));

   writeln(result);


I still like the foreach version more:

auto result = new string[users.length];
foreach (i, user; users.parallel) {
  result[i] = servers.doSomething(user);
}
writeln(result);

Ali



Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-27 Thread Dejan Lekic via Digitalmars-d-learn

On Thursday, 27 May 2021 at 01:17:44 UTC, someone wrote:

Yes, I know this is a question lacking a straightforward answer.

Requirements:

[...]


I humbly believe the most complete one is GtKD.

https://gtkdcoding.com/
https://gtkd.org

We all wish there was a STANDARD D GUI library out there, but 
that is a huge effort one or two individuals can't do by 
themselves (that is why all such efforts failed in the past)...


Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-27 Thread Alain De Vos via Digitalmars-d-learn

I very succefully used tkd and gtkd, d binding to tk and gtk.

Can someone guide me to using fox or fltk ?


Re: How to work around the infamous dual-context when using delegates together with std.parallelism

2021-05-27 Thread Ali Çehreli via Digitalmars-d-learn

On 5/27/21 2:58 AM, Christian Köstlin wrote:

>  writeln(taskPool.amap!(user => servers.doSomething(user))(users));

Luckily, parallel() is a free-standing function that does not require a 
"this context". Is the following a workaround for you?


  auto result = new string[users.length];
  users.enumerate.parallel.each!(en => result[en.index] = 
servers.doSomething(en.value));

  writeln(result);

Ali




Re: How long does the context of a delegate exist?

2021-05-27 Thread Alain De Vos via Digitalmars-d-learn
I think of a dynamic array as a value-type consisting of a 
pointer to the actual data and a length, which gets copied.

The data pointing to will continue to live.
The pointer and length might disappear from the stack or get 
copied.

I think there is no problem.


Re: Compiler Explorer Assembly Output for C, C++ and D (dlang)

2021-05-27 Thread Alain De Vos via Digitalmars-d-learn

Sidequestion.
For what purpose is the registration of dso used ?


Re: Compiler Explorer Assembly Output for C, C++ and D (dlang)

2021-05-27 Thread Gavin Ray via Digitalmars-d-learn

On Thursday, 27 May 2021 at 10:48:43 UTC, Basile B. wrote:

https://forum.dlang.org/post/myrjutqyzpzlyltrd...@forum.dlang.org


Thank you for sharing this!

The difference between setting `pragma(LDC_no_moduleinfo);` at 
the top, and `-Os -gline-tables-only` in compiler flags is 
drastic.


- Standard
  - https://d.godbolt.org/z/env355M71
- No module info + flags
  - https://d.godbolt.org/z/4KxxvonY5


You wind up with
```c
int example.square(int):
mov eax, edi
imuleax, edi
ret
```

```
define i32 @_D7example6squareFiZi(i32 %num_arg) 
local_unnamed_addr #0 !dbg !5 {

  %1 = mul i32 %num_arg, %num_arg, !dbg !7
  ret i32 %1, !dbg !7
}

attributes #0 = { norecurse nounwind readnone uwtable 
"frame-pointer"="none" "target-cpu"="x86-64" 
"target-features"="+cx16" }

```


Re: How to work around the infamous dual-context when using delegates together with std.parallelism

2021-05-27 Thread Steven Schveighoffer via Digitalmars-d-learn

On 5/27/21 10:13 AM, Christian Köstlin wrote:
P.S.: I still do not get how to post formatted snippets with thunderbird 
to the newsgroup/forum :/


It's not possible currently.

I keep posting all my thunderbird posts *as if* the forum will highlight 
them in the hopes that some day it will retroactively work.


But I don't know... I can reformat the posts in my head, so it's not so bad.

-steve


Re: How to work around the infamous dual-context when using delegates together with std.parallelism

2021-05-27 Thread Christian Köstlin via Digitalmars-d-learn

On 2021-05-27 15:00, sighoya wrote:

On Thursday, 27 May 2021 at 12:58:28 UTC, Christian Köstlin wrote:

That looks nice, but unfortunately my data for servers and users in 
the real world is not static but comes from a config file.


Okay, but then parametrizing the static lambda with runtime parameters 
should work. The important fact is that the closure needs to be static.

Ah thanks, now I understand.
So what I came up with now is a combination of the things mentioned:

```D
import std;

string doSomething(string[] servers, string user) {
return user ~ servers[0];
}
struct UserWithServers {
string user;
string[] servers;
}
void main(string[] args) {
auto servers = args;
auto users = ["u1", "u2", "u3"];
auto usersWithServers = users.map!(user => UserWithServers(user, 
servers)).array;


static fn = function(UserWithServers user) => 
user.servers.doSomething(user.user);

writeln(taskPool.amap!(fn)(usersWithServers));
}
```

Making also the example a little bit more "realistic" by using dynamic 
data for servers.


I would like to use auto fn, but somehow saying that its a function is 
not enough for dmd. From my understanding a function would never need a 
context?!?


Thanks a lot!
Christian

P.S.: I still do not get how to post formatted snippets with thunderbird 
to the newsgroup/forum :/


Re: How to work around the infamous dual-context when using delegates together with std.parallelism

2021-05-27 Thread sighoya via Digitalmars-d-learn

On Thursday, 27 May 2021 at 12:58:28 UTC, Christian Köstlin wrote:

That looks nice, but unfortunately my data for servers and 
users in the real world is not static but comes from a config 
file.


Okay, but then parametrizing the static lambda with runtime 
parameters should work. The important fact is that the closure 
needs to be static.


How long does the context of a delegate exist?

2021-05-27 Thread frame via Digitalmars-d-learn
I'm using a buffer delegate to fill data from a DLL and use it as 
range like this:


Pseudo-Code:
```d
void DLLFun(out Collector collector) {
  auto something;

  collector = Collector(...);
  collector.registerFillBufferMethod({
 auto data = [];
 //...
 // use of something;
 return data;
  )};
}
```

This collector takes care of the data so the GC cannot collect it 
while not explicitly closed on the caller side.


But what about the data used in the context of the delegate? Does 
this data stay as long DllFun is not called again because the DLL 
stack is paused? Or is this data also volatile and may be 
collected by the GC anytime?


Re: How to work around the infamous dual-context when using delegates together with std.parallelism

2021-05-27 Thread Christian Köstlin via Digitalmars-d-learn

On 2021-05-27 14:48, sighoya wrote:

On Thursday, 27 May 2021 at 12:17:36 UTC, Christian Köstlin wrote:
Can you explain me, where here a double context is needed? Because all 
data now should be passed as arguments to amap?


Kind regards,
Christian


I  believe D's type system isn't smart enough to see independence 
between context and closure, otherwise your original example would also 
work as users and servers are context independent.


What about:

```D
string doSomething(string[] servers, string user) {
     return user ~ servers[0];
}
void main() {
     static servers = ["s1", "s2", "s3"];
     static users = ["u1", "u2", "u3"];
     static lambda = (string user) => servers.doSomething(user);
     writeln(map!(user => servers.doSomething(user))(users));
     writeln(taskPool.amap!(lambda)(users));
}
```

That looks nice, but unfortunately my data for servers and users in the 
real world is not static but comes from a config file.


Re: How to work around the infamous dual-context when using delegates together with std.parallelism

2021-05-27 Thread sighoya via Digitalmars-d-learn

On Thursday, 27 May 2021 at 12:17:36 UTC, Christian Köstlin wrote:
Can you explain me, where here a double context is needed? 
Because all data now should be passed as arguments to amap?


Kind regards,
Christian


I  believe D's type system isn't smart enough to see independence 
between context and closure, otherwise your original example 
would also work as users and servers are context independent.


What about:

```D
string doSomething(string[] servers, string user) {
return user ~ servers[0];
}
void main() {
static servers = ["s1", "s2", "s3"];
static users = ["u1", "u2", "u3"];
static lambda = (string user) => servers.doSomething(user);
writeln(map!(user => servers.doSomething(user))(users));
writeln(taskPool.amap!(lambda)(users));
}
```



Re: How to work around the infamous dual-context when using delegates together with std.parallelism

2021-05-27 Thread Christian Köstlin via Digitalmars-d-learn

On 2021-05-27 13:11, sighoya wrote:

On Thursday, 27 May 2021 at 09:58:40 UTC, Christian Köstlin wrote:

I have this small program here

test.d:
```
import std;
string doSomething(string[] servers, string user) {
    return user ~ servers[0];
}
void main() {
    auto servers = ["s1", "s2", "s3"];
    auto users = ["u1", "u2", "u3"];
    writeln(map!(user => servers.doSomething(user))(users));
    writeln(taskPool.amap!(user => servers.doSomething(user))(users));
}
```




I think it relates to https://issues.dlang.org/show_bug.cgi?id=5710

The reason is that amap requires a this pointer of type TaskPool and a 
context pointer to the closure which belongs to main, at least because 
it requires servers. Having both isn't possible due to problems in non 
DMD compilers.


If you rewrite it more statically:
```D
string doSomething(string[] servers, string user) {
     return user ~ servers[0];
}

string closure(string user)
{
     return servers.doSomething(user);
}
auto servers = ["s1", "s2", "s3"];
int main()
{
     auto users = ["u1", "u2", "u3"];
     writeln(map!(user => servers.doSomething(user))(users));
     writeln(taskPool.amap!(closure)(users));
     return 0;
}
```

PS: Just enable markdown if you want to highlight D code
On a second not I needed to make server __gshared in my real program, as 
otherwise its a thread local variable (in the small demo program, this 
did not occur, I guess because the parallel operations we're too fast).


Kind regards,
Christian


Re: How to work around the infamous dual-context when using delegates together with std.parallelism

2021-05-27 Thread Christian Köstlin via Digitalmars-d-learn
Thanks for the proposed solution. It also works in my slightly bigger 
program (although I do not like to make servers more global).


I tried also the following (which unfortunately also does not work as 
intended):


```D
import std;
string doSomething(string[] servers, string user) {
return user ~ servers[0];
}

int main()
{
auto users = ["u1", "u2", "u3"];
auto servers = ["s1", "s2", "s3"];
auto usersWithServers = users.map!(user => tuple!("user", 
"servers")(user, servers)).array;
writeln(map!(userWithServers => 
userWithServers.servers.doSomething(userWithServers.user))(usersWithServers));
writeln(taskPool.amap!(userWithServers => 
userWithServers.servers.doSomething(userWithServers.user))(usersWithServers));

return 0;
}
```

Here I try to put the data I need together into one tuple ("manually") 
and then pass it all to amap. Can you explain me, where here a double 
context is needed? Because all data now should be passed as arguments to 
amap?


Kind regards,
Christian


Re: How to work around the infamous dual-context when using delegates together with std.parallelism

2021-05-27 Thread sighoya via Digitalmars-d-learn

On Thursday, 27 May 2021 at 09:58:40 UTC, Christian Köstlin wrote:

I have this small program here

test.d:
```
import std;
string doSomething(string[] servers, string user) {
return user ~ servers[0];
}
void main() {
auto servers = ["s1", "s2", "s3"];
auto users = ["u1", "u2", "u3"];
writeln(map!(user => servers.doSomething(user))(users));
writeln(taskPool.amap!(user => 
servers.doSomething(user))(users));

}
```




I think it relates to 
https://issues.dlang.org/show_bug.cgi?id=5710


The reason is that amap requires a this pointer of type TaskPool 
and a context pointer to the closure which belongs to main, at 
least because it requires servers. Having both isn't possible due 
to problems in non DMD compilers.


If you rewrite it more statically:
```D
string doSomething(string[] servers, string user) {
return user ~ servers[0];
}

string closure(string user)
{
return servers.doSomething(user);
}
auto servers = ["s1", "s2", "s3"];
int main()
{
auto users = ["u1", "u2", "u3"];
writeln(map!(user => servers.doSomething(user))(users));
writeln(taskPool.amap!(closure)(users));
return 0;
}
```

PS: Just enable markdown if you want to highlight D code


Re: Compiler Explorer Assembly Output for C, C++ and D (dlang)

2021-05-27 Thread Basile B. via Digitalmars-d-learn

On Thursday, 27 May 2021 at 08:47:50 UTC, Tariq Siddiqui wrote:
When using Compiler Explorer (https://godbolt.org/) to compare 
assembly output of simple programs, why D language assembly 
output is so long compared to C or C++ output. The simple 
square function output is the same for C, C++, and D, but the D 
output has additional lines that are not highlighted when 
hovering over the square function in the source code.


 - What are these additional lines?
 - How can I remove these lines from being generated?


In addition to other answers, see 
https://forum.dlang.org/post/myrjutqyzpzlyltrd...@forum.dlang.org


Re: Compiler Explorer Assembly Output for C, C++ and D (dlang)

2021-05-27 Thread Dennis via Digitalmars-d-learn

On Thursday, 27 May 2021 at 10:27:42 UTC, Tariq Siddiqui wrote:
Thanks for your answer, -betterC works well with simple code 
but when using templates in code -betterC compilation failed.


Templates are supported in -betterC, what's not supported can be 
found here:

https://dlang.org/spec/betterc.html#consequences

You're probably using or importing something that depends on 
Druntime.

For LDC, you can try adding this instead of using `-betterC`:

```
pragma(LDC_no_moduleinfo);
```

Though once you use non-betterC functions, your assembly will 
easily get messy compared to C's assembly.


Re: Compiler Explorer Assembly Output for C, C++ and D (dlang)

2021-05-27 Thread Tariq Siddiqui via Digitalmars-d-learn

On Thursday, 27 May 2021 at 09:11:35 UTC, Dennis wrote:

On Thursday, 27 May 2021 at 08:47:50 UTC, Tariq Siddiqui wrote:

 - What are these additional lines?


D generates extra symbols per module for things like module 
constructors, unittests and class introspection (I think).



 - How can I remove these lines from being generated?


Pass the `-betterC` flag to dmd/ldc2.


Thanks for your answer, -betterC works well with simple code but 
when using templates in code -betterC compilation failed.


How to work around the infamous dual-context when using delegates together with std.parallelism

2021-05-27 Thread Christian Köstlin via Digitalmars-d-learn

I have this small program here

test.d:
```
import std;
string doSomething(string[] servers, string user) {
return user ~ servers[0];
}
void main() {
auto servers = ["s1", "s2", "s3"];
auto users = ["u1", "u2", "u3"];
writeln(map!(user => servers.doSomething(user))(users));
writeln(taskPool.amap!(user => servers.doSomething(user))(users));
}
```

The first map just works as expected, for the parallel amap though fromo 
(https://dlang.org/phobos/std_parallelism.html) I get the following 
warning with dmd:


```
/Users/.../dlang/dmd-2.096.1/osx/bin/../../src/phobos/std/parallelism.d(1711): 
Deprecation: function `test.main.amap!(string[]).amap` function requires 
a dual-context, which is deprecated

```

for ldc the build fails with:
```
/Users/.../dlang/ldc-1.26.0/bin/../import/std/parallelism.d(1711): 
Deprecation: function `test.main.amap!(string[]).amap` function requires 
a dual-context, which is deprecated

test.d(9):instantiated from here: `amap!(string[])`
/Users/.../dlang/ldc-1.26.0/bin/../import/std/parallelism.d(1711): 
Error: function `test.main.amap!(string[]).amap` requires a 
dual-context, which is not yet supported by LDC

```


Thanks in advance for you insights,
Christian


Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-27 Thread Виталий Фадеев via Digitalmars-d-learn

On Thursday, 27 May 2021 at 01:17:44 UTC, someone wrote:

Yes, I know this is a question lacking a straightforward answer.

Requirements:

[...]


sciter, of course.  https://sciter.com/
Or write Dlang alternative.


Re: Compiler Explorer Assembly Output for C, C++ and D (dlang)

2021-05-27 Thread Dennis via Digitalmars-d-learn

On Thursday, 27 May 2021 at 08:47:50 UTC, Tariq Siddiqui wrote:

 - What are these additional lines?


D generates extra symbols per module for things like module 
constructors, unittests and class introspection (I think).



 - How can I remove these lines from being generated?


Pass the `-betterC` flag to dmd/ldc2.


Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-27 Thread btiffin via Digitalmars-d-learn

On Thursday, 27 May 2021 at 01:17:44 UTC, someone wrote:

Yes, I know this is a question lacking a straightforward answer.

I'm only on a third serious with D day, but I want to take a kick 
at wrapping libAgar now.


libagar is a nice little framework.  But, it's C still (and Ada, 
Perl, COBOL), not D yet.  Will see how it goes.


Very cross platform, the Uniike (unixlike, sans tm) systems, 
nintendo, c64, but that's microagar.  Developed on a BSD system.


http://libagar.org/


Compiler Explorer Assembly Output for C, C++ and D (dlang)

2021-05-27 Thread Tariq Siddiqui via Digitalmars-d-learn
When using Compiler Explorer (https://godbolt.org/) to compare 
assembly output of simple programs, why D language assembly 
output is so long compared to C or C++ output. The simple square 
function output is the same for C, C++, and D, but the D output 
has additional lines that are not highlighted when hovering over 
the square function in the source code.


 - What are these additional lines?
 - How can I remove these lines from being generated?


multiple windows dlls results in "entry point could not be located" depending on order

2021-05-27 Thread cartland via Digitalmars-d-learn
I have built 2 windows C dlls (ctst and ctst2) that I am calling 
from a Dlang exe (dtstx). dumpbin shows the exports.


dpp was used to generate the d file from #includes.

All this works perfectly on Linux and MacOS.

(Are the generated d files portable? They seem to be. I have also 
generated them on Windows just in case.)


dtstx calls ctst_init() and ctst2_init().

```
import c_libs;

int mymain(string[] args) {
string str = "dlang";
return ctst_init(str.toStringz) + ctst2_init(str.toStringz);
}
```

If I call just **one** of the fns ctst_init and ctst2_init, it 
works.


However, calling **both** gives either of these errors:

In dub.sdl

```
libs "lib/ctst" "lib/ctst2" platform="windows"
```
causes dtstx to generate
```
---
dtstx.exe - Entry Point Not Found
---
The procedure entry point ctst2_init could not be located in the 
dynamic link library \dtstx\bin\dtstx.exe.

---
```

In dub.sdl, reversing the order of the libs:

```
libs "lib/ctst2" "lib/ctst" platform="windows"
```
causes dtstx to generate
```
---
dtstx.exe - Entry Point Not Found
---
The procedure entry point ctst_init could not be located in the 
dynamic link library \dtstx\bin\dtstx.exe.

---
```



Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-27 Thread zjh via Digitalmars-d-learn

On Thursday, 27 May 2021 at 01:17:44 UTC, someone wrote:

Yes,


I have download FOX.and success compile.
I think it is very good.small and beauty.


Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-27 Thread Imperatorn via Digitalmars-d-learn

On Thursday, 27 May 2021 at 04:01:31 UTC, someone wrote:

On Thursday, 27 May 2021 at 02:55:14 UTC, Adam D. Ruppe wrote:

[...]


Crystal clear.

On Thursday, 27 May 2021 at 02:55:14 UTC, Adam D. Ruppe wrote:

[...]


No. It doesn't amuse me at all. X11 was/is a wonder in many 
respects. The problem with X11 nowadays is that it is getting 
abandoned. I don't recall the name right now, but I read an 
extensive article the past year (or the other one) in which its 
primary maintainer claimed it lost interest in it (or whatever) 
and the project lacks the resources to get well maintained and 
so and so. So the writing is on the wall. I think Wayland 
started its project seeking tear-less windows but evolved a 
far-cry from there. But like it or not, for the worst or the 
better, everything will be Wayland-centric/dependent a few 
years from now, relegating X11 to a niche. That's my two cents, 
which can be far away from reality, of course.


[...]


I would like to recommend DlangUI [1], but we have tried now for 
months to get in contact with the owner of it (to take over 
development) and are getting no reponse.


1. https://github.com/buggins/dlangui