Re: Dpp on run.dlang.io

2018-08-06 Thread bachmeier via Digitalmars-d-announce

On Monday, 6 August 2018 at 13:43:46 UTC, Laeeth Isharc wrote:

And Octave (via the .mex interface) - this one's important 
because it opens the door to using D as an extension language 
to Matlab


If an Octave extension written in D works, do you have anywhere 
to point me to on what's needed to make it work with Matlab?  
(Is it usually drop-in compatible?)


Unfortunately I don't use Matlab and don't have a license to try 
out. However, as I understand Octave's mex interface, the 
original goal was to allow Matlab extensions to be compiled and 
run in Octave. Otherwise you could have a core language that ran 
Matlab code but extensions would still lock you in to Matlab. 
Thus, I'm assuming that the ability to use Octave's mex interface 
implies ability to use Matlab's.


Re: Dpp on run.dlang.io

2018-08-06 Thread Laeeth Isharc via Digitalmars-d-announce

On Monday, 6 August 2018 at 13:32:23 UTC, bachmeier wrote:

On Sunday, 5 August 2018 at 22:43:42 UTC, Laeeth Isharc wrote:

One benefit of D is as a better glue language that integrates 
well with other languages and ecosystems.  Many people who 
know a bit about D have no idea that interop can work so 
easily or well.


So it might be worth mentioning this benefit as one link from 
main page and then linking from that to new page that mentions 
and has runnable examples (using HAR) for:


Python (via autowrap:python and pyd)
C (via dpp)
C++ (extern(C++) for now)
R (via embedr)
Julia (via C interface, including julia.h via dpp)
Lua (if LuaD stable enough)


And Octave (via the .mex interface) - this one's important 
because it opens the door to using D as an extension language 
to Matlab


If an Octave extension written in D works, do you have anywhere 
to point me to on what's needed to make it work with Matlab?  (Is 
it usually drop-in compatible?)





Re: Dpp on run.dlang.io

2018-08-06 Thread bachmeier via Digitalmars-d-announce

On Sunday, 5 August 2018 at 22:43:42 UTC, Laeeth Isharc wrote:

One benefit of D is as a better glue language that integrates 
well with other languages and ecosystems.  Many people who know 
a bit about D have no idea that interop can work so easily or 
well.


So it might be worth mentioning this benefit as one link from 
main page and then linking from that to new page that mentions 
and has runnable examples (using HAR) for:


Python (via autowrap:python and pyd)
C (via dpp)
C++ (extern(C++) for now)
R (via embedr)
Julia (via C interface, including julia.h via dpp)
Lua (if LuaD stable enough)


And Octave (via the .mex interface) - this one's important 
because it opens the door to using D as an extension language to 
Matlab


Re: Dpp on run.dlang.io

2018-08-06 Thread Dukc via Digitalmars-d-announce

On Monday, 6 August 2018 at 02:17:28 UTC, Mike Franklin wrote:
The C standard library not a true and intrinsic dependency of 
D, and is outside of D's charter.  [...]


D is a much more capable programming language than C, and 
whatever functionality is being imported from the C standard 
library can be better implemented in D with compile-time 
optimizations via templates, memory safety, and other benefits.


So if I understood correctly, you did not mean ejecting core.stdc 
but that DRuntime should not depend on it? Yeah, that sound 
reasonable for me too (If it is practical effort), regardless of 
DPP. But C libraries should be kept as a backup for platforms 
where there aren't D implementations. For example, IO functions 
could first try (using design by introspection) some 
implementation like https://github.com/schveiguy/iopipe. And if 
that does not support the enviroment, then fallback to C IO.


Re: Dpp on run.dlang.io

2018-08-05 Thread Mike Franklin via Digitalmars-d-announce

On Saturday, 4 August 2018 at 09:43:13 UTC, Dukc wrote:

On Saturday, 4 August 2018 at 02:39:23 UTC, Mike Franklin wrote:


Cool! Can we now deprecate and eventually jettison C/C++ 
bindings from druntime, please?


Why?


The C standard library not a true and intrinsic dependency of D, 
and is outside of D's charter.  There are druntime 
implementations that leverage the C standard library, but I 
believe that was largely done for expediency.  If one wants to 
leverage the C standard library for a certain druntime 
implementation, that's fine, but it should be privately imported.


D is a much more capable programming language than C, and 
whatever functionality is being imported from the C standard 
library can be better implemented in D with compile-time 
optimizations via templates, memory safety, and other benefits.


Mike




Re: Dpp on run.dlang.io

2018-08-05 Thread Nicholas Wilson via Digitalmars-d-announce

On Sunday, 5 August 2018 at 22:43:42 UTC, Laeeth Isharc wrote:
One benefit of D is as a better glue language that integrates 
well with other languages and ecosystems.  Many people who know 
a bit about D have no idea that interop can work so easily or 
well.


So it might be worth mentioning this benefit as one link from 
main page and then linking from that to new page that mentions 
and has runnable examples (using HAR) for:


Python (via autowrap:python and pyd)
C (via dpp)
C++ (extern(C++) for now)
R (via embedr)
Julia (via C interface, including julia.h via dpp)
Lua (if LuaD stable enough)

with just screenshot for:
Excel (via autowrap excel / excel-d)
C# via Binderoo
Jupyter via pydmagic

and just link for web assembly.
Obviously a lot of work, but if you think a good idea we could 
work away at over time.


"Here's something I prepared earlier."

https://github.com/thewilsonator/interop

This is currently to house [1] to try to show Walter why 
https://github.com/dlang/dmd/pull/8120 is a good idea. 
Unfortunately he remains unconvinced so I think I'm going to have 
to do it as a DIP [3].


[1]: 
https://github.com/thewilsonator/interop/blob/master/c%2B%2B/dslice.h

[2]: https://github.com/dlang/dmd/pull/8120
[3]: 
https://github.com/thewilsonator/DIPs/blob/extern(C++)-array/DIPs/DIP1xxx.md




Re: Dpp on run.dlang.io

2018-08-05 Thread Laeeth Isharc via Digitalmars-d-announce

On Saturday, 4 August 2018 at 13:15:24 UTC, Seb wrote:

On Saturday, 4 August 2018 at 01:27:49 UTC, Laeeth Isharc wrote:
Thanks to Seb and Atila it is now very easy to show  a D 
program just #includeing C headers.  If just works.  Modulo 
bugs.  In time I am hopeful Atila will start to have more of 
C++ headers working too.


https://run.dlang.io/is/JlH3Th


It now also supports multiple files (and compiling C files) 
with the Har format [1]:


https://run.dlang.io/is/WwpvhT

This should hopefully make it even more useful.

[1] https://github.com/marler8997/har


Thanks v much for this.

One benefit of D is as a better glue language that integrates 
well with other languages and ecosystems.  Many people who know a 
bit about D have no idea that interop can work so easily or well.


So it might be worth mentioning this benefit as one link from 
main page and then linking from that to new page that mentions 
and has runnable examples (using HAR) for:


Python (via autowrap:python and pyd)
C (via dpp)
C++ (extern(C++) for now)
R (via embedr)
Julia (via C interface, including julia.h via dpp)
Lua (if LuaD stable enough)

with just screenshot for:
Excel (via autowrap excel / excel-d)
C# via Binderoo
Jupyter via pydmagic

and just link for web assembly.
Obviously a lot of work, but if you think a good idea we could 
work away at over time.







Re: Dpp on run.dlang.io

2018-08-04 Thread Seb via Digitalmars-d-announce

On Saturday, 4 August 2018 at 01:27:49 UTC, Laeeth Isharc wrote:
Thanks to Seb and Atila it is now very easy to show  a D 
program just #includeing C headers.  If just works.  Modulo 
bugs.  In time I am hopeful Atila will start to have more of 
C++ headers working too.


https://run.dlang.io/is/JlH3Th


It now also supports multiple files (and compiling C files) with 
the Har format [1]:


https://run.dlang.io/is/WwpvhT

This should hopefully make it even more useful.

[1] https://github.com/marler8997/har



Re: Dpp on run.dlang.io

2018-08-04 Thread John Colvin via Digitalmars-d-announce

On Saturday, 4 August 2018 at 01:27:49 UTC, Laeeth Isharc wrote:
Thanks to Seb and Atila it is now very easy to show  a D 
program just #includeing C headers.  If just works.  Modulo 
bugs.  In time I am hopeful Atila will start to have more of 
C++ headers working too.


https://run.dlang.io/is/JlH3Th


Very cool.

It seems like it's on by default with no option to turn it off. 
Is that a good idea?


Also, it appears to have broken for me in the last couple of 
minutes. It worked initially, then I clicked the link again and 
ran it, got:


Error: Could not execute `dmd onlineapp.d -ofonlineapp`:
onlineapp.d(49): Error: no identifier for declarator `typedef`
onlineapp.d(49): Error: semicolon expected, not `int`
onlineapp.d(53): Error: semicolon expected, not `char`
onlineapp.d(54): Error: semicolon expected, not `short`
onlineapp.d(54): Error: no identifier for declarator `short`
onlineapp.d(55): Error: semicolon expected, not `int`
onlineapp.d(56): Error: semicolon expected, not `long`
onlineapp.d(56): Error: no identifier for declarator `long`
onlineapp.d(59): Error: semicolon expected, not `char`
onlineapp.d(60): Error: semicolon expected, not `char`
onlineapp.d(61): Error: semicolon expected, not `short`
onlineapp.d(61): Error: no identifier for declarator `short`
onlineapp.d(62): Error: semicolon expected, not `short`
onlineapp.d(62): Error: no identifier for declarator `short`
onlineapp.d(63): Error: semicolon expected, not `int`
onlineapp.d(64): Error: semicolon expected, not `int`
onlineapp.d(66): Error: semicolon expected, not `long`
onlineapp.d(66): Error: no identifier for declarator `long`
onlineapp.d(67): Error: semicolon expected, not `long`
onlineapp.d(67): Error: no identifier for declarator `long`

Program exited with code 1


Re: Dpp on run.dlang.io

2018-08-04 Thread Dukc via Digitalmars-d-announce

On Saturday, 4 August 2018 at 02:39:23 UTC, Mike Franklin wrote:


Cool! Can we now deprecate and eventually jettison C/C++ 
bindings from druntime, please?


Why? As I understand it, they do not increase your executable 
size unless used. Besides, the bindings include the @trusted and 
scope attributes C++ headers don't, and are quicker to compile.


Re: Dpp on run.dlang.io

2018-08-03 Thread Joakim via Digitalmars-d-announce

On Saturday, 4 August 2018 at 05:06:26 UTC, Joakim wrote:

On Saturday, 4 August 2018 at 02:39:23 UTC, Mike Franklin wrote:
On Saturday, 4 August 2018 at 01:27:49 UTC, Laeeth Isharc 
wrote:
Thanks to Seb and Atila it is now very easy to show  a D 
program just #includeing C headers.  If just works.  Modulo 
bugs.  In time I am hopeful Atila will start to have more of 
C++ headers working too.


https://run.dlang.io/is/JlH3Th


Cool! Can we now deprecate and eventually jettison C/C++ 
bindings from druntime, please?


No, because dpp is new, not commonly used, and I think only 
works with DMD.


Scratch that last part, works with LDC too:

https://travis-ci.org/atilaneves/dpp


Re: Dpp on run.dlang.io

2018-08-03 Thread Joakim via Digitalmars-d-announce

On Saturday, 4 August 2018 at 02:39:23 UTC, Mike Franklin wrote:

On Saturday, 4 August 2018 at 01:27:49 UTC, Laeeth Isharc wrote:
Thanks to Seb and Atila it is now very easy to show  a D 
program just #includeing C headers.  If just works.  Modulo 
bugs.  In time I am hopeful Atila will start to have more of 
C++ headers working too.


https://run.dlang.io/is/JlH3Th


Cool! Can we now deprecate and eventually jettison C/C++ 
bindings from druntime, please?


No, because dpp is new, not commonly used, and I think only works 
with DMD. It might make sense to split those bindings off into 
their own git repo, separate from the compiled parts of druntime 
though.


Re: Dpp on run.dlang.io

2018-08-03 Thread Basile B. via Digitalmars-d-announce

On Saturday, 4 August 2018 at 02:39:23 UTC, Mike Franklin wrote:
Cool! Can we now deprecate and eventually jettison C/C++ 
bindings from druntime, please?


And drop completion call tips etc at the same time...


Re: Dpp on run.dlang.io

2018-08-03 Thread Mike Franklin via Digitalmars-d-announce

On Saturday, 4 August 2018 at 01:27:49 UTC, Laeeth Isharc wrote:
Thanks to Seb and Atila it is now very easy to show  a D 
program just #includeing C headers.  If just works.  Modulo 
bugs.  In time I am hopeful Atila will start to have more of 
C++ headers working too.


https://run.dlang.io/is/JlH3Th


Cool! Can we now deprecate and eventually jettison C/C++ bindings 
from druntime, please?