Re: Gneric linkedList range adaptor

2023-02-10 Thread Paul Backus via Digitalmars-d-learn
On Friday, 10 February 2023 at 22:10:20 UTC, Ben Jones wrote: I'm trying to write a range adaptor for linked list types. The range type seems to work OK, but my helper function to deduce the node type has a compiler error. My hunch is that `nextField` loses its association with T when I'm try

Re: Gneric linkedList range adaptor

2023-02-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/10/23 5:10 PM, Ben Jones wrote: I'm trying to write a range adaptor for linked list types.  The range type seems to work OK, but my helper function to deduce the node type has a compiler error.  My hunch is that `nextField` loses its association with T when I'm trying to pass it as a templ

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-10 Thread thebluepandabear via Digitalmars-d-learn
For a language that claims to supprot OOP, and does public by default, and no way to declare type private... I mean... wow! agree, it should definitely be `private` by default... if `private` was implemented properly lmao

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-10 Thread ProtectAndHide via Digitalmars-d-learn
On Saturday, 11 February 2023 at 02:17:09 UTC, thebluepandabear wrote: I'm not an advocate of any style in particular. I'm happy to use any style that is clear to understand and use, suitable, and can provide reasonable guarantees around memory safety and correctness. But a language that clai

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-10 Thread ProtectAndHide via Digitalmars-d-learn
On Saturday, 11 February 2023 at 02:18:48 UTC, thebluepandabear wrote: What attracts me to D, is the inability to program outside of a class in C#. I think they are trying to find ways to make this happen, but I wouldn't hold my breath. programming outside of a class is overrated though in m

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-10 Thread ProtectAndHide via Digitalmars-d-learn
On Saturday, 11 February 2023 at 02:15:37 UTC, thebluepandabear wrote: That's not entirely correct. I don't use any Apple hardware products. Never have, and never will. I use Swift on Linux only. There are of course some library features of Swift tied to Apple products. But I have no need f

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-10 Thread thebluepandabear via Digitalmars-d-learn
What attracts me to D, is the inability to program outside of a class in C#. I think they are trying to find ways to make this happen, but I wouldn't hold my breath. programming outside of a class is overrated though in my opinion. i've never seen a usecase for it in an object oriented langu

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-10 Thread thebluepandabear via Digitalmars-d-learn
That's not entirely correct. I don't use any Apple hardware products. Never have, and never will. I use Swift on Linux only. There are of course some library features of Swift tied to Apple products. But I have no need for those library features. As a standalone language, Swift can (IMO) a

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-10 Thread thebluepandabear via Digitalmars-d-learn
I'm not an advocate of any style in particular. I'm happy to use any style that is clear to understand and use, suitable, and can provide reasonable guarantees around memory safety and correctness. But a language that claims to support OOP but doesn't even have type privacy, is a bit of joke

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-10 Thread ProtectAndHide via Digitalmars-d-learn
On Friday, 10 February 2023 at 02:57:42 UTC, zjh wrote: On Friday, 10 February 2023 at 02:04:06 UTC, ProtectAndHide wrote: "Before practicing Zen, mountains were mountains and rivers were rivers. While practicing Zen, mountains are no longer mountains and rivers are no longer rivers. After re

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-10 Thread ProtectAndHide via Digitalmars-d-learn
On Friday, 10 February 2023 at 23:24:11 UTC, thebluepandabear wrote: I think the 'real' problem, is that some core D people just refuse to allow D to provide such an option to the programmer. I think a lot of it has to do with the fact that heaps of D programmers write procedural code and don

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-10 Thread ProtectAndHide via Digitalmars-d-learn
On Friday, 10 February 2023 at 23:22:34 UTC, thebluepandabear wrote: A good example of a language that does everything right is C#. If C# wasn't tied to Microsoft, it would honestly be pretty much the perfect language. Java is also pretty good, but it has its downsides. I don't agree with all

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-10 Thread ProtectAndHide via Digitalmars-d-learn
On Friday, 10 February 2023 at 23:19:31 UTC, thebluepandabear wrote: I think the 'real' problem, is that some core D people just refuse to allow D to provide such an option to the programmer. For what reason, I cannot fathom, since Swift can do this just fine. I think it's some kind of bias aga

Re: Gneric linkedList range adaptor

2023-02-10 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 10 February 2023 at 23:39:11 UTC, Ruby The Roobster wrote: The problem is that Node.next is not, and cannot be `static`. Thus, there is no way for you to pass it as an alias template parameter, and this should be considered a compiler bug that this doesn't error out. Nevermind

Re: Gneric linkedList range adaptor

2023-02-10 Thread Ali Çehreli via Digitalmars-d-learn
On 2/10/23 14:10, Ben Jones wrote: > Any idea how to fix the helper method? I came up with the following solution: > struct LinkedListAdaptor(alias nextField, T){ In this case nextField will be a callable (a lambda below). > void popFront() { > current = __traits(child, current,

Re: Gneric linkedList range adaptor

2023-02-10 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 10 February 2023 at 22:10:20 UTC, Ben Jones wrote: I'm trying to write a range adaptor for linked list types. The range type seems to work OK, but my helper function to deduce the node type has a compiler error. My hunch is that `nextField` loses its association with T when I'm try

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-10 Thread thebluepandabear via Digitalmars-d-learn
I think the 'real' problem, is that some core D people just refuse to allow D to provide such an option to the programmer. I think a lot of it has to do with the fact that heaps of D programmers write procedural code and don't care about any object oriented features, that's because they're 'o

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-10 Thread thebluepandabear via Digitalmars-d-learn
A good example of a language that does everything right is C#. If C# wasn't tied to Microsoft, it would honestly be pretty much the perfect language. Java is also pretty good, but it has its downsides.

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-10 Thread thebluepandabear via Digitalmars-d-learn
I think the 'real' problem, is that some core D people just refuse to allow D to provide such an option to the programmer. For what reason, I cannot fathom, since Swift can do this just fine. I think it's some kind of bias against a particular style of programming that some don't want to see oc

Gneric linkedList range adaptor

2023-02-10 Thread Ben Jones via Digitalmars-d-learn
I'm trying to write a range adaptor for linked list types. The range type seems to work OK, but my helper function to deduce the node type has a compiler error. My hunch is that `nextField` loses its association with T when I'm trying to pass it as a template parameter inside the helper metho

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-10 Thread ProtectAndHide via Digitalmars-d-learn
On Friday, 10 February 2023 at 14:50:59 UTC, bachmeier wrote: On Friday, 10 February 2023 at 07:04:31 UTC, Max Samukha wrote: Having class-private doesn't preclude module-private. Dennis even submitted a PR implementing class-private, but it stalled because people couldn't agree on whether cla

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-10 Thread bachmeier via Digitalmars-d-learn
On Friday, 10 February 2023 at 07:04:31 UTC, Max Samukha wrote: Having class-private doesn't preclude module-private. Dennis even submitted a PR implementing class-private, but it stalled because people couldn't agree on whether class-private should be "private to class" or "private to class i

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-10 Thread Kagamin via Digitalmars-d-learn
On Friday, 10 February 2023 at 14:17:25 UTC, Kagamin wrote: Pretty sure you can strip namespaces in any language that has namespaces, C# routinely does it and refers to all types with their nonqualified names. It even has Keys enum: https://learn.microsoft.com/en-us/dotnet/api/system.windows.fo

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-10 Thread Kagamin via Digitalmars-d-learn
On Monday, 23 January 2023 at 00:36:36 UTC, thebluepandabear wrote: It's not a freedom issue, it's a library-design issue. Some libraries want to incorporate a namespace-like design to force the user to be more 'explicit' with what they want. SFML has a `Keyboard` namespace which has a `Key` e