Re: Log rotation in std.logger.filelogger

2023-05-23 Thread apz28 via Digitalmars-d-learn
On Tuesday, 23 May 2023 at 13:13:18 UTC, Andrew wrote: On Tuesday, 23 May 2023 at 11:21:07 UTC, apz28 wrote: On Wednesday, 17 May 2023 at 21:11:41 UTC, Vitalii wrote: Hello! Please tell me how to enable log rotation in std.logger.filelogger? Without log rotation, it seems that the

Re: Log rotation in std.logger.filelogger

2023-05-23 Thread apz28 via Digitalmars-d-learn
On Wednesday, 17 May 2023 at 21:11:41 UTC, Vitalii wrote: Hello! Please tell me how to enable log rotation in std.logger.filelogger? Without log rotation, it seems that the std.logger.filelogger is useless, because it will quickly take up all the free space on the hard drive. Or can try

Re: Implicit type conversion depending on assignment

2023-03-23 Thread apz28 via Digitalmars-d-learn
On Thursday, 23 March 2023 at 14:36:11 UTC, Alexander Zhirov wrote: On Thursday, 23 March 2023 at 14:19:31 UTC, user1234 wrote: omg, let's rewrite this... Or abuse opBinary struct MyVal { string value; T opBinary(string op, T)(T rhs) if (op == "+") {

return attribute with latest DMD - dmd-nightly -unittest -dip1000

2022-11-02 Thread apz28 via Digitalmars-d-learn
why foo2 is not inferred as scope which is shorter scope then foo1? import std.stdio; @safe: class Obj {@safe: override string toString() { return "obj"; } } struct Foo1 {@safe: this(Obj obj) { this._obj = obj; } ~this() { _obj = null; } // do something with

Re: [Help Needed] - Debugging compilation time

2022-10-21 Thread apz28 via Digitalmars-d-learn
On Friday, 21 October 2022 at 16:32:17 UTC, Hipreme wrote: Hey guys, I have been complaining a lot of time right now from D compilation speed at least for my project. I have: - Underused CTFE - Underused Templates - Avoided importing standard libraries - Created a multi module projects for

Re: Storing a lambda alongside type-erased data

2022-09-08 Thread apz28 via Digitalmars-d-learn
On Thursday, 8 September 2022 at 15:02:13 UTC, Paul Backus wrote: On Thursday, 8 September 2022 at 03:18:08 UTC, Ali Çehreli wrote: I looked at how std.variant.VariantN prints the correct type and failed to understand the magic there. :( Then I came up with storing a lambda that is created

Re: How to call a function from a dll created with d ?

2022-07-02 Thread apz28 via Digitalmars-d-learn
Below is working on Windows --file dimedll.d: module dimedll; import core.sys.windows.windows; import core.sys.windows.dll; import std.stdio; mixin SimpleDllMain; export void testFunc() { writeln("This is from dll"); } --file dime.d: import core.sys.windows.windows;

Re: Protected Members in Class

2021-12-24 Thread apz28 via Digitalmars-d-learn
On Friday, 24 December 2021 at 08:35:38 UTC, Salih Dincer wrote: What do I need to do to see that the protected is active, need a separate module? ```d // Source: https://tour.dlang.org/tour/en/basics/classes class Any { // protected is just seen by inheriting // classes protected

Re: Why code failed to compile for foo2?

2021-12-14 Thread apz28 via Digitalmars-d-learn
On Tuesday, 14 December 2021 at 05:04:46 UTC, Tejas wrote: Is there anything wrong with the answer I posted? Can you please tell me if there's anything dissatisfactory about it? I feel like it does everything the OP wants. Also, am I wrong in using `Unconst` over `Unqual`? Isn't `Unqual`

Re: Why code failed to compile for foo2?

2021-12-13 Thread apz28 via Digitalmars-d-learn
On Saturday, 11 December 2021 at 23:44:59 UTC, Adam Ruppe wrote: On Saturday, 11 December 2021 at 23:17:17 UTC, Stanislav Blinov wrote: ? No. If it was unsatisfied constraint, the error would've shown that. And if you try to instantiate it, you'll see it is an unsatisfied constraint anyway.

Re: Why code failed to compile for foo2?

2021-12-11 Thread apz28 via Digitalmars-d-learn
On Sunday, 12 December 2021 at 00:02:25 UTC, Stanislav Blinov wrote: @apz28, I can't figure out the intent here. To convert result of abs to an unsigned? The function logic works only for unsigned type and the parameter value can be altered in body hence Unqual. If not Unqual, must declare a

Why code failed to compile for foo2?

2021-12-11 Thread apz28 via Digitalmars-d-learn
void foo1(ubyte x) {} void foo1(ushort x) {} void foo1(uint x) {} void foo1(ulong x) {} import std.traits : isUnsigned, Unqual; void foo2(T)(Unqual!T x) if(isUnsigned!T) {} void main() { import std.math; int s = 1; foo1(abs(s)); foo2(abs(s)); //failed?

Re: Output Range Problem? How to make it work?

2021-10-11 Thread apz28 via Digitalmars-d-learn
On Monday, 11 October 2021 at 00:37:43 UTC, Paul Backus wrote: On Monday, 11 October 2021 at 00:19:44 UTC, apz28 wrote: /* Getting this error onlineapp.d(34): Error: none of the overloads of `toString` are callable using argument types `(Buffer)`, candidates are: onlineapp.d(19):

Output Range Problem? How to make it work?

2021-10-10 Thread apz28 via Digitalmars-d-learn
import std.range.primitives: isOutputRange; @safe: struct Buffer { @safe: void put(char c) {} void put(scope const(char)[] s) {} } struct Foo { @safe: string toString() {return null;} ref Writer

What is the value for D to allow assign bool to char/dchar? For me, it must be an error.

2021-08-07 Thread apz28 via Digitalmars-d-learn
void main() { dchar d; d = false; d = true; char c; c = false; c = true; }

Re: How to Fix Weird Build Failure with "-release" but OK with "-debug"?

2021-07-23 Thread apz28 via Digitalmars-d-learn
On Friday, 23 July 2021 at 18:44:47 UTC, Steven Schveighoffer wrote: On 7/22/21 7:43 PM, apz28 wrote: In any case, it's possible that fbConnection being null does not mean a null dereference, but I'd have to see the class itself. I'm surprised if you don't get a null dereference in

Re: How to Fix Weird Build Failure with "-release" but OK with "-debug"?

2021-07-22 Thread apz28 via Digitalmars-d-learn
On Thursday, 22 July 2021 at 18:56:43 UTC, Steven Schveighoffer wrote: On 7/22/21 2:38 PM, apz28 wrote: On Wednesday, 21 July 2021 at 20:39:54 UTC, Dukc wrote: On Wednesday, 21 July 2021 at 14:15:51 UTC, Steven Schveighoffer wrote: 2. It's hard for me to see where the null dereference would

Re: How to Fix Weird Build Failure with "-release" but OK with "-debug"?

2021-07-22 Thread apz28 via Digitalmars-d-learn
On Wednesday, 21 July 2021 at 20:39:54 UTC, Dukc wrote: On Wednesday, 21 July 2021 at 14:15:51 UTC, Steven Schveighoffer wrote: 2. It's hard for me to see where the null dereference would be in that function (the `bool` implementation is pretty simple). -Steve DMD complains about

Re: How to Fix Weird Build Failure with "-release" but OK with "-debug"?

2021-07-21 Thread apz28 via Digitalmars-d-learn
On Wednesday, 21 July 2021 at 11:52:39 UTC, apz28 wrote: On Wednesday, 21 July 2021 at 04:52:44 UTC, Mathias LANG wrote: It seems the compiler is doing extra analysis and seeing that a null pointer is being dereferenced. Can you provide the code for "pham\db\db_skdatabase.d" at L138 through

Re: How to Fix Weird Build Failure with "-release" but OK with "-debug"?

2021-07-21 Thread apz28 via Digitalmars-d-learn
On Wednesday, 21 July 2021 at 04:52:44 UTC, Mathias LANG wrote: It seems the compiler is doing extra analysis and seeing that a null pointer is being dereferenced. Can you provide the code for "pham\db\db_skdatabase.d" at L138 through 140 ? ```d package(pham.db): // Line# 133

How to Fix Weird Build Failure with "-release" but OK with "-debug"?

2021-07-20 Thread apz28 via Digitalmars-d-learn
VisualD project - Any hint to work around DMD version: DMD32 D Compiler v2.096.0-rc.1-dirty Copyright (C) 1999-2021 by The D Language Foundation, All Rights Reserved written by Walter Bright Failed Build Command line: dmd -release -m32mscoff -O -inline -dip25 -dip1000 -preview=fixAliasThis

Re: How to execute a random postgresql-query.

2021-06-29 Thread apz28 via Digitalmars-d-learn
On Tuesday, 29 June 2021 at 20:35:07 UTC, Alain De Vos wrote: Some implementations take all queries full in memory. But what when i need one record. And the select result could be huge. And we don't want swapping for this? You can try my db package

Re: Why filling AA in shared library freezes execution?

2021-01-29 Thread apz28 via Digitalmars-d-learn
On Friday, 29 January 2021 at 12:45:02 UTC, Imperatorn wrote: Anyone knows what it would take to fix it? This may help to narrow down the problem. Disable garbage collect Configuring the Garbage Collector https://dlang.org/spec/garbage.html

How to get call stack for InvalidMemoryOperationError while doing unittest?

2021-01-13 Thread apz28 via Digitalmars-d-learn
core.exception.InvalidMemoryOperationError@src\core\exception.d(647): Invalid memory operation reference D runtime unittest executor codes try { fp(); ++results.passed; } catch ( Throwable e ) { import core.stdc.stdio;

Re: New programming paradigm

2017-09-07 Thread apz28 via Digitalmars-d-learn
On Thursday, 7 September 2017 at 17:13:43 UTC, EntangledQuanta wrote: On Thursday, 7 September 2017 at 15:36:47 UTC, Jesse Phillips wrote: [...] All types have a type ;) You specified in the above case that m is an int by setting it to 4(I assume that is what var(4) means). But the

Compiler bug?

2017-08-15 Thread apz28 via Digitalmars-d-learn
abstract class A { string _s; @property: final string s() { return _s; } A s(string x) { _s = x; return this; } } class B : A { @property: final override A s(string

How to fix wrong deprecation message - dmd-2.075.1

2017-08-15 Thread apz28 via Digitalmars-d-learn
void main() { import std.utf : toUTF16; // Same problem with toUTF8 wstring s = toUTF16!string("abc"); } Compilation output: /d500/f513.d(3): Deprecation: function std.utf.toUTF16 is deprecated - To be removed November 2017. Please use std.utf.encode instead.