Re: opCast in class prevents destroy

2022-03-01 Thread vit via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 08:16:13 UTC, Mike Parker wrote: On Tuesday, 1 March 2022 at 07:16:11 UTC, bauss wrote: Right now if you want to add an additional cast then you have to implement ALL the default behaviors and then add your custom cast. It's two template functions like the OP

Re: Cannot Call Super-Class Overloaded Function If Class has Function Override?

2022-03-01 Thread vit via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 08:40:12 UTC, Vijay Nayar wrote: I've randomly encountered a strange error, and I cannot find any explanation for it in the official documentation of syntax. Essentially, a class cannot call function overload in a super-class if the class itself contains an

Re: Cannot Call Super-Class Overloaded Function If Class has Function Override?

2022-03-01 Thread Vijay Nayar via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 09:06:59 UTC, vit wrote: On Tuesday, 1 March 2022 at 08:40:12 UTC, Vijay Nayar wrote: I've randomly encountered a strange error, and I cannot find any explanation for it in the official documentation of syntax. [...] Here is more info (3.):

Cannot Call Super-Class Overloaded Function If Class has Function Override?

2022-03-01 Thread Vijay Nayar via Digitalmars-d-learn
I've randomly encountered a strange error, and I cannot find any explanation for it in the official documentation of syntax. Essentially, a class cannot call function overload in a super-class if the class itself contains an override. Is this a bug? Is this on purpose? Take a look at

Re: Cannot Call Super-Class Overloaded Function If Class has Function Override?

2022-03-01 Thread vit via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 08:40:12 UTC, Vijay Nayar wrote: I've randomly encountered a strange error, and I cannot find any explanation for it in the official documentation of syntax. [...] Here is more info (3.):

Re: Cannot Call Super-Class Overloaded Function If Class has Function Override?

2022-03-01 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 09:10:46 UTC, Vijay Nayar wrote: I'm a bit surprised at this behavior though. Do you happen to know why it is considered bad to take into account the overloads of a super-class when resolving a call in a derived-class? https://dlang.org/articles/hijack.html

Re: opCast in class prevents destroy

2022-03-01 Thread bauss via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 08:16:13 UTC, Mike Parker wrote: On Tuesday, 1 March 2022 at 07:16:11 UTC, bauss wrote: Right now if you want to add an additional cast then you have to implement ALL the default behaviors and then add your custom cast. It's two template functions like the OP

Re: opCast in class prevents destroy

2022-03-01 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 07:16:11 UTC, bauss wrote: Right now if you want to add an additional cast then you have to implement ALL the default behaviors and then add your custom cast. It's two template functions like the OP used: one for T to catch everything, and one specialization.

Re: Colors in Raylib

2022-03-01 Thread meta via Digitalmars-d-learn
If the type is ``Color`` I think the compiler should allow ``GRAY`` if it is a member of ``Color``, isn't how strong statically typed language should work? I wonder what is the rational against it? How hard would it be to allow it?

Re: Colors in Raylib

2022-03-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/1/22 7:22 AM, meta wrote: If the type is ``Color`` I think the compiler should allow ``GRAY`` if it is a member of ``Color``, isn't how strong statically typed language should work? I wonder what is the rational against it? How hard would it be to allow it? The problem is how the

Re: Function Parameters without Names?

2022-03-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/19/22 6:37 PM, Vijay Nayar wrote: Do they get an automatic implied name like `_` or something? Yes, `_param_0`, `_param_1`, etc. Don't depend on this though, I think it's an implementation detail. -Steve

Setting SQLite compile time parameters from etc.c.sqlite3

2022-03-01 Thread data pulverizer via Digitalmars-d-learn
Hello all, I'm not sure how to set the compile time parameters in D's SQLite module particular the items that take multiple parameters, for example in the C API manual `SQLITE_CONFIG_MMAP_SIZE` takes two `sqlite3_int64`. How do I set these? Do I just write something like ``` enum

gcopt=fork:1

2022-03-01 Thread Ali Çehreli via Digitalmars-d-learn
Have you tried this new GC option which seems to solve the stop-the-world issue: https://dlang.org/changelog/2.098.0.html#forkgc Any experience? Ali

Re: Setting SQLite compile time parameters from etc.c.sqlite3

2022-03-01 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Mar 01, 2022 at 08:59:46PM +, data pulverizer via Digitalmars-d-learn wrote: > Hello all, > > I'm not sure how to set the compile time parameters in D's SQLite > module particular the items that take multiple parameters, for example > in the C API manual `SQLITE_CONFIG_MMAP_SIZE`

Re: Setting SQLite compile time parameters from etc.c.sqlite3

2022-03-01 Thread data pulverizer via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 20:59:46 UTC, data pulverizer wrote: Hello all, I'm not sure how to set the compile time parameters in D's SQLite module particular the items that take multiple parameters, for example in the C API manual `SQLITE_CONFIG_MMAP_SIZE` takes two `sqlite3_int64`. How do

Re: Colors in Raylib

2022-03-01 Thread Salih Dincer via Digitalmars-d-learn
On Monday, 28 February 2022 at 12:18:37 UTC, Mike Parker wrote: Then you can mixin aliases for any named enum members you'd like: ```d mixin(expandEnum!Colors); ``` Meanwhile it's very skillful :) It is possible to change all the color palette with a second parameter: ```d import

Re: Colors in Raylib

2022-03-01 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 13:15:09 UTC, meta wrote: enum Color { GRAY } void setColor(Color color); setColor(GRAY); Then that defeats the purpose of having named enums.

Re: Colors in Raylib

2022-03-01 Thread Ali Çehreli via Digitalmars-d-learn
On 3/1/22 07:19, Mike Parker wrote: > On Tuesday, 1 March 2022 at 13:15:09 UTC, meta wrote: > >> >> enum Color >> { GRAY } >> >> void setColor(Color color); >> >> setColor(GRAY); > > Then that defeats the purpose of having named enums. Yes and no. meta is pointing at a

Re: opCast in class prevents destroy

2022-03-01 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 04:59:49 UTC, Mike Parker wrote: On Tuesday, 1 March 2022 at 04:29:56 UTC, cc wrote: ```d struct A {} class B { A opCast(T : A)() { return A(); } } void main() { auto b = new B(); destroy(b); } ``` fails with ```

What does dual-context mean?

2022-03-01 Thread wjoe via Digitalmars-d-learn
Hello, what's a dual context as in the deprecation message? ```d struct MockFile { [...] void writef(alias fmt, A...)(A args) { // Deprecation: function 'writef': function requires a dual-context, which is deprecated import std.format: format; write(format!fmt(args)); }

Re: What does dual-context mean?

2022-03-01 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 14:51:47 UTC, wjoe wrote: Hello, what's a dual context as in the deprecation message? It means you have a struct or class member function that accesses its calling context via a template alias parameter. See this bug report for more information:

Re: opCast in class prevents destroy

2022-03-01 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 16:40:50 UTC, Paul Backus wrote: It's a bug in druntime. `destroy` needs to reinterpret the class reference as a `void*` to pass it to `rt_finalize`: https://github.com/dlang/druntime/blob/v2.098.1/src/object.d#L4209 However, `cast(void*)` is not the correct way

Re: Colors in Raylib

2022-03-01 Thread meta via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 12:29:56 UTC, Steven Schveighoffer wrote: On 3/1/22 7:22 AM, meta wrote: If the type is ``Color`` I think the compiler should allow ``GRAY`` if it is a member of ``Color``, isn't how strong statically typed language should work? I wonder what is the rational