Re: Explain function syntax

2025-09-20 Thread Ali Çehreli via Digitalmars-d-learn
On 9/18/25 10:18 PM, Steven Schveighoffer wrote: > On Thursday, 18 September 2025 at 18:10:13 UTC, Ali Çehreli wrote: >> // Not a delegate: >> static assert(is (typeof(twice) == function)); > You are mistaking the is expression for a function test with the > function pointer type. I dis

Re: Microsoft chose Go instead of C# or Rust to rewrite TypeScript

2025-09-20 Thread drug007 via Digitalmars-d-learn
On 08.09.2025 22:55, Neto wrote: On Monday, 8 September 2025 at 16:51:09 UTC, Serg Gini wrote: And not sure if ecosystem was a significant weight in the decision. Why isn't D production ready? I've been trying to figure it out for a long time. As long as I've known this person in D communi

Re: Discuss: Classes are well supported in D, with Design by Contracts. Shouldn't we take advantage of that?

2025-09-20 Thread Dejan Lekic via Digitalmars-d-learn
On Saturday, 13 September 2025 at 00:43:38 UTC, Brother Bill wrote: I'm not clear about why 'class'es are on the 'avoid' list. They are on some peoples' avoiding list. It does not mean it should be on yours. I can tell you one thing with 100% certainty - if D had no classes I would not be u

Re: Microsoft chose Go instead of C# or Rust to rewrite TypeScript

2025-09-20 Thread An Pham via Digitalmars-d-learn
On Thursday, 11 September 2025 at 12:07:35 UTC, Serg Gini wrote: On Wednesday, 10 September 2025 at 03:46:37 UTC, felixfxu wrote: On Monday, 8 September 2025 at 20:10:52 UTC, Sergey wrote: being focused on required important tasks = complicated I don't quite understand the item above. What's

Re: Debug help - opDispatch - unknown member function

2025-09-20 Thread monkyyy via Digitalmars-d-learn
On Tuesday, 9 September 2025 at 00:40:31 UTC, Brother Bill wrote: https://tour.dlang.org/tour/en/gems/opdispatch-opapply This states: "Any unknown member function call to that type is passed to opDispatch, passing the unknown member function's name as a string template parameter." Specs are

Re: Microsoft chose Go instead of C# or Rust to rewrite TypeScript

2025-09-20 Thread Serg Gini via Digitalmars-d-learn
On Monday, 8 September 2025 at 16:43:10 UTC, Neto wrote: this is the reasoning https://github.com/microsoft/typescript-go/discussions/411 I wonder if they did consider D language. First comment says why Rust would be a good choice "If not C#, I would have expected Rust, since that's where the

Re: Placement new and @trusted

2025-09-20 Thread IchorDev via Digitalmars-d-learn
On Wednesday, 10 September 2025 at 13:13:34 UTC, Richard (Rikki) Andrew Cattermole wrote: Placement new is @system, but you wanted to use it in an @safe function iff the constructor to be called is @safe as well. Pretty much. The reason placement new is @system is because of double-init. It c

Cleared AA == and is have different results. Why?

2025-09-20 Thread Brother Bill via Digitalmars-d-learn
Page 119 of Programming in D It seems odd that == null and is null have different values? Is this a bug or feature? If a feature, what is the meanings of == null vs. is null? source/app.d ``` import std.stdio; void main() { // value[key] int[string] dayNumbers = // key :

Re: Debug help - opDispatch - unknown member function

2025-09-20 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 9 September 2025 at 12:04:07 UTC, Brother Bill wrote: When commenting out the callHome() in struct C, it fails. Obviously if callHome() is explicitly created, it works. If C does not have callHome() method, then ```d mixin("content." ~ name)(vals); ``` will simply fail, beca

Declaring a single const: enum vs const vs immutable

2025-09-20 Thread Brother Bill via Digitalmars-d-learn
Is there any reason to pick one of these vs. another one, or are they all equivalent? If equivalent, it would seem that immutable appears to be the 'strongest', whereas enum has fewer keystrokes. Is there a D 'best practice' for this? ``` const int foo1 = 42; enum foo2 = 42;

Re: Why is std.variant bad?

2025-09-20 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 20 September 2025 at 01:46:47 UTC, monkyyy wrote: This was before my time. I was under the impression that it was somehow class and oo related badness when people talked about using TypeInfo; but when I my own experiments say that typeinfo is just another tool I see 3k lines of c