July 09
On 09/07/2024 4:48 PM, IchorDev wrote:
> On Tuesday, 9 July 2024 at 03:57:47 UTC, Richard (Rikki) Andrew Cattermole wrote:
>> It is used quite heavily to mean that the variable isn't used for say foreach statements.
> 
> ‘Used to mean’—I use it for that too, but it’s a convention not a language feature. (Unless it’s undocumented?)

There is nothing special about it, its just a variable called ``_``.

>> We will not be diverging from C's identifiers.
> 
> Fortunately there are plenty of good prefixes that don’t require diverging from C’s identifiers.

Yes, I need to talk to Walter about the member-of-operator ideally at next monthly meeting to unblock my sum type work.

It is a very restrictive subset of this, which may take some convincing as he has some very strong opinions that do impact performance. An expansion can come later to introduce Identifier Type's as described in this thread with expanded use cases.

>> We are in the process of bumping the version from C99 to C23.
>> I can say this on behalf of Walter, due to that bump being something I had to fight for.
> 
> And thank you for doing that!

I'm happy to do it, it should be the only bump we will ever need to do.
July 09

On Tuesday, 9 July 2024 at 04:54:54 UTC, Richard (Rikki) Andrew Cattermole wrote:

>

Yes, I need to talk to Walter about the member-of-operator ideally at next monthly meeting to unblock my sum type work.

It is a very restrictive subset of this, which may take some convincing as he has some very strong opinions that do impact performance. An expansion can come later to introduce Identifier Type's as described in this thread with expanded use cases.

Ah yes, I’d forgotten all about that!
Do you think I should attend the meeting?

July 09
On 09/07/2024 8:26 PM, IchorDev wrote:
> On Tuesday, 9 July 2024 at 04:54:54 UTC, Richard (Rikki) Andrew Cattermole wrote:
>> Yes, I need to talk to Walter about the member-of-operator ideally at next monthly meeting to unblock my sum type work.
>>
>> It is a very restrictive subset of this, which may take some convincing as he has some very strong opinions that do impact performance. An expansion can come later to introduce Identifier Type's as described in this thread with expanded use cases.
> 
> Ah yes, I’d forgotten all about that!
> Do you think I should attend the meeting?

Up to you, my main focus for this is to get Walter to confirm what level of cost for argument to parameter matching will be acceptable for him.

If I can't get even the most restricted design okayed to continue, all this work is kinda at a dead end.
July 20

On Tuesday, 9 July 2024 at 08:56:33 UTC, Richard (Rikki) Andrew Cattermole wrote:

>

If I can't get even the most restricted design okayed to continue, all this work is kinda at a dead end.

Unfortunately after the meeting it seems that the answer remains nebulous. I hope your design workshop thing goes a bit better.

July 22

On Friday, 5 July 2024 at 13:19:44 UTC, IchorDev wrote:
For any context where an enum literal or

>

struct literal is being assigned/passed/etc. to something with a known type, allow us to omit the type from the literal.
I would suggest tackling these one at a time.
As for me, I have always wondered why you can't just type the name of the enum instead of qualifying it. I like the syntax of not prefix.
Also, I think editions should be free to break quite a bit of stuff so long as 1. you can keep compiling older editions and 2. there is a clear path from edition to edition that doesn't take a lot of re-engineering. I would definitely move away from using _ or something like that because that is a very common variable name.

Why do you not like the prefixless solution?

July 22

On Monday, 22 July 2024 at 01:17:19 UTC, harakim wrote:

>

I like the syntax of not prefix.
[...]
Why do you not like the prefixless solution?

You might want to preview how your reply looks before sending it. I had to manually reverse-engineer which parts of your message were your response…

Having no prefix is less explicit, making it harder to read code that uses the feature.

struct S{ int a, b, c; }
S s = (a, b, c);

Comma expression in parenthesis? Nope, it's secretly a constructor. This same problem applies to enums:

enum E{ a,b,c }
int a, b, c;
someFunction(a); //what is `a`?

So now we have two names in the same scope that shadow each-other. How do we get around this? Module scope operator?

enum E{ a,b,c }
int a, b, c;
someFunction(.a); //both versions of `a` are in the same scope—still ambiguous

No, ultimately this is the same stupid problem that C has. If you want enums that work like this, just write them like this:

enum { a=0,b=1,c=2 }

Or use a mixin to expand them.
Also this syntax is inconsistent with how the rest of D works. Would you apply this logic to the members of a struct? It would certainly be logically consistent to do so:

struct S{ int a, b, c; }
enum E{ a,b,c }
S s = (a, b, c);
someFunction(a); //could be `s.a` or `E.a` depending on `someFunction`'s signature
August 01

On Sunday, 7 July 2024 at 19:42:25 UTC, Nick Treleaven wrote:

>

Vladimir's idea of making an identifier expression have its own type

So identifier literals can be compatible with enum members, as discussed above. One interesting application of identifier literals could be for some of the situations where implicit construction of a user-defined type would be used in C++ - we don't have that in D. It could work by defining a named enum or static member of an aggregate type. E.g. for the struct type below, the none enum:

struct Option(T) {
    enum none = Option!T.init;

    bool empty = true;
    T value;

    this(T v) {
        empty = false;
        value = v;
    }
}

void f(Option!int o)
{
    import std.stdio;
    writeln(o);
}
void main() {
    f(Option!int(5));
    f(:none); // same as `f(Option!int.none)`
}

I'm using :none as the syntax for an identifier literal. typeof(:none) could match f's argument type of Option!int, because none is a value member of that type. So :none would be equivalent to passing Option!int.none there.

So identifier literals seem more flexible than just selecting an enum member. They would also be useful as an argument to a mixin template instead of a string literal for the name of an identifier symbol to mixin.

August 02
On 02/08/2024 4:53 AM, Nick Treleaven wrote:
> On Sunday, 7 July 2024 at 19:42:25 UTC, Nick Treleaven wrote:
>> Vladimir's idea of making an identifier expression have its own type
> 
> So identifier literals can be compatible with enum members, as discussed above. One interesting application of identifier literals could be for some of the situations where implicit construction of a user-defined type would be used in C++ - we don't have that in D. It could work by defining a named enum or static member of an aggregate type. E.g. for the struct type below, the `none` enum:
> 
> ```d
> struct Option(T) {
>      enum none = Option!T.init;
> 
>      bool empty = true;
>      T value;
> 
>      this(T v) {
>          empty = false;
>          value = v;
>      }
> }
> 
> void f(Option!int o)
> {
>      import std.stdio;
>      writeln(o);
> }
> void main() {
>      f(Option!int(5));
>      f(:none); // same as `f(Option!int.none)`
> }
> ```
> 
> I'm using `:none` as the syntax for an identifier literal. `typeof(:none)` could match f's argument type of `Option!int`, because `none` is a value member of that type. So `:none` would be equivalent to passing `Option!int.none` there.
> 
> So identifier literals seem more flexible than just selecting an enum member. They would also be useful as an argument to a mixin template instead of a string literal for the name of an identifier symbol to mixin.

Yeah that is more or less what I'm calling the member-of-operator. It is currently waiting on Walter, without his approval no point doing a DIP in development as I know he has strong feelings on it.
1 2 3
Next ›   Last »