about const and immutable (again)

Steven Schveighoffer schveiguy at yahoo.com
Thu Oct 6 11:56:10 PDT 2011


On Thu, 06 Oct 2011 12:27:16 -0400, Gor Gyolchanyan  
<gor.f.gyolchanyan at gmail.com> wrote:

> I see. Thanks for the detailed answer.

I should clarify one point, I realized I am somewhat inaccurate on the  
reason the type is set to immutable(dchar).  In fact, nobody actually  
wrote the immutable(dchar) function, it's just that the element type is  
immutable(dchar).  However, the reasons why someone would want to create a  
function that takes an immutable(dchar) function are as I stated -- so you  
don't accidentally change the value.

Still no excuse that delegates cannot be implicitly cast to compatible  
versions.

> I just looked up Wikipedia for lambdas in different languages and
> found out, that C# has an awesome syntax for that:
>
> x => x * x
> (x, y) => x == y
> (int x, string s) => s.Length > x
> () => SomeMethod()
> n => { string s = n + " " + "World"; Console.WriteLine(s); }

In the not so distant past, Walter explored different ways to improve the  
lambda syntax on this news group (which included similarities to the  
above).  This usually means he is considering adding that change, let's  
hope so :)

-Steve


More information about the Digitalmars-d mailing list