Re: dub build doesn't work

2019-10-22 Thread Justin Stephens via Digitalmars-d-learn

On Tuesday, 22 October 2019 at 22:14:02 UTC, OiseuKodeur wrote:
Hello, i am having a problem with dub build with this project 
https://github.com/OiseauKodeur/cervelet/tree/master/source


when i try to compile everything go well but when i click to 
run the .exe it give my an error missing msvcr100.dll, but with 
rdmd the program run fine


Hi. The link you provided is invalid (is your repository 
private?), but I'll try my best to help. This is a problem with 
your system being unable to locate "msvcr100.dll", which it needs 
to load for your application. From what I have found from a quick 
search, this .dll is a part of Microsoft Visual C++. You should 
try installing Visual C++ and see if that solves the problem.


Best


Re: D for sciencetific scripting / rapid protoryping

2019-10-22 Thread Laeeth Isharc via Digitalmars-d-learn

On Tuesday, 22 October 2019 at 05:58:50 UTC, Prokop Hapala wrote:
I'm examining the possibility to move from Python+C/C++ to D or 
Python+D. I read 
(https://wiki.dlang.org/Programming_in_D_for_Python_Programmers) and
(https://jackstouffer.com/blog/nd_slice.html), where is 
mentioned PyD, Mir-algorithm, all seems very promising. But I 
did not test it yet.


[...]


See autowrap.  PyNih might eventually be a bit nicer than pyd but 
it's not yet there.


We did some very early work on Julia integration and probably 
will finish when time.


You can call R libraries from D too.

If you do use pyd then ppyd might make it a bit more pleasant.

Some rough edges around pyd but it's okay if you don't mind 
figuring things out.




Re: Why isn't skipOver(string, string) nothrow?

2019-10-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, October 22, 2019 4:27:59 PM MDT Per Nordlöw via Digitalmars-d-
learn wrote:
> On Tuesday, 22 October 2019 at 15:39:17 UTC, Adam D. Ruppe wrote:
> > On Tuesday, 22 October 2019 at 15:33:05 UTC, Per Nordlöw wrote:
> >> Why isn't a call to
> >>
> >> skipOver(string, string)
> >>
> >> nothrow?
> >
> > without really looking, probably because of invalid utf
> > sequences potentially throwing. Using the .representation
> > thingy might help if im right about this.
> >
> > A good way to try this is to edit your copy of the Phobos file
> > and add nothrow to it. That should give an error inside that is
> > more descriptive. (I would love if the compiler would do this
> > automatically, we were talking about maybe making that mod on
> > irc yesterday).
>
> But startsWith(string, string) is nothrow so skipOver should be
> that too.

That's only true with startsWith, because it avoids decoding in the case
where the two strings have the same encoding (e.g. it's not nothrow if you
compare a dstring and a string). Presumably, skipOver could be made to do
the same, but no one has done so.

- Jonathan M Davis






Re: Why isn't skipOver(string, string) nothrow?

2019-10-22 Thread Per Nordlöw via Digitalmars-d-learn

On Tuesday, 22 October 2019 at 15:39:17 UTC, Adam D. Ruppe wrote:

On Tuesday, 22 October 2019 at 15:33:05 UTC, Per Nordlöw wrote:

Why isn't a call to

skipOver(string, string)

nothrow?


without really looking, probably because of invalid utf 
sequences potentially throwing. Using the .representation 
thingy might help if im right about this.


A good way to try this is to edit your copy of the Phobos file 
and add nothrow to it. That should give an error inside that is 
more descriptive. (I would love if the compiler would do this 
automatically, we were talking about maybe making that mod on 
irc yesterday).


But startsWith(string, string) is nothrow so skipOver should be 
that too.


dub build doesn't work

2019-10-22 Thread OiseuKodeur via Digitalmars-d-learn
Hello, i am having a problem with dub build with this project 
https://github.com/OiseauKodeur/cervelet/tree/master/source


when i try to compile everything go well but when i click to run 
the .exe it give my an error missing msvcr100.dll, but with rdmd 
the program run fine


Re: ... use of ... is hidden by ...; use alias ... to introduce base class overload set ??

2019-10-22 Thread Ali Çehreli via Digitalmars-d-learn

On 10/22/2019 01:23 PM, Robert M. Münch wrote:

> The whole code
> can be found here: https://pastebin.com/5BTT16Ze

That says "private paste" for me. But I think you have a member function 
template in the base class. Unfortunately, member function template 
instances are never virtual functions, so you can't override them.


I'm pretty sure there is a way out. Can you try showing minimal code 
again please.


Thanks,
Ali




Re: ... use of ... is hidden by ...; use alias ... to introduce base class overload set ??

2019-10-22 Thread Robert M. Münch via Digitalmars-d-learn

On 2019-10-21 18:02:06 +, Robert M. Münch said:


This now gives:

rx_filter_subject.d(66,23): Error: 
rx_filter_subject.FilterSubject.subscribe called with argument types 
(myWidget) matches both:


/Users/robby/.dub/packages/rx-0.13.0/rx/source/rx/subject.d(72,16):
rx.subject.SubjectObject!(message).SubjectObject.subscribe!(myWidget).subscribe(myWidget 
observer)


and:

rx_filter_subject.d(47,14): 
rx_filter_subject.FilterSubject.subscribe(myWidget observer)


So, now there is an ambiguty.


I'm really stuck on this which looks like a dead-lock to me. Adding 
"override" gives:


class myWidget : Observer!message {...}

class FilterSubject : SubjectObject!message {
 override Disposable subscribe(myWidget observer){...}
}

rx_filter_subject.d(47,23): Error: function Disposable 
rx_filter_subject.FilterSubject.subscribe(myWidget observer) does not 
override any function, did you mean to override template 
rx.subject.SubjectObject!(message).SubjectObject.subscribe(T)(T 
observer)?


rx_filter_subject.d(47,23):Functions are the only declarations 
that may be overriden


So, I can't override but when I use an alias I get an ambiguty error... 
now what?


The only solution I have is to use a different name, but that would 
change the interface and run against all the OOP ideas. The whole code 
can be found here: https://pastebin.com/5BTT16Ze



--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



Re: Why isn't skipOver(string, string) nothrow?

2019-10-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, October 22, 2019 9:33:05 AM MDT Per Nordlöw via Digitalmars-d-
learn wrote:
> Why isn't a call to
>
>  skipOver(string, string)
>
> nothrow?
>
> I see no reason why it shouldn't be.
>
> Further, this test should be qualifyable as nothrow:
>
> @safe pure /* TODO nothrow @nogc */ unittest
> {
>  import std.algorithm.searching : skipOver;
>  auto x = "beta version";
>  assert(x.skipOver("beta"));
>  assert(x == " version");
> }

Almost anything involving strings isn't going to be nothrow, because front
and popFront throw on invalid UTF. To really fix that, we'd need to get rid
of auto-decoding. You can use std.utf.byDchar to wrap the string in a range
of dchar which replaces invalid Unicode with the replacement character
instead, which means that no exception gets thrown, but it also means that
if you hadn't previously validated the Unicode, you could end up processing
invalid Unicode without realizing it. How much that matters depends on what
you're doing. Ideally, all strings would just be validated when they were
created, and then it wouldn't be an issue, but any code that decodes the
code points would still have to deal with invalid Unicode in some manner
(though if we decided that it was the responsibility of the caller to always
validate the Unicode first, then we could use assertions). For better or
worse, the chosen solution when ranges were first put together was to throw
on invalid Unicode, which basically makes it impossible for functions that
process strings to be nothrow unless they go to the extra effort working
around auto-decoding. If we're ever able to remove auto-decoding, then
that's no longer an issue for all string processing functions, but it's
still going to be an issue for any code that calls functions like decode or
stride. They're either going to throw or replace invalid Unicode with the
replacement character. Which approach is better depends on the code.

In any case, as long as auto-decoding is a thing, you'll have to use
wrappers like byDchar or byCodeUnit if you want much of anything involving
strings to be nothrow.

- Jonathan M Davis






Re: How to use classes from another d files

2019-10-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 22, 2019 at 8:30 PM Vinod K Chandran via
Digitalmars-d-learn  wrote:
>
> On Tuesday, 22 October 2019 at 17:38:58 UTC, Adam D. Ruppe wrote:
> > On Tuesday, 22 October 2019 at 17:34:51 UTC, Vinod K Chandran
> > wrote:
> >> Hi all,
> >> I am new to D. But some fair experience with vb.net. I was
> >> playing with D classes.  I wrote a class in a D file.
> >> The file name is "classFile.d"
> >
> > did you compile with dmd -i or list both files on the dmd
> > command line?
>
> Thanks for the reply. Nope. I just typed this code in VS Code and
> hit the run button. Thats all. i think this cmd business will be
> difficult for me.

You should use dub. You will probably need it anyway in the future.

VS Code have nice plugins to work with D
you can install D Language utility extension pack


Re: How to use classes from another d files

2019-10-22 Thread Ali Çehreli via Digitalmars-d-learn

On 10/22/2019 11:25 AM, Vinod K Chandran wrote:
> On Tuesday, 22 October 2019 at 17:38:58 UTC, Adam D. Ruppe wrote:
>> On Tuesday, 22 October 2019 at 17:34:51 UTC, Vinod K Chandran wrote:
>>> Hi all,
>>> I am new to D. But some fair experience with vb.net. I was playing
>>> with D classes.  I wrote a class in a D file.
>>> The file name is "classFile.d"
>>
>> did you compile with dmd -i or list both files on the dmd command line?

That: The -i switch is the answer to your question in the other post 
("what if there is too many include files").


> Thanks for the reply. Nope. I just typed this code in VS Code and hit
> the run button. Thats all.

But not sufficient. :) IDEs like VS Code have a way of describing what 
your project involves. You need to add the two files to you "project". 
(I don't know the details for your IDE.)


> i think this cmd business will be difficult
> for me.

Yes, IDEs make it convenient.

Ali



Re: How to use classes from another d files

2019-10-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 22 October 2019 at 18:21:36 UTC, Vinod K Chandran 
wrote:

But what if there is too many include files ?


The dmd -i thing will do that for you

dmd -i main.d

and it will automatically find the others, assuming they are laid 
out so the module/import name matches the file name


Re: How to use classes from another d files

2019-10-22 Thread Vinod K Chandran via Digitalmars-d-learn

On Tuesday, 22 October 2019 at 17:38:58 UTC, Adam D. Ruppe wrote:
On Tuesday, 22 October 2019 at 17:34:51 UTC, Vinod K Chandran 
wrote:

Hi all,
I am new to D. But some fair experience with vb.net. I was 
playing with D classes.  I wrote a class in a D file.

The file name is "classFile.d"


did you compile with dmd -i or list both files on the dmd 
command line?


Thanks for the reply. Nope. I just typed this code in VS Code and 
hit the run button. Thats all. i think this cmd business will be 
difficult for me.


Re: How to use classes from another d files

2019-10-22 Thread Vinod K Chandran via Digitalmars-d-learn
On Tuesday, 22 October 2019 at 17:40:11 UTC, Arun Chandrasekaran 
wrote:
On Tuesday, 22 October 2019 at 17:34:51 UTC, Vinod K Chandran 
wrote:

Hi all,
I am new to D. But some fair experience with vb.net. I was 
playing with D classes.  I wrote a class in a D file.

The file name is "classFile.d"
```D
class TestClass {

[...]


What you are seeing is a linker error. Build it as follows:

dmd caller.d classFile.d

Unrelated, first line of classFile.d needs be `module classFile`


Thanks a lot. But what if there is too many include files ? Say, 
i have 10 files to import in main file, Do i need to type all the 
file names in cmd ?
Is there any dedicated ide in order to avoid this typing task ? I 
have tested it with Codeblocks, but didn't worked.


Re: How to use classes from another d files

2019-10-22 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Tuesday, 22 October 2019 at 17:34:51 UTC, Vinod K Chandran 
wrote:

Hi all,
I am new to D. But some fair experience with vb.net. I was 
playing with D classes.  I wrote a class in a D file.

The file name is "classFile.d"
```D
class TestClass {

[...]


What you are seeing is a linker error. Build it as follows:

dmd caller.d classFile.d

Unrelated, first line of classFile.d needs be `module classFile`


Re: How to use classes from another d files

2019-10-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 22 October 2019 at 17:34:51 UTC, Vinod K Chandran 
wrote:

Hi all,
I am new to D. But some fair experience with vb.net. I was 
playing with D classes.  I wrote a class in a D file.

The file name is "classFile.d"


did you compile with dmd -i or list both files on the dmd command 
line?


How to use classes from another d files

2019-10-22 Thread Vinod K Chandran via Digitalmars-d-learn

Hi all,
I am new to D. But some fair experience with vb.net. I was 
playing with D classes.  I wrote a class in a D file.

The file name is "classFile.d"
```D
class TestClass {

int myIntVar;
string myStringVar  ;

this(int miv, string msv) {
this.myIntVar = miv ;
this.myStringVar = msv  ;
}//End this

}//End Class
```
And i wrote my main function in another file named "caller.d". 
Both these files are in same folder.

```D
import std.stdio ;

void main() {
import classFile ;


TestClass tc = new TestClass(37, "Sample String") ;
writeln(tc.myStringVar) ;
tc.myIntVar = 45 ;
writeln(tc.myIntVar)  ;

writeln("its over..") ;

}//End main
```
This is the error message i got.
;
caller.obj(caller)
 Error 42: Symbol Undefined 
__D9classFile9TestClass6__ctorMFiAyaZCQBjQBc

caller.obj(caller)
 Error 42: Symbol Undefined __D9classFile9TestClass7__ClassZ
Error: linker exited with status 2
PS E:\OneDrive Folder\OneDrive\Programming\D 
Programming\Samples\Sample2>






Re: Why isn't skipOver(string, string) nothrow?

2019-10-22 Thread Adam D. Ruppe via Digitalmars-d-learn

On Tuesday, 22 October 2019 at 15:33:05 UTC, Per Nordlöw wrote:

Why isn't a call to

skipOver(string, string)

nothrow?


without really looking, probably because of invalid utf sequences 
potentially throwing. Using the .representation thingy might help 
if im right about this.


A good way to try this is to edit your copy of the Phobos file 
and add nothrow to it. That should give an error inside that is 
more descriptive. (I would love if the compiler would do this 
automatically, we were talking about maybe making that mod on irc 
yesterday).


Why isn't skipOver(string, string) nothrow?

2019-10-22 Thread Per Nordlöw via Digitalmars-d-learn

Why isn't a call to

skipOver(string, string)

nothrow?

I see no reason why it shouldn't be.

Further, this test should be qualifyable as nothrow:

@safe pure /* TODO nothrow @nogc */ unittest
{
import std.algorithm.searching : skipOver;
auto x = "beta version";
assert(x.skipOver("beta"));
assert(x == " version");
}


What do you think about About C++20 Concepts?

2019-10-22 Thread lili via Digitalmars-d-learn

Hi:
In C++20 Concepts is great idear. but I thinks it is too 
difficult to write.

I like Rust traits simple and elegancy.


Re: undefined symbol: _D3std7variant...

2019-10-22 Thread Andrey via Digitalmars-d-learn

On Tuesday, 22 October 2019 at 12:57:45 UTC, Daniel Kozak wrote:

Have you try to clean all caches? Try to remove .dub folder


I removed .dub folder but this error appears again.


Re: undefined symbol: _D3std7variant...

2019-10-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 22, 2019 at 2:20 PM Andrey via Digitalmars-d-learn
 wrote:
>
> Hello,
> During compilation on linking stage I get strange errors (LDC):
> lld-link: error: undefined symbol:
> _D3std7variant__T8VariantNVmi56TSQBf8typecons__T5TupleTAyuTSQCgQCf__TQCaVmi32TSQCzQBu__TQBoTAQBmTQBqZQCbTQnTQCbZQDrZQCqTQBcTQCrZQEh4typeMxFNbNdNeZC8TypeInfo
> >>> referenced by E:\Programs\LDC2\import\std\variant.d:753
> >>>
> >>> .dub\obj\builder.obj:(_D3std7variant__T8VariantNVmi56TSQBf8typecons__T5TupleTAyuTSQCgQCf__TQCaVmi32TSQCzQBu__TQBoTAQBmTQBqZQCbTQnTQCbZQDrZQCqTQBcTQCrZQEh__T4peekTQDhZQkMNgFNdZPNgAyu)
> >>>referenced by 
> >>> E:\Programs\LDC2\import\std\variant.d:753
> >>>
> >>> .dub\obj\builder.obj:(_D3std7variant__T8VariantNVmi56TSQBf8typecons__T5TupleTAyuTSQCgQCf__TQCaVmi32TSQCzQBu__TQBoTAQBmTQBqZQCbTQnTQCbZQDrZQCqTQBcTQCrZQEh__T4peekTQBwZQkMNgFNdZPNgAAyu)
> >>>   referenced by 
> >>> E:\Programs\LDC2\import\std\variant.d:820
> >>>
> >>> .dub\obj\builder.obj:(_D3std7variant__T8VariantNVmi56TSQBf8typecons__T5TupleTAyuTSQCgQCf__TQCaVmi32TSQCzQBu__TQBoTAQBmTQBqZQCbTQnTQCbZQDrZQCqTQBcTQCrZQEh__T3getTQEdZQjMNgFNdZNgSQFxQEs__TQEmTQEjTQEjZQEy)
>
> How to solve?
> This is the first time when linking fails on Phobos library.

Have you try to clean all caches? Try to remove .dub folder



Blog Post #81: Notebook, Part V - Customized Tabs, Part III

2019-10-22 Thread Ron Tarrant via Digitalmars-d-learn
Today we wrap up the customized tabs discussion as we look at the 
drawing routines. It's here: 
https://gtkdcoding.com/2019/10/22/0081-notebook-v-custom-tabs-iii.html


undefined symbol: _D3std7variant...

2019-10-22 Thread Andrey via Digitalmars-d-learn

Hello,
During compilation on linking stage I get strange errors (LDC):
lld-link: error: undefined symbol: 
_D3std7variant__T8VariantNVmi56TSQBf8typecons__T5TupleTAyuTSQCgQCf__TQCaVmi32TSQCzQBu__TQBoTAQBmTQBqZQCbTQnTQCbZQDrZQCqTQBcTQCrZQEh4typeMxFNbNdNeZC8TypeInfo

referenced by E:\Programs\LDC2\import\std\variant.d:753
  
.dub\obj\builder.obj:(_D3std7variant__T8VariantNVmi56TSQBf8typecons__T5TupleTAyuTSQCgQCf__TQCaVmi32TSQCzQBu__TQBoTAQBmTQBqZQCbTQnTQCbZQDrZQCqTQBcTQCrZQEh__T4peekTQDhZQkMNgFNdZPNgAyu)   referenced by E:\Programs\LDC2\import\std\variant.d:753
  
.dub\obj\builder.obj:(_D3std7variant__T8VariantNVmi56TSQBf8typecons__T5TupleTAyuTSQCgQCf__TQCaVmi32TSQCzQBu__TQBoTAQBmTQBqZQCbTQnTQCbZQDrZQCqTQBcTQCrZQEh__T4peekTQBwZQkMNgFNdZPNgAAyu)  referenced by E:\Programs\LDC2\import\std\variant.d:820
  
.dub\obj\builder.obj:(_D3std7variant__T8VariantNVmi56TSQBf8typecons__T5TupleTAyuTSQCgQCf__TQCaVmi32TSQCzQBu__TQBoTAQBmTQBqZQCbTQnTQCbZQDrZQCqTQBcTQCrZQEh__T3getTQEdZQjMNgFNdZNgSQFxQEs__TQEmTQEjTQEjZQEy)


How to solve?
This is the first time when linking fails on Phobos library.


Re: D for sciencetific scripting / rapid protoryping

2019-10-22 Thread Andre Pany via Digitalmars-d-learn

On Tuesday, 22 October 2019 at 08:30:36 UTC, Daniel Kozak wrote:
On Tue, Oct 22, 2019 at 10:25 AM Prokop Hapala via 
Digitalmars-d-learn  wrote:


...

Also where is RDMD in the equation? I really like the idea run 
binary programs like:


#!/usr/bin/env rdmd
import std.stdio;
void main(){
 writeln("Hello, world!");
}

But I cannot find any documentation how to use rdmd with any 
libraries/dependencies and dub.json ? Not even statically 
linked, not to say dynamic.




You can't use rdmd with dub, but for simple scripts you can use 
dub directly:


https://dub.pm/advanced_usage.html


Here an example, save it as example.d:

```d
#!/usr/bin/env dub

/+ dub.json:
{
"name":"example-s3",
"dependencies":{
"aws-sdk:core": "1.0.0",
"aws-sdk:s3": "1.0.0"
}
}
+/

import aws.sdk.core, aws.sdk.s3;

void main()
{
auto client = new AwsClient();
auto s3 = new S3Service(client);

...
}
```

On linux you could start this file using command 
```./example.d```.

Or with command ```dub example.d```.

Kind regards
André


Thread synchronization context

2019-10-22 Thread mireczech via Digitalmars-d-learn

Hello everyone,

Recently, a few days ago I discovered dlang and I really like it. 
It's a programming language which meets to my idea of what a 
modern programming language should look like. I decided to do one 
project in it.


Now I am addressing one problem. I have two threads, one main and 
the other for a communication. How can I call a method from a 
communication thread in the context of the main thread? Something 
like the SynchchronizationContext class in c#.


An example:

alias PacketEventHandler = synchronized void delegate (Object 
sender, PacketEventArg e);


public class TcpClient : Thread
{
public this()
{
_socket = new Socket(AddressFamily.INET,  SocketType.STREAM);
_socket.blocking = false;
PacketReceived = _packetReceived;
super();

}
protected void Execute()
{
_socket.connect(new InternetAddress(_address, _port));
while (!_terminated)
{
_socket.send(dataToSend);
ubyte[] receivedBuffer = new ubyte[_packetSize];
auto received = _socket.receive(receivedBuffer)
if (PacketReceived !is null) 
PacketReceived(this, new PacketEventArg(receivedBuffer));//that 
delegate I would like to call from the context of main thread


}
}

public PacketEventHandler PacketReceived;

void client_packetReceived(Object sender, PacketEventArg e)
{
  writeln("received byte0: ", e.dataPacket[0]);   
}
}

Thank you for any answers


Re: -cov option ignored?

2019-10-22 Thread drkameleon via Digitalmars-d-learn
The same seems to be happening for profile-gc as well. No output 
is being produced, or I'm blind - I don't know...


For profiling, I build the project with:

dub build --build=profile --compiler=ldc2 --config=light

Any ideas are more than welcome!


-cov option ignored?

2019-10-22 Thread drkameleon via Digitalmars-d-learn
I'm building a project with dub and no-matter-what I cannot get 
the compiler to output Code Coverage information. This is my 
dub.json. What am I doing wrong?


{
"authors": [
"drkameleon"
],
"buildTypes": {
"profile": {
"buildOptions": [
"debugInfo",
"inline",
"optimize",
"profile",
"profileGC",
"noBoundsCheck",
"ignoreUnknownPragmas",
"coverage",
"warnings"
],
"dflags-dmd": [
"-J source/resources"
],
"dflags-ldc": [
"-J=source/resources",
"-flto=full",
"-O5",
"-Os",
"-Oz",
"-fprofile-instr-generate",
"-fdmd-trace-functions"
],
"lflags-dmd": [
"-lcurl",
"-lsqlite3"
],
"lflags-ldc": [
"-lcurl",
"-lsqlite3"
]
},
"release": {
"buildOptions": [
"releaseMode",
"inline",
"optimize",
"noBoundsCheck",
"ignoreUnknownPragmas"
],
"dflags-dmd": [
"-J source/resources"
],
"dflags-ldc": [
"-J=source/resources",
"-flto=full",
"-O5",
"-Os",
"-Oz",
"-mcpu=native"
],
"lflags-dmd": [
"-lcurl"
],
"lflags-ldc": [
"-lcurl"
]
}
},
"configurations": [
{
"name": "application",
"targetType": "executable",
"versions": ["GTK","SQLITE"],
"dependencies": {
"gtk-d": "~>3.9.0"
},
"lflags-dmd": [
"-lsqlite3"
],
"lflags-ldc": [
"-lsqlite3"
]
},
{
"name": "light",
"targetType": "executable"
},
{
"name": "library",
"targetType": "staticLibrary"
}
],
	"copyright": "Copyright © 2019, Yanis Zafirópulos (aka 
Dr.Kameleon)",

"dependencies": {
"dmarkdown": "~>0.3.0",
"dxml": "~>0.4.1",
"dyaml": "~>0.8.0",
"emsi_containers": "~>0.7.0",
"urld": "~>2.1.1",
"vibe-d:inet": "~>0.8.6"
},
	"description": "Simple, modern and powerful interpreted 
programming language for super-fast scripting",

"homepage": "http://arturo-lang.io;,
"license": "MIT",
"name": "arturo",
"postBuildCommands": [
"strip arturo"
],
"preBuildCommands": [
"scripts/make_parser.sh",
"scripts/update_build.sh"
],
"sourceFiles": [
"obj/lexer.o",
"obj/parser.o"
]
}


Re: D for sciencetific scripting / rapid protoryping

2019-10-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 22, 2019 at 10:25 AM Prokop Hapala via Digitalmars-d-learn
 wrote:
>
> ...
>
> Also where is RDMD in the equation? I really like the idea run
> binary programs like:
>
> #!/usr/bin/env rdmd
> import std.stdio;
> void main(){
>  writeln("Hello, world!");
> }
>
> But I cannot find any documentation how to use rdmd with any
> libraries/dependencies and dub.json ? Not even statically linked,
> not to say dynamic.
>

You can't use rdmd with dub, but for simple scripts you can use dub directly:

https://dub.pm/advanced_usage.html


Re: D for sciencetific scripting / rapid protoryping

2019-10-22 Thread Prokop Hapala via Digitalmars-d-learn
On Tuesday, 22 October 2019 at 08:04:32 UTC, Arun Chandrasekaran 
wrote:
On Tuesday, 22 October 2019 at 07:51:16 UTC, Arun 
Chandrasekaran wrote:
On Tuesday, 22 October 2019 at 07:40:01 UTC, Prokop Hapala 
wrote:

[...]


If you are building individual files, use ldc2 with 
--link-defaultlib-shared flag:


arun@home-pc:/tmp$ cat a.d
void main() { import std; writeln("Hai"); }
arun@home-pc:/tmp$ ldc2 a.d
arun@home-pc:/tmp$ ldd a
linux-vdso.so.1 (0x7fff6395b000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 
(0x7f1ec91ea000)
libpthread.so.0 => 
/lib/x86_64-linux-gnu/libpthread.so.0 (0x7f1ec91c7000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 
(0x7f1ec9078000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 
(0x7f1ec905e000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 
(0x7f1ec8e6d000)

/lib64/ld-linux-x86-64.so.2 (0x7f1ec92c4000)
arun@home-pc:/tmp$ ldc2 a.d --link-defaultlib-shared
arun@home-pc:/tmp$ ldd a
linux-vdso.so.1 (0x7ffcbda7f000)
libphobos2-ldc-shared.so.88 => 
/home/arun/.bin/ldc2-1.18.0-linux-x86_64/bin/../lib/libphobos2-ldc-shared.so.88 (0x7f1b57be8000)
libdruntime-ldc-shared.so.88 => 
/home/arun/.bin/ldc2-1.18.0-linux-x86_64/bin/../lib/libdruntime-ldc-shared.so.88 (0x7f1b57abc000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 
(0x7f1b57a84000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 
(0x7f1b57893000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 
(0x7f1b57744000)
libpthread.so.0 => 
/lib/x86_64-linux-gnu/libpthread.so.0 (0x7f1b57721000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 
(0x7f1b57714000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 
(0x7f1b5770e000)

/lib64/ld-linux-x86-64.so.2 (0x7f1b58067000)
arun@home-pc:/tmp$


If you want similar behavior with dub, here is a sample dub.json

arun@home-pc:/tmp/test$ cat dub.json
{
"authors": [
"Arun"
],
"copyright": "Copyright © 2019, Arun",
"description": "A minimal D application.",
"license": "proprietary",
"dflags-ldc": ["-link-defaultlib-shared"],
"name": "test"
}
arun@home-pc:/tmp/test$

Dub settings can be at times intimidating, but still give it a 
read https://dub.pm/package-format-json#build-settings


Thank you Arun, that is very helpful!

Do you have also some example which use some other than default 
library ?


I see there is quite comprehensive description how to use dmd 
with dynamic libraries

https://dlang.org/articles/dll-linux.html

But there is nothing how to integrate it with dub and deb.json (I 
really like DUB, it's one of the best improvements over C/C++ 
enviroment I noticed)


Also where is RDMD in the equation? I really like the idea run 
binary programs like:


#!/usr/bin/env rdmd
import std.stdio;
void main(){
writeln("Hello, world!");
}

But I cannot find any documentation how to use rdmd with any 
libraries/dependencies and dub.json ? Not even statically linked, 
not to say dynamic.




Re: D for sciencetific scripting / rapid protoryping

2019-10-22 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Tuesday, 22 October 2019 at 07:51:16 UTC, Arun Chandrasekaran 
wrote:
On Tuesday, 22 October 2019 at 07:40:01 UTC, Prokop Hapala 
wrote:

[...]


If you are building individual files, use ldc2 with 
--link-defaultlib-shared flag:


arun@home-pc:/tmp$ cat a.d
void main() { import std; writeln("Hai"); }
arun@home-pc:/tmp$ ldc2 a.d
arun@home-pc:/tmp$ ldd a
linux-vdso.so.1 (0x7fff6395b000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 
(0x7f1ec91ea000)
libpthread.so.0 => 
/lib/x86_64-linux-gnu/libpthread.so.0 (0x7f1ec91c7000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 
(0x7f1ec9078000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 
(0x7f1ec905e000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 
(0x7f1ec8e6d000)

/lib64/ld-linux-x86-64.so.2 (0x7f1ec92c4000)
arun@home-pc:/tmp$ ldc2 a.d --link-defaultlib-shared
arun@home-pc:/tmp$ ldd a
linux-vdso.so.1 (0x7ffcbda7f000)
libphobos2-ldc-shared.so.88 => 
/home/arun/.bin/ldc2-1.18.0-linux-x86_64/bin/../lib/libphobos2-ldc-shared.so.88 (0x7f1b57be8000)
libdruntime-ldc-shared.so.88 => 
/home/arun/.bin/ldc2-1.18.0-linux-x86_64/bin/../lib/libdruntime-ldc-shared.so.88 (0x7f1b57abc000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 
(0x7f1b57a84000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 
(0x7f1b57893000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 
(0x7f1b57744000)
libpthread.so.0 => 
/lib/x86_64-linux-gnu/libpthread.so.0 (0x7f1b57721000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 
(0x7f1b57714000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 
(0x7f1b5770e000)

/lib64/ld-linux-x86-64.so.2 (0x7f1b58067000)
arun@home-pc:/tmp$


If you want similar behavior with dub, here is a sample dub.json

arun@home-pc:/tmp/test$ cat dub.json
{
"authors": [
"Arun"
],
"copyright": "Copyright © 2019, Arun",
"description": "A minimal D application.",
"license": "proprietary",
"dflags-ldc": ["-link-defaultlib-shared"],
"name": "test"
}
arun@home-pc:/tmp/test$

Dub settings can be at times intimidating, but still give it a 
read https://dub.pm/package-format-json#build-settings


Re: D for sciencetific scripting / rapid protoryping

2019-10-22 Thread Mike Parker via Digitalmars-d-learn

On Tuesday, 22 October 2019 at 07:40:01 UTC, Prokop Hapala wrote:



1) I'm not speaking about OpenGL and SDL specifically (that was 
just small example which I tried first)


FYI, the BindBC bindings can be configured as dynamic (in which 
all the of C library functions are declared as function pointers 
and the C shared library must be loaded manually at runtime) or 
static (in which the C library functions become normal function 
declarations with no implementation and there is a link-time 
dependency on the C static or shared library). The exception is 
OpenGL, for which there is no static binding.


The dynamic bindings add the overhead of the function pointer 
declarations when linked. It's insignificant for most of them. 
The biggest bindbc-opengl, depending on how many extensions you 
configure (it's extremely high for DerelictGL3 most of the time, 
as it tends to pull in more extensions).




2) I'm more concerned about how to D compiler links 
dependencies when it compiles simple .d program (with lot of 
dependencies).


When using dub, it depends on the package configuration of each 
dependency. All of the Derelict and BindBC packages, for example, 
are configured to build as static libraries. It didn't (and 
doesn't) make sense to me to compile a binding as a shared 
library. Dub packages can also be configured as shared libraries, 
or simply as "library" (I haven't investigated what that means). 
Some might provide custom subconfigurations to choose static or 
shared.


The biggest overhead with DMD output tends to come from the 
standard library. On Windows, the static library the only option. 
IIRC on Linux it's necessary to pass -defaultlib=libphobos2.so to 
DMD to link the shared lib. I don't know how LDC handles it.




Re: D for sciencetific scripting / rapid protoryping

2019-10-22 Thread Arun Chandrasekaran via Digitalmars-d-learn

On Tuesday, 22 October 2019 at 07:40:01 UTC, Prokop Hapala wrote:

On Tuesday, 22 October 2019 at 07:23:46 UTC, Daniel Kozak wrote:
On Tue, Oct 22, 2019 at 8:00 AM Prokop Hapala via 
Digitalmars-d-learn  wrote:


I'm examining the possibility to move from Python+C/C++ to D 
or

Python+D. I read
(https://wiki.dlang.org/Programming_in_D_for_Python_Programmers)
and
(https://jackstouffer.com/blog/nd_slice.html), where is 
mentioned
PyD, Mir-algorithm, all seems very promising. But I did not 
test

it yet.

 >...

You should try to use https://github.com/BindBC/bindbc-opengl 
and
https://github.com/BindBC/bindbc-sdl. There seems to be an 
issue with

derelict packages (mainly with the gl3 one)
And as far as I know derelict should be replaced by bindbc 
anyway in future.


And if you plan to have *.so libs you should add "targetType" 
: "dynamicLibrary", to you dub.json


OK, thanks. That is useful to know. But just to not turn the 
topic elsewhere I should make clear that:


1) I'm not speaking about OpenGL and SDL specifically (that was 
just small example which I tried first)


2) I'm more concerned about how to D compiler links 
dependencies when it compiles simple .d program (with lot of 
dependencies).


I think if I can make it link everything dynamically, It would 
considerably reduce both size of binary target (whether it is 
executable or .so) and compilation speed (since it would not 
re-compile dependencies).


What I want is to recompile and run quite large 
programs/projects composed composed of many little 
sub-programs/sub-libraries from Python+D in fast cycles (<< 1 
second), because that would make debugging workflow much more 
pleasant and efficient (in comparison to Python+C/C++ or Julia).


If you are building individual files, use ldc2 with 
--link-defaultlib-shared flag:


arun@home-pc:/tmp$ cat a.d
void main() { import std; writeln("Hai"); }
arun@home-pc:/tmp$ ldc2 a.d
arun@home-pc:/tmp$ ldd a
linux-vdso.so.1 (0x7fff6395b000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 
(0x7f1ec91ea000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 
(0x7f1ec91c7000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 
(0x7f1ec9078000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 
(0x7f1ec905e000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 
(0x7f1ec8e6d000)

/lib64/ld-linux-x86-64.so.2 (0x7f1ec92c4000)
arun@home-pc:/tmp$ ldc2 a.d --link-defaultlib-shared
arun@home-pc:/tmp$ ldd a
linux-vdso.so.1 (0x7ffcbda7f000)
libphobos2-ldc-shared.so.88 => 
/home/arun/.bin/ldc2-1.18.0-linux-x86_64/bin/../lib/libphobos2-ldc-shared.so.88 (0x7f1b57be8000)
libdruntime-ldc-shared.so.88 => 
/home/arun/.bin/ldc2-1.18.0-linux-x86_64/bin/../lib/libdruntime-ldc-shared.so.88 (0x7f1b57abc000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 
(0x7f1b57a84000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 
(0x7f1b57893000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 
(0x7f1b57744000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 
(0x7f1b57721000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 
(0x7f1b57714000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 
(0x7f1b5770e000)

/lib64/ld-linux-x86-64.so.2 (0x7f1b58067000)
arun@home-pc:/tmp$


Re: D for sciencetific scripting / rapid protoryping

2019-10-22 Thread Prokop Hapala via Digitalmars-d-learn

On Tuesday, 22 October 2019 at 07:23:46 UTC, Daniel Kozak wrote:
On Tue, Oct 22, 2019 at 8:00 AM Prokop Hapala via 
Digitalmars-d-learn  wrote:


I'm examining the possibility to move from Python+C/C++ to D or
Python+D. I read
(https://wiki.dlang.org/Programming_in_D_for_Python_Programmers)
and
(https://jackstouffer.com/blog/nd_slice.html), where is 
mentioned
PyD, Mir-algorithm, all seems very promising. But I did not 
test

it yet.

 >...

You should try to use https://github.com/BindBC/bindbc-opengl 
and
https://github.com/BindBC/bindbc-sdl. There seems to be an 
issue with

derelict packages (mainly with the gl3 one)
And as far as I know derelict should be replaced by bindbc 
anyway in future.


And if you plan to have *.so libs you should add "targetType" : 
"dynamicLibrary", to you dub.json


OK, thanks. That is useful to know. But just to not turn the 
topic elsewhere I should make clear that:


1) I'm not speaking about OpenGL and SDL specifically (that was 
just small example which I tried first)


2) I'm more concerned about how to D compiler links dependencies 
when it compiles simple .d program (with lot of dependencies).


I think if I can make it link everything dynamically, It would 
considerably reduce both size of binary target (whether it is 
executable or .so) and compilation speed (since it would not 
re-compile dependencies).


What I want is to recompile and run quite large programs/projects 
composed composed of many little sub-programs/sub-libraries from 
Python+D in fast cycles (<< 1 second), because that would make 
debugging workflow much more pleasant and efficient (in 
comparison to Python+C/C++ or Julia).


Re: D for sciencetific scripting / rapid protoryping

2019-10-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 22, 2019 at 8:00 AM Prokop Hapala via Digitalmars-d-learn
 wrote:
>
> I'm examining the possibility to move from Python+C/C++ to D or
> Python+D. I read
> (https://wiki.dlang.org/Programming_in_D_for_Python_Programmers)
> and
> (https://jackstouffer.com/blog/nd_slice.html), where is mentioned
> PyD, Mir-algorithm, all seems very promising. But I did not test
> it yet.
 >...

You should try to use https://github.com/BindBC/bindbc-opengl and
https://github.com/BindBC/bindbc-sdl. There seems to be an issue with
derelict packages (mainly with the gl3 one)
And as far as I know derelict should be replaced by bindbc anyway in future.

And if you plan to have *.so libs you should add "targetType" :
"dynamicLibrary", to you dub.json


Re: contains method on immutable sorted array

2019-10-22 Thread Andrey via Digitalmars-d-learn

On Monday, 21 October 2019 at 20:44:29 UTC, Nicholas Wilson wrote:

works, so I guess contains doesn't work with immutable?
If you can do some more research into this and confirm it then, 
please file a bug report.


As I understand - yes. It doesn't work with immutable object.
Also I see the same problem with 'const' and 'shared' object:

shared values = sort(cast(wstring[])["й", "ц", "ук", "н"]);
const values = sort(cast(wstring[])["й", "ц", "ук", "н"]);
values.contains("ук"w).writeln; // error


So you think it is a bug in compiler?