Re: isSame/TemplateOf bug?

2019-02-19 Thread Ali Çehreli via Digitalmars-d-learn
On 02/19/2019 03:21 PM, SrMordred wrote: > On Tuesday, 19 February 2019 at 23:03:37 UTC, Paul Backus wrote: >> Inside a templated struct, the name of the template, by itself, >> actually refers to the current instantiation. So when you write `Test` >> in your __traits(isSame) test, the compiler

Re: How to create a class-valued variable?

2019-02-19 Thread Benjamin Schaaf via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 22:04:58 UTC, Victor Porton wrote: What is the right way to store in a structure a class (not an instance) derived from a given interface(s)? What are you trying to do with the "class"? If you just want a static "reference" to it you can use an `alias`:

What is the impact of Tark wallet on global payments?

2019-02-19 Thread tongzhengshijie via Digitalmars-d-learn
In the new era of rapid economic development, people's pursuit of quality of life is constantly improving. More and more people are beginning to pay attention to their quality of life. How to live better is also the goal of happiness that people pursue. At a time of rapid change, many new

AXC——Grasp the change of token market pattern of 2019

2019-02-19 Thread tongzhengshijie via Digitalmars-d-learn
2017 is the most crazy year in the token market, and the price is so high that one coin is hard to get. However, such a good phenomenon has gradually declined in 2018 and even fluctuated and affected with the collapse of Bitcoin! At the same time, with the frequent problems of security

Re: Error with matplotlib

2019-02-19 Thread Samir via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 11:57:00 UTC, Andre Pany wrote: The python script generates a list of available functions in the python package. This list will be used to generate D coding at compilation time. That is the reason, the error occurs in a mixin. Unfortunately one function had the

Re: isSame/TemplateOf bug?

2019-02-19 Thread SrMordred via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 23:03:37 UTC, Paul Backus wrote: On Tuesday, 19 February 2019 at 22:43:25 UTC, SrMordred wrote: import std.traits; import std.stdio; struct Test(T) { this(T)( auto ref T value ) { writeln( TemplateOf!(typeof(value)).stringof);

Re: isSame/TemplateOf bug?

2019-02-19 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 22:43:25 UTC, SrMordred wrote: import std.traits; import std.stdio; struct Test(T) { this(T)( auto ref T value ) { writeln( TemplateOf!(typeof(value)).stringof); writeln( __traits(isSame, TemplateOf!(typeof(value)), Test) );

isSame/TemplateOf bug?

2019-02-19 Thread SrMordred via Digitalmars-d-learn
import std.traits; import std.stdio; struct Test(T) { this(T)( auto ref T value ) { writeln( TemplateOf!(typeof(value)).stringof); writeln( __traits(isSame, TemplateOf!(typeof(value)), Test) ); } } void main(){ auto value =

How to create a class-valued variable?

2019-02-19 Thread Victor Porton via Digitalmars-d-learn
What is the right way to store in a structure a class (not an instance) derived from a given interface(s)?

Re: Windows Defender won't let me install DMD

2019-02-19 Thread JN via Digitalmars-d-learn
On Monday, 18 February 2019 at 16:32:26 UTC, belkin wrote: Additional question as a beginner. What do I need to install to get started. Obviously I need a compiler (which one is best ). But I also want an IDE and so far it seems Visual D would be a best choice. Ideas? Visual D works well,

Re: Generators in D

2019-02-19 Thread Matthew_Blake via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 18:56:01 UTC, Paul Backus wrote: On Tuesday, 19 February 2019 at 18:37:22 UTC, Matthew_Blake wrote: Hi there, is the concept of generators (like in Python, using yield) available in D? If so, where can I find information? Regards Generally speaking, things

Re: Generators in D

2019-02-19 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 18:37:22 UTC, Matthew_Blake wrote: Hi there, is the concept of generators (like in Python, using yield) available in D? If so, where can I find information? Regards Generally speaking, things that are generators in Python are implemented as ranges [1] in D.

Re: Generators in D

2019-02-19 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 18:37:22 UTC, Matthew_Blake wrote: Hi there, is the concept of generators (like in Python, using yield) available in D? If so, where can I find information? Regards I do not know python well, but do you search for this one?

Generators in D

2019-02-19 Thread Matthew_Blake via Digitalmars-d-learn
Hi there, is the concept of generators (like in Python, using yield) available in D? If so, where can I find information? Regards

Re: How to convert `std.datetime.Duration` to seconds of floating point type?

2019-02-19 Thread drug via Digitalmars-d-learn
19.02.2019 19:55, Alex пишет: On Tuesday, 19 February 2019 at 16:44:23 UTC, drug wrote: On 19.02.2019 19:35, Alex wrote: On Tuesday, 19 February 2019 at 16:26:33 UTC, drug wrote: Well, I understand that using floating point values to represent time internally is a bad idea and I totally

Re: How to convert `std.datetime.Duration` to seconds of floating point type?

2019-02-19 Thread Alex via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 16:44:23 UTC, drug wrote: On 19.02.2019 19:35, Alex wrote: On Tuesday, 19 February 2019 at 16:26:33 UTC, drug wrote: Well, I understand that using floating point values to represent time internally is a bad idea and I totally agree. But some convenient API to

Re: How to convert `std.datetime.Duration` to seconds of floating point type?

2019-02-19 Thread drug via Digitalmars-d-learn
On 19.02.2019 19:35, Alex wrote: On Tuesday, 19 February 2019 at 16:26:33 UTC, drug wrote: Well, I understand that using floating point values to represent time internally is a bad idea and I totally agree. But some convenient API to convert Duration to floating point and vice versa would be

Re: Best practices of using const

2019-02-19 Thread drug via Digitalmars-d-learn
On 19.02.2019 19:19, Kagamin wrote: On Tuesday, 19 February 2019 at 15:30:22 UTC, Atila Neves wrote: I keep hearing how const is nigh unusable in D, and except for ranges I litter my code with const everywhere, pretty much just as often as I used in C++. I once spent a good amount of effort

Re: How to convert `std.datetime.Duration` to seconds of floating point type?

2019-02-19 Thread Alex via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 16:26:33 UTC, drug wrote: Well, I understand that using floating point values to represent time internally is a bad idea and I totally agree. But some convenient API to convert Duration to floating point and vice versa would be useful because in mechanics for

Re: How to convert `std.datetime.Duration` to seconds of floating point type?

2019-02-19 Thread drug via Digitalmars-d-learn
On 19.02.2019 18:07, Dennis wrote: On Tuesday, 19 February 2019 at 14:34:09 UTC, drug wrote: Now I do it this way (https://run.dlang.io/is/8kVibT): ``` auto some_duration = dur!"msecs"(500); auto seconds = some_duration.total!"hnsecs" / 10_000_000.0;

Re: Best practices of using const

2019-02-19 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 15:30:22 UTC, Atila Neves wrote: I keep hearing how const is nigh unusable in D, and except for ranges I litter my code with const everywhere, pretty much just as often as I used in C++. I once spent a good amount of effort to annotate my code with pure and

Re: Best practices of using const

2019-02-19 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 13 February 2019 at 16:40:18 UTC, H. S. Teoh wrote: On Wed, Feb 13, 2019 at 11:32:46AM +, envoid via Digitalmars-d-learn wrote: [...] Const in D is very restrictive because it's supposed to provide real compiler guarantees, i.e., it's statically verifiable that the data

Re: How to convert `std.datetime.Duration` to seconds of floating point type?

2019-02-19 Thread Dennis via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 14:34:09 UTC, drug wrote: Now I do it this way (https://run.dlang.io/is/8kVibT): ``` auto some_duration = dur!"msecs"(500); auto seconds = some_duration.total!"hnsecs" / 10_000_000.0; assert(seconds.approxEqual(0.5)); ``` is there better

How to convert `std.datetime.Duration` to seconds of floating point type?

2019-02-19 Thread drug via Digitalmars-d-learn
Now I do it this way (https://run.dlang.io/is/8kVibT): ``` auto some_duration = dur!"msecs"(500); auto seconds = some_duration.total!"hnsecs" / 10_000_000.0; assert(seconds.approxEqual(0.5)); ``` is there better way to do it? Thanks in advance

Re: When to prefer formatValue over formattedWrite?

2019-02-19 Thread Per Nordlöw via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 11:40:09 UTC, Per Nordlöw wrote: Is `formatValue` more lightweight to the compiler? I already posted a very similar question at https://forum.dlang.org/post/xsovipkjyjyumtyzm...@forum.dlang.org but in this thread I'm interested in knowing if is there is any

Re: Error with matplotlib

2019-02-19 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 00:05:46 UTC, Samir wrote: On Monday, 18 February 2019 at 21:50:25 UTC, Andre Pany wrote: In the meantime you could adapt the python script on your local file system in the dub packages cache folder as described here

When to prefer formatValue over formattedWrite?

2019-02-19 Thread Per Nordlöw via Digitalmars-d-learn
Is `formatValue` also preferred over `formattedWrite` when writing a single value? Code example: import std.array : appender; auto writer1 = appender!string(); writer1.formattedWrite("%08b", 42); auto writer2 = appender!string(); auto f = singleSpec("%08b"); writer2.formatValue(42, f); Is

Re: Windows Defender won't let me install DMD

2019-02-19 Thread belkin via Digitalmars-d-learn
On Monday, 18 February 2019 at 19:34:31 UTC, Seb wrote: On Monday, 18 February 2019 at 16:32:26 UTC, belkin wrote: I am trying to install the compiler and get started on learning D again ( attempted and stopped way back ) This is the error message I am getting. I am on Windows 10. Windows