Re: books for learning D

2020-01-13 Thread René Heldmaier via Digitalmars-d-learn

On Monday, 13 January 2020 at 10:28:48 UTC, mark wrote:

I'm just starting out learning D.

Andrei Alexandrescu's "The D Programming Language" is 10 years 
old, so is it still worth getting? (I don't know how much D has 
changed in 10 years.)


I found the book amazing. It not only explains the language, but 
also how things work behind the scenes. For a book on programming 
languages it's written in an entertaining style. It's also a joy 
to see how beautiful the design of D is, compared to languages 
like C++ or C#.


But...

The book is definitely not written for beginners. You should at 
least have a good understanding of C (Especially the concept of 
pointers). Even though the chapter on pointers is only 2 pages 
long, the word "pointer" occurs 155 times in the book (I made a 
quick search over my ebook version).


Re: Win32 Api: How create Open/"Save as" Dialog?

2020-01-10 Thread René Heldmaier via Digitalmars-d-learn

On Friday, 10 January 2020 at 14:48:49 UTC, Marcone wrote:
How create "Open" and "Save as" Dialog using "Win32 Api" and 
Dlang? Please send me a simple example code in Dlang. Thank you 
very much.


Have a look at this website: 
http://www.winprog.org/tutorial/app_two.html

It helped me a lot when i once made a simple gui in C.
The tutorial is in C, but Win32 Api is C anyway... Most of the 
examples will probably just compile in D.
Win32 Api is really ugly, i think it's a better investment to 
learn something like GtkD ;)


Re: matrix operations

2019-11-27 Thread René Heldmaier via Digitalmars-d-learn

On Wednesday, 27 November 2019 at 16:35:40 UTC, bachmeier wrote:

I do have all that for my own use. I've never bothered to turn 
it into something others could use because I love the garbage 
collector, but that's a turnoff for others. But I'm more than 
happy to share if you're really interested. I'm also working on 
an R -> D compiler, but it's not helpful at this point.


I would actually like it to be garbage collected, because i would 
use it for some
skripts instead of matlab. Matlab is really horrible, but if you 
want to do something quick, e.g. analyse sensor data, you have 
everything you need in an easy to use interface. I think D could 
really shine in this area...


It wouldn't take much to create a simple wrapper over 
mir/lubeck to do operator overloading. This is low-hanging 
fruit for someone that wants to contribute to the language. 
Until I win the lottery, I won't have time to do it myself.


Yeah, i thought about that also... Is there any good article 
about mir/ndslice beside the documentation? I mean something more 
abstract, like a general overview.




matrix operations

2019-11-27 Thread René Heldmaier via Digitalmars-d-learn

Hi,

I'm looking for some basic matrix/vector operations and other 
numeric stuff.


I spent quite a lot time in reading through the mir 
documentation, but i kinda miss the bigger picture. I'm not a 
Python user btw. (I know C,C++,C#,Matlab..).


I have also looked at the documentation of the lubeck package.

What i have seen right now reminds me of the saying "Real 
programmers can write FORTRAN in any language".


Is there a type to do matrix operations with nice syntax (e.g. 
using * operator for multiplication)?


Re: Phobos License question

2019-11-16 Thread René Heldmaier via Digitalmars-d-learn
On Saturday, 16 November 2019 at 10:02:58 UTC, Ola Fosheim 
Grøstad wrote:


As a matter of courtesy I would have added a notice on the top 
of the file that says that function x, y, z was lifted from 
such and such library with a "see comments for details" notice.


I will add this comment at the top the file also:

/* The functions

   auto dual(R)(const R re),
   auto dual(R, D)(const R re, const D du),
   string toString() const,
   void toString(Writer, Char)(scope Writer w, scope const ref 
FormatSpec!Char formatSpec) const


   and the corresponding unittests are derived from phobos 
std.complex

   (github.com/dlang/phobos/blob/master/std/complex.d).
   See comments for more details
*/

Anyone who thinks i go to jail for this, please tell me now ;)


Re: Phobos License question

2019-11-16 Thread René Heldmaier via Digitalmars-d-learn
On Saturday, 16 November 2019 at 10:02:58 UTC, Ola Fosheim 
Grøstad wrote:
On Saturday, 16 November 2019 at 09:21:41 UTC, René Heldmaier 
wrote:


Thanks a lot for the lengthy reply ;). I live in Germany by the 
way...


statement "Copyright 2019, My Name" is incomplete though. It 
would be better to state "Copyright 2019, My Name and others 
(see individual files)".


I'll do that. Should i do it the same way for authors on module 
level? e.g

Authors: René Heldmaier and others (see individual files)

Just follow the license to the letter… Copy in the code you 
build on and modify it in place. You ought to be able to add 
your own code above or below it, just mark the boundaries with 
comments. You can also modify the code of course, then just add 
your name to the list of authors.


My plan is now to put this comment above each copied function:

/* The following function is derived from phobos std.complex 
https://github.com/dlang/phobos/blob/master/std/complex.d

   Authors: Lars Tandle Kyllingstad, Don Clugston
   Copyright:   Copyright (c) 2010, Lars T. Kyllingstad.
   License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 
1.0)

   Modified by: René Heldmaier
*/

You think that's ok?




Phobos License question

2019-11-16 Thread René Heldmaier via Digitalmars-d-learn

Hi,
I'm currently implementing a data type which is quite similar to 
complex numbers.
Because of the similarity, I could copy paste (with minor 
modifications) the toString methods and the helper functions from 
std.complex. The much bigger rest of it is my own work.

I would like to publish this under Boost License 1.0.

Do i have to list the authors of std.complex as authors of the 
module?
Or should i list the authors in the commentary above the copied 
functions?


What happens to copyright?
Can I publish it under "Copyright 2019, My Name" or do i have to 
use the copyright from std.complex?


I'm not a lawyer and i don't like to deal with this kind of stuff.
I just want that people are able to use it without implications


Re: Understand signature of opOpAssign in std/complex.d

2019-11-09 Thread René Heldmaier via Digitalmars-d-learn

On Saturday, 9 November 2019 at 13:26:12 UTC, Adam D. Ruppe wrote:
That's checking the if the template argument C is a case of 
Complex!R, while at the same time declaring a symbol R to hold 
the inner type.


I got it. Thank you very much ;)


Understand signature of opOpAssign in std/complex.d

2019-11-09 Thread René Heldmaier via Digitalmars-d-learn

Hi,
i'm currently implementing a dual number datatype. Dual numbers 
are very similar to complex numbers, but instead i (i^2 = -1) you 
have epsilon (epsilon^2 = 0).
This sounds strange but it is really useful for something called 
"automatic derivation". I will probably explain it in more detail 
when i'm ready to publish it as a dub package...


Because of the similarity to complex numbers i looked at how they 
are implemented in std/complex.d, to learn from how it is done 
there.


I came across a function signature which i don't understand:

ref Complex opOpAssign(string op, C)(const C z)
if ((op == "+" || op == "-") && is(C R == Complex!R))

The part i don't understand is "is(C R == Complex!R)".
What does that mean?