Re: Why in Phobos is empty() sometimes const and sometimes not

2019-07-29 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, July 29, 2019 3:11:45 PM MDT Matt via Digitalmars-d-learn wrote: > On Monday, 29 July 2019 at 19:38:34 UTC, Jonathan M Davis wrote: > > On Monday, July 29, 2019 11:32:58 AM MDT Matt via > > Digitalmars-d-learn wrote: > > > > > > > > Because const ranges are basically useless, there

Re: Building GDC with auto-generated header files

2019-07-29 Thread rikki cattermole via Digitalmars-d-learn
On 30/07/2019 4:11 AM, Eduard Staniloiu wrote: Cheers, everybody I'm working on this as part of my GSoC project [0]. I'm working on building gdc with the auto-generated `frontend.h` [1], but I'm having some issues There are functions in dmd that don't have an `extern (C)` or `extern (C++)`

Re: How do I display unicode characters in D on standard (english) Windows 10 console window?

2019-07-29 Thread kinke via Digitalmars-d-learn
On Monday, 29 July 2019 at 22:17:55 UTC, WhatMeWorry wrote: What am I missing? Switching the console code page to UTF-8, and then restoring the original one before termination. See

How do I display unicode characters in D on standard (english) Windows 10 console window?

2019-07-29 Thread WhatMeWorry via Digitalmars-d-learn
This is a very stupid question but from Ali's book, I took this segment: writeln("Résumé preparation: 10.25€"); writeln("\x52\sum\u00e9 preparation: 10.25\"); and after running it all I get is the following: R├⌐sum├⌐ preparation: 10.25Γé¼ R├⌐sum├⌐ preparation: 10.25Γé¼ I was expecting

Re: Why in Phobos is empty() sometimes const and sometimes not

2019-07-29 Thread Matt via Digitalmars-d-learn
On Monday, 29 July 2019 at 19:38:34 UTC, Jonathan M Davis wrote: On Monday, July 29, 2019 11:32:58 AM MDT Matt via Digitalmars-d-learn wrote: Because const ranges are basically useless, there really isn't much point in putting const on any range functions even if it would work for that

Re: Why in Phobos is empty() sometimes const and sometimes not

2019-07-29 Thread ag0aep6g via Digitalmars-d-learn
On 29.07.19 21:35, H. S. Teoh wrote: Generally, the idiom is to let the compiler do attribute inference by templatizing your code and not writing any explicit attributes, then use unittests to ensure that instantiations of the range that ought to have certain attributes actually have those

Re: Why in Phobos is empty() sometimes const and sometimes not

2019-07-29 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, July 29, 2019 1:35:18 PM MDT H. S. Teoh via Digitalmars-d-learn wrote: > Generally, the idiom is to let the compiler do attribute inference by > templatizing your code and not writing any explicit attributes, then use > unittests to ensure that instantiations of the range that ought to

Re: Why in Phobos is empty() sometimes const and sometimes not

2019-07-29 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, July 29, 2019 11:32:58 AM MDT Matt via Digitalmars-d-learn wrote: > I've noticed that for some ranges in Phobos empty is marked const > (e.g. iota) but for other ranges (e.g. multiwayMerge) it is not > const. Is there a reason why? Isn't empty guaranteed not to alter > the data of the

Re: Why in Phobos is empty() sometimes const and sometimes not

2019-07-29 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jul 29, 2019 at 05:32:58PM +, Matt via Digitalmars-d-learn wrote: > I've noticed that for some ranges in Phobos empty is marked const > (e.g. iota) but for other ranges (e.g. multiwayMerge) it is not > const. Is there a reason why? Isn't empty guaranteed not to alter the > data of the

Re: Why in Phobos is empty() sometimes const and sometimes not

2019-07-29 Thread Eduard Staniloiu via Digitalmars-d-learn
On Monday, 29 July 2019 at 17:32:58 UTC, Matt wrote: I've noticed that for some ranges in Phobos empty is marked const (e.g. iota) but for other ranges (e.g. multiwayMerge) it is not const. Is there a reason why? Isn't empty guaranteed not to alter the data of the range and so should be const?

Why in Phobos is empty() sometimes const and sometimes not

2019-07-29 Thread Matt via Digitalmars-d-learn
I've noticed that for some ranges in Phobos empty is marked const (e.g. iota) but for other ranges (e.g. multiwayMerge) it is not const. Is there a reason why? Isn't empty guaranteed not to alter the data of the range and so should be const? This is causing me considerable headaches as I try

Building GDC with auto-generated header files

2019-07-29 Thread Eduard Staniloiu via Digitalmars-d-learn
Cheers, everybody I'm working on this as part of my GSoC project [0]. I'm working on building gdc with the auto-generated `frontend.h` [1], but I'm having some issues There are functions in dmd that don't have an `extern (C)` or `extern (C++)` but they are used by gdc (are exposed in `.h`

Re: Question on Password Encryption, using stdlib or third party lib

2019-07-29 Thread 0xFFFFFFFF via Digitalmars-d-learn
On Monday, 29 July 2019 at 14:37:54 UTC, 0x wrote: On a project I was asked to a- Compute SHA-256 of a password b- Do a BigInteger, convert to Hex String c- Encrypt the key using a public key with the following parameters Entropy: I'm given some numbers Modulus: also given long

Re: There is anything like nodiscard attribute in D?

2019-07-29 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, July 29, 2019 8:23:43 AM MDT victoroak via Digitalmars-d-learn wrote: > I have an Expected/Result struct, but without an attribute > similar to nodiscard > (https://en.cppreference.com/w/cpp/language/attributes/nodiscard) > is not very useful. > > There is anything like that in D? If

Re: Question on Password Encryption, using stdlib or third party lib

2019-07-29 Thread Cym13 via Digitalmars-d-learn
On Monday, 29 July 2019 at 14:37:54 UTC, 0x wrote: On a project I was asked to a- Compute SHA-256 of a password b- Do a BigInteger, convert to Hex String c- Encrypt the key using a public key with the following parameters Entropy: I'm given some numbers Modulus: also given long

Question on Password Encryption, using stdlib or third party lib

2019-07-29 Thread 0xFFFFFFFF via Digitalmars-d-learn
On a project I was asked to a- Compute SHA-256 of a password b- Do a BigInteger, convert to Hex String c- Encrypt the key using a public key with the following parameters Entropy: I'm given some numbers Modulus: also given long numbers [encrypt using RSA algorithm] So far I'm familiar

There is anything like nodiscard attribute in D?

2019-07-29 Thread victoroak via Digitalmars-d-learn
I have an Expected/Result struct, but without an attribute similar to nodiscard (https://en.cppreference.com/w/cpp/language/attributes/nodiscard) is not very useful. There is anything like that in D? If not, there is any plan to add it?

Re: Calling / running / executing .d script from another .d script

2019-07-29 Thread Kagamin via Digitalmars-d-learn
On Sunday, 28 July 2019 at 12:56:12 UTC, BoQsc wrote: Right now, I'm thinking what is correct way to run another .d script from a .d script. Do you have any suggestions? You mean something like execute(["rdmd", "another.d"]); ?

Re: weird behave of Array?

2019-07-29 Thread FeepingCreature via Digitalmars-d-learn
On Monday, 29 July 2019 at 05:58:21 UTC, dmm wrote: So, d try to be smart, only make thing worse? D is behaving exactly as it should here. You simply have a wrong model of what an array is in D. In C++, an array owns its memory. In D, an array is a thin wrapper around GC managed memory. As

Re: weird behave of Array?

2019-07-29 Thread dmm via Digitalmars-d-learn
On Sunday, 28 July 2019 at 17:45:16 UTC, Adam D. Ruppe wrote: On Sunday, 28 July 2019 at 17:21:25 UTC, dmm wrote: test(str); The array is passed by value here, so changes to its ptr and length will not be seen outside the function. However, what goes *through* the pointer - which