KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Introduction As a developer, I'm involved in writing a lot of mathematical code everyday and I'd like to add very few syntactic sugar to the C# language to ease code writing and reviewing. I've already read about this thread and this other one for possible solutions and would simply like to know which best direction to go and how much effort it may represent to solve only for the three following syntactical issues*. *: I can survive without described syntactic sugars, but if it ain't too much work and Rube-Goldberg design for simple compilation process, it may be interesting to investigate further. 1. Multiple output arguments I'd like to write: [double x, int i] = foo(z); Instead of: double x; int i; foo(out x, out i, z); NB: out parameters being placed first and foo being declared as usual (or using same kind of syntax). 2. Additional operators I'd like to have a few new unary/binary operators. Don't know much how to define for these (and it seems quite complex for not introducing ambiguity when parsing sources), anyway would like to have something like: namespace Foo { using binary operator "\" as "MyMath.LeftDivide"; using unary operator "'" as "MyMath.ConjugateTranspose"; public class Test { public void Example() { var y = x'; var z = x \ y; } } } Instead of: namespace Foo { public class Test { public void Example() { var y = MyMath.ConjugateTranspose(x); var z = MyMath.LeftDivide(x, y); } } } 3. Automatic name insertion for static classes It's extremely unappeali
Tags (comma-separated)
Save Edits
Cancel