ported to C# 4 - #3
Conversation
Avoiding features: "using static", string interpolations with $ and null-checks with ?. op. String interpolations were replaced with string.Format. null-checks are done use if statement. "using static" is a bit trickier: - ListConstructor was inserted explicitly, - all methods from Symbolism.Constructors and Symbolism.Trigonometric.Constructors were moved into Symbolism.Function and inheritance was used to "import" names.
dharmatech
commented
Nov 5, 2015
Wow, this is impressive Aleksey! Very cool that you were able to backport everything. I'll definitely leave this pull request here as a reference in case anyone else needs to port to C# 4. If you're free and willing to comment, would love to know more about why you needed to stick with C# 4.0. |
AlekseyCherepanov
commented
Nov 5, 2015
On Wed, Nov 04, 2015 at 07:52:24PM -0800, dharmatech wrote:
Much more impressive is that you have a firm style. :-) It simplified
Thank you!
C# 6 was not convenient for me because I teach students and there is Also I tried other systems: this one I teach students Difference equations (not differential equations) and
And then, we manipulate the formula. I had to write some code to make I'll open some issues to talk about problems and possible new features. Thanks! Regards, |
dharmatech
commented
Nov 5, 2015
Yes, unfotunately the If they decide to add an operator for exponentiation, it will likely be |
dharmatech
commented
Nov 5, 2015
Yes, please do! |
dharmatech
commented
Nov 5, 2015
Wow, that's very cool. This is the first I've ever heard of Symbolism being used in a classroom. I wasn't expecting that! But I'm glad to hear it suited your needs. |
Avoiding features: "using static", string interpolations with $ and null-checks with ?. op.
String interpolations were replaced with string.Format.
null-checks are done use if statement.
"using static" is a bit trickier:
Also avoided => for method definitions.
I applied the following one-liners to parts of code, not to full files (C-| in emacs):
perl -pe '@A = (); $a = 0; s/$//; s/{([^}]+)}/push @A, $1; "{" . $a++ . "}"/ge; s/"."/"string.Format($&, " . (join ", ", @A) . ")"/ge'
perl -lpe 's/=> /{ return / && s/\s$/ }/'
Feel free to ignore this pull-request if you would like to keep your code as C# 6. I find "using static" feature useful, while my inheritance is a dirty hack.