VOOZH about

URL: https://dev.to/shimodateakira/why-c-keeps-opening-its-syntax-and-why-it-matters-3l7f

⇱ Why C# Keeps Opening Its Syntax (And Why It Matters) - DEV Community


Conclusion

C# has been evolving in a very specific direction:

👉 It is gradually giving language-level privileges to user-defined types.

This is not accidental.
This article explains why.

C# has been evolving in a very specific direction:

Language-level privileges are gradually being opened to user-defined
types.

This article explains that evolution and why it naturally leads to the
idea of giving meaning to values themselves.

Early C#: Permission by Type

In early C#, language constructs were tightly bound to specific types.

foreach (var item in collection)
{
}

This required IEnumerable.

This construct only works if your type implements this interface.

Modern C#: Pattern-Based

Today, it's different.

public class MyCollection
{
 public Enumerator GetEnumerator() => new Enumerator();

 public struct Enumerator
 {
 public int Current => 0;
 public bool MoveNext() => false;
 }
}

The compiler now cares about behavior, not type.

This Pattern Repeats

  • using → Dispose()
  • await → GetAwaiter()
  • deconstruction → Deconstruct()
  • collection initializer → Add()

Language features are no longer exclusive.

Why This Change Happened

Meaning should not be trapped inside APIs.

TimeSpan.FromMilliseconds(123)

vs

123.Milliseconds()

The latter embeds meaning directly into the value.

Syntax as a Shortcut for Meaning

  • APIs are read sequentially\
  • Syntax is recognized instantly

Syntax reduces cognitive load.

The Next Question

Can values themselves carry meaning?

var x = 100;

This has no meaning.

Direction of Evolution

  1. Meaning in types\
  2. Meaning in behavior\
  3. Meaning in syntax

Next:

Meaning in values

Related Proposal

I proposed a concrete idea based on this direction:\
(https://dev.to/shimodateakira/why-cant-user-types-have-literals-in-c-3ln1)

C# is no longer just a language for writing programs.

👉 It is becoming a language for expressing meaning directly.

Summary

C# is evolving from type-centric to meaning-centric.

And naturally:

Toward embedding meaning directly into values.