Re: why is "hello".writeln considered bad?

2020-11-20 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Nov 20, 2020 at 8:55 AM Mike Parker via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > ... > Eh, I wouldn't quite put it that way. If we're thinking of the > same thread, one person said he thought it was a bad idea. That > doesn't make it bad practice. It's just his

Re: Task when used on a function that takes parameters doesnt work.

2020-11-12 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Nov 12, 2020 at 4:12 PM Daniel Kozak wrote: > On Thu, Nov 12, 2020 at 4:05 PM Ruby The Roobster via Digitalmars-d-learn < > digitalmars-d-learn@puremagic.com> wrote: > >> Here is a test that I did: >> >> void func(int i) >> { >> Thread.sleep(i.seconds); >> } >> void main() { >> auto test

Re: Task when used on a function that takes parameters doesnt work.

2020-11-12 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Nov 12, 2020 at 4:05 PM Ruby The Roobster via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Here is a test that I did: > > void func(int i) > { > Thread.sleep(i.seconds); > } > void main() { > auto test = Task!func(3); > test.executeInNewThread(); > test.yeildForce();

Re: How to get address of a nested function?

2020-11-10 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Nov 10, 2020 at 11:55 AM Max Samukha via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > We can get the compile time equivalent of a member function's > address by applying '&' to the function in a static context: > > struct S { > void foo() {} > } > > enum pfoo =

Re: How to get address of a nested function?

2020-11-10 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Nov 10, 2020 at 8:50 PM Max Samukha via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Tuesday, 10 November 2020 at 14:36:04 UTC, Steven > Schveighoffer wrote: > > >> > >> Is there a way to get a pointer to a non-static nested > >> function? > > > > I don't think you

Re: std.net.curl : Performance

2020-11-09 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Nov 9, 2020 at 9:50 PM rinfz via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Monday, 9 November 2020 at 20:40:59 UTC, rinfz wrote: > > On Monday, 9 November 2020 at 19:55:07 UTC, Vino wrote: > >> ... > > > > The only curl option you need to set within the loop is

Re: std.net.curl : Performance

2020-11-09 Thread Daniel Kozak via Digitalmars-d-learn
Just delete it On Mon, Nov 9, 2020 at 9:00 PM Vino via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Hi All, > >Request your help to on how to improve the performance of the > below code. > > import std.conv: to; > import std.net.curl : get, HTTP, CurlOption; > import

Re: What is the difference between enum and shared immutable?

2020-10-30 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Oct 29, 2020 at 4:13 PM H. S. Teoh via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > > But why can't that be treated differently from explicitly writing @safe > on a declaration? I mean, yeah, it's easier to implement the compiler > that way, but ease of

Re: Why was new(size_t s) { } deprecated in favor of an external allocator?

2020-10-15 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, Oct 14, 2020 at 10:30 PM Jack via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > What was the reasoning behind this decision? > https://dlang.org/deprecate.html#Class allocators and deallocators

Re: question on dub and postgresql

2020-10-05 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Oct 5, 2020 at 10:25 AM Alaindevos via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Can I say python has pip, ruby has bundle and D has dub. > Meaning they perform the same function ? > Or am I wrong? > Yes and no. Dub is Dlang dependency solution but it is not

Re: Whats going on with this?

2020-10-03 Thread Daniel Kozak via Digitalmars-d-learn
On Sat, Oct 3, 2020 at 11:30 PM Steven Schveighoffer via Digitalmars-d-learn wrote: > > > "StructMemberInitializers with the NonVoidInitializer syntax appear in > the lexical order of the fields in the StructDeclaration" seems to > suggest it will not call the constructor, but instead initialize

Re: Whats going on with this?

2020-10-03 Thread Daniel Kozak via Digitalmars-d-learn
On Sat, Oct 3, 2020 at 10:40 PM Daniel Kozak wrote: > I would say it is here you just need to read it carefully: > > https://dlang.org/spec/struct.html#static_struct_init > > For case specification is change I will paste it here: ''' If a StructInitializer is supplied, the fields are initialized

Re: Whats going on with this?

2020-10-03 Thread Daniel Kozak via Digitalmars-d-learn
On Sat, Oct 3, 2020 at 4:45 PM Steven Schveighoffer via Digitalmars-d-learn wrote: > On 10/3/20 6:52 AM, claptrap wrote: > > On Saturday, 3 October 2020 at 00:15:02 UTC, Steven Schveighoffer wrote: > >> On 10/2/20 7:28 PM, claptrap wrote: > >> > >>> Why would putting in the writeln cause it to

Re: vibe.de multiple ports.

2020-09-30 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, Sep 30, 2020 at 2:40 PM seany via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Wednesday, 30 September 2020 at 12:29:06 UTC, Daniel Kozak > wrote: > > to separate the messages from the IoT responses quickly and > forward them to different programs, and to have the

Re: vibe.de multiple ports.

2020-09-30 Thread Daniel Kozak via Digitalmars-d-learn
Dne st 30. 9. 2020 13:25 uživatel seany via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> napsal: > Hello > > I am trying to use this example for a iot application: > https://aberba.com/2018/using-vibe-d-web-interface/ > > The code i use is: > > ushort port = 5504;

Re: Why private methods cant be virtual?

2020-09-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Sep 22, 2020 at 3:05 PM claptrap via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > > The thread title is... > > "Why private methods cant be virtual?" > > IE Not... > > "how do I override private functions in a non-polymorphic manner." > > And what you suggest wont

Re: Why private methods cant be virtual?

2020-09-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Sep 22, 2020 at 1:30 PM ShadoLight via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > > > This is not really "overriding", it is more akin to "overloading" > No it is not overloading, overloading is when you have more methods with same name and differents params. It

Re: Why private methods cant be virtual?

2020-09-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Sep 22, 2020 at 11:06 AM claptrap via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > > "Functions marked as final may not be overridden in a derived > class, unless they are also private" > > So final private functions can be overriden? It seems not, but > the sentence

Re: Why private methods cant be virtual?

2020-09-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Sep 22, 2020 at 12:23 PM Daniel Kozak wrote: > ... > void main(string[] args) > { > B b = new B; > b.overrideFun; > } > You can have A and B in one module too of course

Re: Why does compose from std.functional return a templated function

2020-09-16 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, Sep 16, 2020 at 12:50 PM Daniel Kozak wrote: > > > On Wed, Sep 16, 2020 at 12:00 PM Jan Hönig via Digitalmars-d-learn < > digitalmars-d-learn@puremagic.com> wrote: > >> ... >> >> My main question is why? Is there something, which I am missing, >> that explains, why it is beneficial to

Re: Why does compose from std.functional return a templated function

2020-09-16 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, Sep 16, 2020 at 12:00 PM Jan Hönig via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > ... > > My main question is why? Is there something, which I am missing, > that explains, why it is beneficial to return a templated > function? > > (maybe, because I might want to

Re: Vibe-D File Question

2020-09-11 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Sep 11, 2020 at 1:15 PM Daniel Kozak wrote: > On Fri, Sep 11, 2020 at 1:10 PM Selim Ozel via Digitalmars-d-learn < > digitalmars-d-learn@puremagic.com> wrote: > >> It seems like rejected-software forum is flooded with spam, so I >> decided to ask it here. Is there a way to generate a

Re: Vibe-D File Question

2020-09-11 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Sep 11, 2020 at 1:10 PM Selim Ozel via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > It seems like rejected-software forum is flooded with spam, so I > decided to ask it here. Is there a way to generate a file -csv > for example- on the back-end and serve it to the

Re: vibe.d and my first web service

2020-08-12 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, Aug 12, 2020 at 3:51 PM James Blachly via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Unfortunately the problem still occurs with Vibe.d 0.9.0 > > IMO **this is the single most important problem to fix** for vibe.d -- > if the most basic of examples (indeed, supplied

Re: LDC cross-module-inlining

2020-08-10 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Aug 10, 2020 at 1:15 PM Per Nordlöw via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Monday, 10 August 2020 at 05:54:14 UTC, Daniel Kozak wrote: > > I am not sure but last time I checked ldc does not do cross > > module inlinig by default, and LTO only help if your

Re: LDC cross-module-inlining

2020-08-09 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Aug 10, 2020 at 12:50 AM claptrap via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Sunday, 9 August 2020 at 22:18:13 UTC, Per Nordlöw wrote: > > ... > If you enable link time optimisation you get cross module > inlining, > > -flto=full > > I'm not 100% sure but I

Re: LDC cross-module-inlining

2020-08-09 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Aug 10, 2020 at 12:20 AM Per Nordlöw via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > > Is cross-module-inlining enabled by default in LDC when compiling > in release mode or do I have to use explicitly flag for it? I > can't find any such flag from the output of

Re: vibe / CTRL+C not terminating server

2020-06-13 Thread Daniel Kozak via Digitalmars-d-learn
On Sat, Jun 13, 2020 at 9:20 PM Robert M. Münch via Digitalmars-d-learn wrote: > > After a CTRL+C I still have the server process running on OSX. Any idea? > > [main() INF] Listening for requests on http://[::1]:8080/ > [main() INF] Listening for requests on http://127.0.0.1:8080/ >

Re: Using Vibe.d for not HTTP

2020-05-25 Thread Daniel Kozak via Digitalmars-d-learn
On Sun, May 24, 2020 at 10:10 AM Russel Winder via Digitalmars-d-learn wrote: > > Hi, > > Clearly Vibe.d is mostly for people doing HTTP and HTTPS stuff. Yet it claims > to be able to support TCP and UDP working with other protocols. However, all > the serious examples are HTTP/HTTPS related. All

Re: Learning Vibe.d

2020-05-25 Thread Daniel Kozak via Digitalmars-d-learn
On Sun, May 24, 2020 at 10:06 AM Russel Winder via Digitalmars-d-learn wrote: > > For my purposes switching to using SIGKILL rather than SIGTERM in my tests > seems to work with 1.9.1, so I'll go with that till 1.9.2 or 1.10.0 produces a > fix rather than revert to 1.8.1. > You can use

Re: gzip and vibe.d

2020-05-20 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, May 20, 2020 at 9:45 AM Atwork via Digitalmars-d-learn wrote: > > Is it possible to have vibe.d gzip responses? > > I cannot find anything in the documentation about it. > > I am not talking about gzipping ex. files/streams but ALL > responses as a whole. > > Is there a configuration or

Re: gzip and vibe.d

2020-05-20 Thread Daniel Kozak via Digitalmars-d-learn
https://vibed.org/api/vibe.http.server/HTTPServerSettings.useCompressionIfPossible On Wed, May 20, 2020 at 9:45 AM Atwork via Digitalmars-d-learn wrote: > > Is it possible to have vibe.d gzip responses? > > I cannot find anything in the documentation about it. > > I am not talking about gzipping

Re: D and Async I/O

2020-05-11 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, May 11, 2020 at 4:03 PM Russel Winder via Digitalmars-d-learn wrote: > > ... > I notice that Hunt uses it's own library eschewing all of Phobos. Is this an > indicator that Phobos is not suitable for networking activity? Vibe-d do that too, But https://code.dlang.org/packages/async use

Re: Rust, D, GTK+, and asynchronous working

2020-04-27 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Apr 27, 2020 at 11:56 AM Russel Winder via Digitalmars-d-learn wrote: > > Hi, > > Background: I chose to rewrite a Python/PySide2/Qt application in > X/GTK+. After much dithering I was pushed to Rust/gtk-rs/GTK+ and set > to it. Then I decided to do D/GtkD/GTK+ as well. > > Totally

Re: Using LDC2 on ARM

2020-03-02 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Mar 2, 2020 at 6:50 PM Severin Teona via Digitalmars-d-learn wrote: > > Hello, > > I am working on a project that uses a Raspberry Pi (armv7l) and > the latest LDC version I found for this architecture is 1.13.0. > Can you help me install the latest version(1.20.0)? > > Also, I'm having

Re: Using LDC2 on ARM

2020-03-02 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Mar 2, 2020 at 7:40 PM Daniel Kozak wrote: > > On Mon, Mar 2, 2020 at 6:50 PM Severin Teona via Digitalmars-d-learn > Do you really need to build you app on arm, could not you use crosscompiling? https://wiki.dlang.org/Cross-compiling_with_LDC

Re: Using LDC2 on ARM

2020-03-02 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Mar 2, 2020 at 7:40 PM Daniel Kozak wrote: > > On Mon, Mar 2, 2020 at 6:50 PM Severin Teona via Digitalmars-d-learn > wrote: > > > > Hello, > > > > I am working on a project that uses a Raspberry Pi (armv7l) and > > the latest LDC version I found for this architecture is 1.13.0. > > Can

Re: GtkD on Windows: notes + question

2020-02-09 Thread Daniel Kozak via Digitalmars-d-learn
"lflags-windows": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], On Sun, Feb 9, 2020 at 2:30 PM mark via Digitalmars-d-learn wrote: > > I found a much easier way to get GtkD working on windows than > that described in > https://gtkdcoding.com/2019/01/11/-introduction-to-gtkDcoding.html > >

Re: ints.choice vs. chars.choice

2019-11-18 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Nov 18, 2019 at 7:25 PM Steven Schveighoffer via Digitalmars-d-learn wrote: > > > You could also use cast(dchar[]), and avoid the cast back to char. > > -Steve or use byCodeUnit writeln(['a', 'b', 'c'].byCodeUnit.choice);

Re: Alias sleep(int) for Thread.sleep(dur!("seconds")( int ));

2019-11-12 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Nov 12, 2019 at 11:50 PM Marcone via Digitalmars-d-learn wrote: > > > Can you make Alias for: > task!func().executeInNewThread(); > > Thank you! AFAIK that is not possible without some wrapper because executeInNewThread is member function of Task so it will need this reference for object

Re: Alias sleep(int) for Thread.sleep(dur!("seconds")( int ));

2019-11-12 Thread Daniel Kozak via Digitalmars-d-learn
On Tuesday, 12 November 2019 at 21:24:54 UTC, Marcone wrote: I am using this function to sleep, but I want a simple Alias. How can I alias this? // Function sleep(int) void sleep(int seconds){ Thread.sleep(dur!("seconds")( seconds )); } sleep(1); // Using function. You can do this:

Re: Hum humm, build latest release with ldc

2019-11-04 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Nov 4, 2019 at 10:45 AM Treebeard via Digitalmars-d-learn wrote: > > Hoom, hum, can you tell me some nice instructions to compile the > latest release of DMD using LDC? > > I walk slowly, but I love fast compilers. > > --- > But I spoke hastily. We must not be hasty. I have become too

Re: Accuracy of floating point calculations

2019-10-29 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 29, 2019 at 5:09 PM Daniel Kozak wrote: > > On Tue, Oct 29, 2019 at 4:45 PM Twilight via Digitalmars-d-learn > wrote: > > > > D calculation: > >mport std.stdio; import std.math : pow; import core.stdc.math; void main() { writefln("%12.3F",log(1-0.)/log(1-(1-0.6)^^20)); } >

Re: Accuracy of floating point calculations

2019-10-29 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 29, 2019 at 5:09 PM Daniel Kozak wrote: > > > If you use gdc or ldc you will get same results as c++, or you can use > C log directly: > > import std.stdio; > import std.math : pow; > import core.stdc.math; > > void main() > { >

Re: Accuracy of floating point calculations

2019-10-29 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 29, 2019 at 4:45 PM Twilight via Digitalmars-d-learn wrote: > > D calculation: > >writefln("%12.2F",log(1-0.)/log(1-(1-0.6)^^20)); > > 837675572.38 > > C++ calculation: > >cout< <<'\n'; > > 837675573.587 > > As a second data point, changing 0. to 0.75 yields >

Re: Running unittests of a module with -betterC

2019-10-28 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Oct 28, 2019 at 9:40 AM Per Nordlöw via Digitalmars-d-learn wrote: > > Is it possible to run the unittests of a module with -betterC like > > dmd -D -g -main -unittest -betterC f.d > > ? > > This currently errors as > > /usr/include/dmd/druntime/import/core/internal/entrypoint.d:34:

Re: Converting a ulong to a byte array and constructing a ulong from it

2019-10-24 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Oct 24, 2019 at 3:35 PM 9898287 via Digitalmars-d-learn wrote: > > What's the function for converting a ulong to a native-endian > byte array? > For example, > > auto bytes = 0x1234567890123456u64.to_ne_bytes(); > // should yield > // [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56] in

Re: Differences between two dates (in days...)

2019-10-24 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Oct 24, 2019 at 1:55 PM Mil58 via Digitalmars-d-learn wrote: > > Hi All... > I am desperate for the answer to the following problem: > to obtain the difference between the date of today and an older > date (results in days...) > > See my script below, where I would like to do: > "date of

Re: How to use classes from another d files

2019-10-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 22, 2019 at 8:30 PM Vinod K Chandran via Digitalmars-d-learn wrote: > > On Tuesday, 22 October 2019 at 17:38:58 UTC, Adam D. Ruppe wrote: > > On Tuesday, 22 October 2019 at 17:34:51 UTC, Vinod K Chandran > > wrote: > >> Hi all, > >> I am new to D. But some fair experience with vb.net.

Re: undefined symbol: _D3std7variant...

2019-10-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 22, 2019 at 2:20 PM Andrey via Digitalmars-d-learn wrote: > > Hello, > During compilation on linking stage I get strange errors (LDC): > lld-link: error: undefined symbol: >

Re: D for sciencetific scripting / rapid protoryping

2019-10-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 22, 2019 at 10:25 AM Prokop Hapala via Digitalmars-d-learn wrote: > > ... > > Also where is RDMD in the equation? I really like the idea run > binary programs like: > > #!/usr/bin/env rdmd > import std.stdio; > void main(){ > writeln("Hello, world!"); > } > > But I cannot find

Re: D for sciencetific scripting / rapid protoryping

2019-10-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 22, 2019 at 8:00 AM Prokop Hapala via Digitalmars-d-learn wrote: > > I'm examining the possibility to move from Python+C/C++ to D or > Python+D. I read > (https://wiki.dlang.org/Programming_in_D_for_Python_Programmers) > and > (https://jackstouffer.com/blog/nd_slice.html), where is

Re: How can I make a program which uses all cores and 100% of cpu power?

2019-10-10 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Oct 11, 2019 at 6:58 AM Daniel Kozak wrote: > > so can stress your CPU. can't

Re: How can I make a program which uses all cores and 100% of cpu power?

2019-10-10 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Oct 11, 2019 at 2:45 AM Murilo via Digitalmars-d-learn wrote: > > I have started working with neural networks and for that I need a > lot of computing power but the programs I make only use around > 30% of the cpu, or at least that is what Task Manager tells me. > How can I make it use

Re: D man pages

2019-10-10 Thread Daniel Kozak via Digitalmars-d-learn
On Thursday, 10 October 2019 at 19:26:36 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 at 19:25:22 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 at 19:21:06 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 at 19:19:42 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019

Re: D man pages

2019-10-10 Thread Daniel Kozak via Digitalmars-d-learn
On Thursday, 10 October 2019 at 19:21:06 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 at 19:19:42 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 at 18:52:32 UTC, Jarek wrote: On Monday, 23 September 2019 at 12:31:16 UTC, Adam D. Ruppe wrote: [...] Hello, thanks for reply.

Re: D man pages

2019-10-10 Thread Daniel Kozak via Digitalmars-d-learn
On Thursday, 10 October 2019 at 19:25:22 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 at 19:21:06 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 at 19:19:42 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 at 18:52:32 UTC, Jarek wrote: On Monday, 23 September 2019 at

Re: D man pages

2019-10-10 Thread Daniel Kozak via Digitalmars-d-learn
On Thursday, 10 October 2019 at 19:19:42 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 at 18:52:32 UTC, Jarek wrote: On Monday, 23 September 2019 at 12:31:16 UTC, Adam D. Ruppe wrote: [...] Hello, thanks for reply. This is my first dlang work: import std.stdio; import std.conv;

Re: D man pages

2019-10-10 Thread Daniel Kozak via Digitalmars-d-learn
On Thursday, 10 October 2019 at 18:52:32 UTC, Jarek wrote: On Monday, 23 September 2019 at 12:31:16 UTC, Adam D. Ruppe wrote: [...] Hello, thanks for reply. This is my first dlang work: import std.stdio; import std.conv; import core.sys.posix.dirent; [...] You should use fromStringZ:

Re: Undefined symbol: _dyld_enumerate_tlv_storage (OSX)

2019-10-10 Thread Daniel Kozak via Digitalmars-d-learn
What dmd version? https://issues.dlang.org/show_bug.cgi?id=20019 On Thu, Oct 10, 2019 at 8:15 PM Robert M. Münch via Digitalmars-d-learn wrote: > > I have two project I want to compile and both times get this error: > > Undefined symbols for architecture x86_64: >

Re: DUB mysql-native

2019-10-08 Thread Daniel Kozak via Digitalmars-d-learn
On Tuesday, 8 October 2019 at 14:19:10 UTC, Vino wrote: On Tuesday, 8 October 2019 at 14:02:03 UTC, Vino wrote: On Tuesday, 8 October 2019 at 11:26:24 UTC, Daniel Kozak wrote: [...] Hi Daniel, As stated I have removed those line and ran the below command [...] Hi Daniel, Was able

Re: DUB mysql-native

2019-10-08 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 8, 2019 at 1:15 PM Daniel Kozak wrote: > ... > It is known issue, you can not use mysql-native right now with > anything else than libevent > > https://github.com/mysql-d/mysql-native/issues/199 > > Or you can just remove > > "subConfigurations": { > "vibe-d:core": "libevent" > }, > >

Re: DUB mysql-native

2019-10-08 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 8, 2019 at 10:55 AM Vino via Digitalmars-d-learn wrote: > > Could not resolve configuration for package hub > > From, > Vino.B It is known issue, you can not use mysql-native right now with anything else than libevent https://github.com/mysql-d/mysql-native/issues/199 Or you can

Re: must scope for delegates restrict compilation?

2019-10-03 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Oct 3, 2019 at 2:00 PM Oleg B via Digitalmars-d-learn wrote: > > Hello all > > I think this code must get compilation error, but it didn't, > furthermore result program get UB. > > https://run.dlang.io/is/Qpr278 > > Is this correct behavior and why? when you change it a litle it seems

Re: Why is the fPIC switch missing?

2019-09-23 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Sep 23, 2019 at 3:35 AM Emmanuelle via Digitalmars-d-learn wrote: > > Forgot to say: dmd v2.088.0. Also, weirdly enough, `dmd > --version` outputs `DMD32 D Compiler v2.088.0-dirty`. Why is > "dirty" there? https://forum.dlang.org/post/qqxmnoshytmzflviw...@forum.dlang.org

Re: Why is the fPIC switch missing?

2019-09-23 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Sep 23, 2019 at 3:35 AM Emmanuelle via Digitalmars-d-learn wrote: > > Hello. My problem is exactly what it says on the title: my dmd > (windows 7, x64) doesn't seem to have -fPIC: > > --- > > dmd -fPIC > Error: unrecognized switch '-fPIC' > run `dmd` to print the compiler manual >

Re: The biggest issue in Dlang

2019-09-19 Thread Daniel Kozak via Digitalmars-d-learn
On Thursday, 19 September 2019 at 20:50:30 UTC, Daniel Kozak wrote: auto main() { return int(0); } for some reasons does not work WOW :-D this works ok: void main() { return other(); } auto other() { return; } so I believe even this should work: auto main() { return; } I

The biggest issue in Dlang

2019-09-19 Thread Daniel Kozak via Digitalmars-d-learn
auto main() { return int(0); } for some reasons does not work WOW :-D this works ok: void main() { return other(); } auto other() { return; } so I believe even this should work: auto main() { return; }

Re: Problem with using std.math: abs and std.complex: abs at the same time

2019-09-18 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, Sep 18, 2019 at 2:05 PM berni via Digitalmars-d-learn wrote: > > The following code doesn't compile: > > >import std.stdio; > > > >void main() > >{ > >import std.complex: abs, complex; > >import std.math: abs; > > > >auto a = complex(1.0,1.0); > >auto b = 1.0; > > > >

DUB WTF?

2019-09-18 Thread Daniel Kozak via Digitalmars-d-learn
Why is dub automaticaly changing dub.sdl from packages to dub.json?

Re: getting rid of immutable (or const)

2019-09-05 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Sep 5, 2019 at 9:55 AM berni via Digitalmars-d-learn wrote: > > I still struggle with the concept of immutable and const: > > > import std.stdio; > > > > void main() > > { > > auto p = Point(3); > > auto q = p.x; > > writeln(typeof(q).stringof); > > } > > > > struct Point > >

Re: What is "dmd" Internal API, can I use it just like std Library Reference?

2019-08-20 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Aug 20, 2019 at 2:55 PM BoQsc via Digitalmars-d-learn wrote: > > Hello everyone, again, > > I had an idea that I want some colors in the output of Command > Line (For Windows) and > the Terminal (For Linux) > > I found https://dlang.org/phobos/dmd_console.html and wanted to > use it. >

Re: Downloading a file and showing progress via curl.

2019-08-20 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Aug 20, 2019 at 1:40 PM BoQsc via Digitalmars-d-learn wrote: > > Hello everyone, > I found this snippet on > https://dlang.org/phobos/std_net_curl.html#.HTTP > > > import std.net.curl : HTTP; > > import std.stdio : writeln; > > > > void main() > > { > > auto http = HTTP(); > > //

Re: Downloading a file and showing progress via curl.

2019-08-20 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Aug 20, 2019 at 1:46 PM Daniel Kozak wrote: > > On Tue, Aug 20, 2019 at 1:40 PM BoQsc via Digitalmars-d-learn > wrote: > > > > Hello everyone, > > I found this snippet on > > https://dlang.org/phobos/std_net_curl.html#.HTTP > > > > > import std.net.curl : HTTP; > > > import std.stdio :

Re: Can't add a const ubyte to a dynamic array of ubyte?

2019-08-20 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Aug 20, 2019 at 11:30 AM ads via Digitalmars-d-learn wrote: > > > How can I get around this? I want to ensure that the array is not > mutated in the function in the signature too. > https://run.dlang.io/is/tehp3j import std.stdio; ubyte[] extend(in uint[] arr) { ubyte[] result;

Re: How to use #pragma omp parallel for collapse(n) in dlang?

2019-08-15 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Aug 15, 2019 at 9:44 AM Daniel Kozak wrote: > > On Tue, Aug 13, 2019 at 10:47 AM ijet via Digitalmars-d-learn > wrote: > > > > How to use #pragma omp parallel for collapse(n) in dlang? > > There is no OMP for de as I know, but you can just use >

Re: How to use #pragma omp parallel for collapse(n) in dlang?

2019-08-15 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Aug 13, 2019 at 10:47 AM ijet via Digitalmars-d-learn wrote: > > How to use #pragma omp parallel for collapse(n) in dlang? There is no OMP for de as I know, but you can just use https://dlang.org/phobos/std_parallelism.html#.parallel for each 'foreach'

Re: How should I sort a doubly linked list the D way?

2019-08-13 Thread Daniel Kozak via Digitalmars-d-learn
You can make an array from it On Tue, Aug 13, 2019 at 12:05 PM Mirjam Akkersdijk via Digitalmars-d-learn wrote: > > On Tuesday, 13 August 2019 at 09:48:52 UTC, Mirjam Akkersdijk > wrote: > > Hello there, > > If I had a DLL, how would I sort it judging by the node > > contents, the D way? > > > >

Re: Speed of Random Numbers

2019-08-04 Thread Daniel Kozak via Digitalmars-d-learn
On Sun, Aug 4, 2019 at 11:49 AM Daniel Kozak wrote: > > You can try http://code.dlang.org/packages/mir-random > > I am using theme here: > https://github.com/TechEmpower/FrameworkBenchmarks/blob/b9cc153dcd1c20e78197b0191536f0d11b8ca554/frameworks/D/vibed/source/postgresql.d#L49 > > On Sun, Aug 4,

Re: Speed of Random Numbers

2019-08-04 Thread Daniel Kozak via Digitalmars-d-learn
You can try http://code.dlang.org/packages/mir-random I am using theme here: https://github.com/TechEmpower/FrameworkBenchmarks/blob/b9cc153dcd1c20e78197b0191536f0d11b8ca554/frameworks/D/vibed/source/postgresql.d#L49 On Sun, Aug 4, 2019 at 12:20 AM Giovanni Di Maria via Digitalmars-d-learn

Re: Help me decide D or C

2019-08-02 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Aug 2, 2019 at 2:30 PM berni via Digitalmars-d-learn wrote: > ... > I would even go further and state, that learning C first will > become a burden instead of a help. > Yes, I agree with this. It is same as with C++. Many people starts with C and then learn C++. Which is really not a

Re: DUB and ddoc - howto?

2019-06-28 Thread Daniel Kozak via Digitalmars-d-learn
But I am using this one: https://github.com/adamdruppe/adrdox On Fri, Jun 28, 2019 at 2:45 PM Martin Tschierschke via Digitalmars-d-learn wrote: > A very simple question, is there an example how to generate > documentation with dub? > (like dmd -D) > > My internet search was not successful. > >

Re: DUB and ddoc - howto?

2019-06-28 Thread Daniel Kozak via Digitalmars-d-learn
Did you try dub build --help? -b --build=VALUE Specifies the type of build to perform. Note that setting the DFLAGS environment variable will override the build type with custom flags. Possible names:

Re: Where can find fix length array memory layout document

2019-06-18 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Jun 18, 2019 at 2:30 PM lili via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Hi guys: > Is the Dlang fix-length array alloc on stack? when a test > writeln([1]).sizeof //16 > writeln([2]).sizeof //16 > Why, What is the fix-length array memory

Re: Where can find fix length array memory layout document

2019-06-18 Thread Daniel Kozak via Digitalmars-d-learn
import std.stdio; import std.array : staticArray; void main() { writeln([1].staticArray.sizeof); //4 writeln([2,5].staticArray.sizeof); //8 } On Tue, Jun 18, 2019 at 2:30 PM lili via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Hi guys: > Is the Dlang

Re: compiler does not detect accessing on null class object.

2019-05-27 Thread Daniel Kozak via Digitalmars-d-learn
On Monday, 27 May 2019 at 15:13:00 UTC, dangbinghoo wrote: hello, code below: - class a { string a1; } a a1; writeln(a1.a1); - compiles and produce "core dump" or "segfault", does this fit the original D design? why the compiler does not detect for accessing

Re: Why GNU coreutils/dd is creating a dummy file more efficiently than D's For loop?

2019-05-23 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, May 23, 2019 at 11:06 PM Daniel Kozak wrote: > On Thu, May 23, 2019 at 11:10 AM BoQsc via Digitalmars-d-learn < > digitalmars-d-learn@puremagic.com> wrote: > > https://matthias-endler.de/2017/yes/ > So this should do it void main() { import std.range : array, cycle, take;

Re: Why GNU coreutils/dd is creating a dummy file more efficiently than D's For loop?

2019-05-23 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, May 23, 2019 at 11:19 PM Daniel Kozak wrote: Fixed version without decode to dchar void main() { import std.range : array, cycle, take; import std.stdio; import std.utf; immutable buf_size = 8192; immutable buf = "\x00".byCodeUnit.cycle.take(buf_size).array; auto

Re: Why GNU coreutils/dd is creating a dummy file more efficiently than D's For loop?

2019-05-23 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, May 23, 2019 at 11:10 AM BoQsc via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > This code of D creates a dummy 47,6 MB text file filled with Nul > characters in about 9 seconds > > import std.stdio, std.process; > > void main() { > > writeln("Creating a dummy

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, May 21, 2019 at 7:55 AM Jim via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Hi, > > Question: How to call foo.x in @safe code ? > @safe: interface Base { void setup(); } interface FeatureX { void x(); } interface FeatureY { void y(); } class Foo: Base,

Re: Derive from interface

2019-03-25 Thread Daniel Kozak via Digitalmars-d-learn
It depends on what you want. But you can always use composition instead of inheritance for B. I have been using things like alias this, mixin and ufcs to achive multiple iheritence and it works ok for me. On Mon, Mar 25, 2019 at 10:40 PM Michelle Long via Digitalmars-d-learn <

Re: Converting an integer to a string with std.format.

2019-01-07 Thread Daniel Kozak via Digitalmars-d-learn
I would go with std.conv.to or std.conv.text :) On Sun, Jan 6, 2019 at 10:55 PM Per Nordlöw via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > When converting a single integer to a string is `formatValue` > preferred over `formattedWrite` in terms of compilation and > run-time

Re: class template conflict

2018-12-24 Thread Daniel Kozak via Digitalmars-d-learn
ne 23. 12. 2018 13:10 odesílatel Michelle Long via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> napsal: > class X > { > > } > > class X(int N) : X > { > > } > > Is there any real reason we can't do this? Actually yes. It would break almost all of my code. In D you can do thing like

Re: Checking if CTFE is used?

2018-12-18 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Dec 18, 2018 at 1:25 PM berni via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Is there a way to check if a function is indeed executed at > compile time or not? (Other than going through the whole > executable binaries...) > > I tried > > > static this() > > { > >

Re: Bug in shifting

2018-12-13 Thread Daniel Kozak via Digitalmars-d-learn
I do not understand you? What is wrong? It works ok. https://run.dlang.io/is/ZFf0FQ What do you mean by D required breaks for cases? On Fri, Dec 14, 2018 at 1:20 AM Michelle Long via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > byte x = 0xF; > ulong y = x >> 60; > > Does

Re: .dup vs operation on all elements

2018-12-03 Thread Daniel Kozak via Digitalmars-d-learn
Yes it is. The dup version just make an extra copy of array for no reason. po 3. 12. 2018 21:10 odesílatel Goksan via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> napsal: > Are there any differences between these 2 methods of copying > elements? > > double[] array = [ 1, 20, 2, 30,

Re: getopt short-options documentation

2018-11-29 Thread Daniel Kozak via Digitalmars-d-learn
Are you sure? Can you show me an example? I always forgot on this limitation and somtimes it cause really nesty things :D On Thu, Nov 29, 2018 at 6:05 PM Antonio Corbi via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Hi! > > Reading through the `getopt` documentation at one

Re: Why pow() won't go beyond 2^31?

2018-11-29 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Nov 29, 2018 at 8:10 AM Murilo via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > I am using the function pow() from std.math but if I try pow(2, > 32) it returns 0, it doesn't compute beyond the maximum value of > an int(2^31) and I am working with long. What should I

Re: Integrate vibe.d into Windows Service

2018-11-27 Thread Daniel Kozak via Digitalmars-d-learn
On Wednesday, 21 November 2018 at 09:59:19 UTC, Andre Pany wrote: Hi, I translated the CPP example of a windows service to D. https://docs.microsoft.com/en-us/windows/desktop/Services/svc-cpp [...] Today I needed this too, and after some searching I came across this package which works ok

Re: memoize & __traits(compiles...)

2018-11-23 Thread Daniel Kozak via Digitalmars-d-learn
__traits(compiles...) does not call your function so it is not evaluate twice only once, so there is no need to use memoize On Fri, Nov 23, 2018 at 11:35 AM John Chapman via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > I'm doing a fair amount of repeatedly checking if a

  1   2   3   4   5   >