Github Actions now support D out of the box!

2020-08-20 Thread Mathias LANG via Digitalmars-d-announce

Hi everyone,
Almost a year ago, Ernesto Castelloti (@ErnyTech) submitted a PR 
for Github's "starter-workflow" to add support for D out of the 
box (https://github.com/actions/starter-workflows/pull/74). It 
was in a grey area for a while, as Github was trying to come up 
with a policy for external actions. I ended up picking up the 
project, after working with actions extensively for my own 
projects and the dlang org, and my PR was finally merged 
yesterday (https://github.com/actions/starter-workflows/pull/546).


Starter workflow are suggested to you when you go to the 
`Actions` tab of a Github repository, or when you first make one. 
They are templates you can use to easily set-up a CI. Thanks to 
the work of Mihails Strasuns (@Dicebot) we have an action to 
install the compiler on all three platforms 
(https://github.com/dlang-community/setup-dlang), which this 
workflow use.


This is how it looks:
https://pbs.twimg.com/media/Ef58CrdU0AA2R7W?format=jpg&name=4096x4096

Using actions have several benefits over Travis:
- Very easy to set up cross platform (Linux, Mac, Windows);
- Usually faster machines;
- Better integrated with Github;

One major downside is that you can't re-triggger a single matrix 
row in a workflow, hence if your CI is flakey, you're going to 
have a bad time.


Another great thing that is easy to setup with actions is 
automatically upload documentation. You can see an example here: 
https://github.com/bpfkorea/agora/blob/08a628ab8e7e38738a88f4c72dc0b42d43da185c/.github/workflows/main.yml#L125-L187
I hope to extract it to an action at some point so anyone can set 
it up with a single click.


Re: Translations of GLFW and libsoundio for Windows and Linux

2020-08-20 Thread aberba via Digitalmars-d-announce

On Thursday, 20 August 2020 at 12:50:26 UTC, Dennis wrote:
If you are making a D application with graphics or sound, you 
might be interested in these:


[...]



Awesome! Thanks for doing this.


Re: Article: The surprising thing you can do in the D programming language

2020-08-20 Thread aberba via Digitalmars-d-announce

On Thursday, 20 August 2020 at 11:22:53 UTC, MrSmith wrote:

On Thursday, 20 August 2020 at 10:12:22 UTC, aberba wrote:

Wrote something on OpenSource.com

https://opensource.com/article/20/8/nesting-d


The only nitpick, is that nested functions need to be declared 
before use, in order to compile.


You're right. Missed that. Copy-pasting and using D and 
JavaScript at the same time.


I've notified that editors, it'll hopefully be corrected soon.


Re: Article: The surprising thing you can do in the D programming language

2020-08-20 Thread H. S. Teoh via Digitalmars-d-announce
On Thu, Aug 20, 2020 at 10:20:59AM +, user1234 via Digitalmars-d-announce 
wrote:
> On Thursday, 20 August 2020 at 10:12:22 UTC, aberba wrote:
> > Wrote something on OpenSource.com
> > 
> > https://opensource.com/article/20/8/nesting-d
> 
> I'm not sure. A few notes on nesting.
> 
> 1. context pointer can prevent inlining. you can nest static funcs,
> but then what is the point

The point is not to pollute module namespace with implementation details
that are only relevant to that one function.

Also, if you're worried about inlining, use LDC instead of DMD. LDC is
well able to inline nested functions.  Don't make judgments based on the
DMD backend; it's well-known that its optimizer is ... sub-optimal...


> 2. bad complexity. you can make the nested funcs static and factor
> them out.  The code is more readable.
[...]

The point is not to pollute module namespace with functions that are
only relevant as implementation details of one function.


T

-- 
First Rule of History: History doesn't repeat itself -- historians merely 
repeat each other.


Translations of GLFW and libsoundio for Windows and Linux

2020-08-20 Thread Dennis via Digitalmars-d-announce
If you are making a D application with graphics or sound, you 
might be interested in these:


https://code.dlang.org/packages/glfw-d
https://code.dlang.org/packages/libsoundio-d

They are (partial) translations of their respective C libraries.

GLFW is a cross-platform library for creating a window with 
OpenGL context, and reading input from the keyboard, mouse and 
controllers. libsoundio is a cross-platform library for recording 
(from a microphone) and playing (on speakers / headphones) audio 
in real-time.


I did not translate their macOS targets since I don't have a mac, 
but you can still use the C sources to compile for those targets.


The goal of the translations is to make the libraries easier to 
build: you only need to add the package to your `dub.json` or 
`dub.sdl`, and everything should work out of the box. No need to 
include a shared library and load it at runtime, or pre-compile 
the C library for each build setting.


If you are working on a D project using these C libraries, I'd 
appreciate it if you help test the translation! Simply add the D 
package, remove the linkage with the C library and open an issue 
if you encounter any trouble, such as:

- a compile error
- a linker error
- a run-time bug that wasn't there in the C library



Re: Article: The surprising thing you can do in the D programming language

2020-08-20 Thread MrSmith via Digitalmars-d-announce

On Thursday, 20 August 2020 at 10:12:22 UTC, aberba wrote:

Wrote something on OpenSource.com

https://opensource.com/article/20/8/nesting-d


The only nitpick, is that nested functions need to be declared 
before use, in order to compile.


Re: MetaCall Polyglot is now available form D

2020-08-20 Thread Vicente Eduardo Ferrer Garcia via Digitalmars-d-announce

On Friday, 14 August 2020 at 08:04:54 UTC, WebFreak001 wrote:

On Friday, 14 August 2020 at 07:59:23 UTC, Andrea Fontana wrote:
On Tuesday, 4 August 2020 at 22:25:19 UTC, Vicente Eduardo 
Ferrer Garcia wrote:

[...]
If someone is interested in the D port you can find the 
source here: https://github.com/metacall/dlang-port



Nice! Maybe you can use a bit of syntax sugar for D. Check 
this example:

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

Andrea


here is some alternative syntactic sugar with opDispatch: 
https://run.dlang.io/is/cdcLux


This approach seems pretty clean. I like it.

I have created a new issue for it: 
https://github.com/metacall/dlang-port/issues/1


Any contribution is welcome. Thanks for sharing.


Re: Article: The surprising thing you can do in the D programming language

2020-08-20 Thread Martin Tschierschke via Digitalmars-d-announce

On Thursday, 20 August 2020 at 10:12:22 UTC, aberba wrote:

Wrote something on OpenSource.com

https://opensource.com/article/20/8/nesting-d


Nice article! +1 up-vote!


Re: Article: The surprising thing you can do in the D programming language

2020-08-20 Thread user1234 via Digitalmars-d-announce

On Thursday, 20 August 2020 at 10:12:22 UTC, aberba wrote:

Wrote something on OpenSource.com

https://opensource.com/article/20/8/nesting-d


I'm not sure. A few notes on nesting.

1. context pointer can prevent inlining. you can nest static 
funcs, but then what is the point
2. bad complexity. you can make the nested funcs static and 
factor them out. The code is more readable.
3. lambda. If you want to nest lambda are better. Solves point 2 
but not point 1.


But otherwie still nice to see a bit of D promotion here and 
there ;)


Article: The surprising thing you can do in the D programming language

2020-08-20 Thread aberba via Digitalmars-d-announce

Wrote something on OpenSource.com

https://opensource.com/article/20/8/nesting-d