Introducing alid

Salih Dincer salihdb at hotmail.com
Wed Sep 14 02:48:43 UTC 2022


On Tuesday, 13 September 2022 at 15:24:20 UTC, Ali Çehreli wrote:
> On 9/12/22 22:24, Salih Dincer wrote:
> 2) This point is about a topic that I brought up recently: 
> Types gain a 'const' eagerly (and they have to, understandably).
>
> For example, in your example you are caching an 'int', but my 
> code sees const(int) just because std.range.Cycle.front chose 
> to put a 'const' on itself. (With all good intentions: 
> Cycle.front really does not mutate a Cycle object.)
>
> However, as my range picks the element type with ElementType!T, 
> I see const(int) as well. Again, all good so far... And here is 
> my opApply funtion:
>
> ```d
>     int opApply(int delegate(ref EC.ET) func) scope
>     {
>         while(!empty)
>         {
>             auto f = front;
>
>             int result = func(f);    // ERROR
>             if (result)
>             {
>                 return result;
>             }
>             popFront();
>         }
>
>         return 0;
>     }
> ```
>
> ERROR: delegate `func(ref int)` is not callable using argument 
> types `(const(int))`
>

I'm far from making a solid recommendation.  Immutable with const 
still doesn't make sense to me.  I claim we can live without 
them. Immutable confuses me a lot.

I think we should take control by creating our own types.  D 
Language should be unornamented.

SDB at 79


More information about the Digitalmars-d-announce mailing list