Proposal: Radical simplification of the C# syntax
See original GitHub issueWell, that would be a new language of course. But a language with essentially the same semantics as C#. Let’s call it D# (D-Sharp). Why: save typing, remove visual noise.
Instead of writing (C#):
using static System.Console;
namespace Example.CSharp // Namespace is nesting
{
class Program
{
static void Main(string[] args)
{
int a = 10;
int b = 20;
if (a == 10) {
if (b == 20) {
WriteLine("Value of a is 10 and b is 20");
} else if (b > 50) {
WriteLine("Value of a is 10 and b greater than 50");
} else {
WriteLine("Value of a is 10");
}
}
switch (a)
{
case 0:
case 1:
case 2:
WriteLine("Low number");
break;
case 3:
case 4:
case 5:
WriteLine("Medium number");
break;
default:
WriteLine("Other number");
break;
}
while (a < 1000) {
WriteLine(a);
a *= 2;
}
do {
WriteLine(b);
b *= 2;
} while (b < 1000)
ReadLine();
}
}
}
we would write (D#):
using static System.Console
namespace Example.DSharp // Namespace is a not nesting, thus saving one indentation level.
class Program
static void Main(string[] args)
int a = 10
int b = 20
if a == 10
if b == 20
WriteLine("Value of a is 10 and b is 20")
elsif b > 50
WriteLine("Value of a is 10 and b greater than 50")
else
WriteLine("Value of a is 10")
switch a
case 0, 1, 2
WriteLine("Low number")
case 3, 4, 5
WriteLine("Medium number")
default
WriteLine("Other number")
while a < 1000
WriteLine(a)
a *= 2
do
WriteLine(b)
b *= 2
until b >= 1000 // Since while would be ambiguous, we use until instead.
ReadLine()
The syntax would be line-oriented with smart line continuation. Blocks would solely be defined by indentation (as in python).
Of course there is a lot more to be nailed down, but this is only the starting point for a discussion. What do you think of it?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:29
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Simplifying Radical Expressions Using the Product Rule ...
Let c be a real number. If a 2 = c, then a is a square root of c. Real numbers have two...
Read more >Simplifying Radical Expressions – Made Easy
For a radical expression to be in the simplest form, three conditions must be met: 1. The radicand contains no factor greater than...
Read more >How to Simplify a Product of Radical Expressions
Learn how to simplify a product of radical expressions, and see examples that walk through sample problems step-by-step for you to improve ...
Read more >9.1 Properties of Radicals
Simplify expressions by rationalizing the denominator. Perform operations with radicals. Using Properties of Radicals. A radical expression is an expression ...
Read more >Simplifying Radicals: Definition & Examples
Simplifying radicals means rewriting them in the most simple and fundamental possible way. Sometimes you'll be able to get rid of the radical...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@OJacot-Descombes Great idea. Can you please create a dedicated github repo for its development?
F# is whitespace significant and has a “simplified” syntax to an extent that seem like it infers program logic from developer’s feelings.