3 ms·
Very strange take in my opinion. I haven't used C# in a while but I guess the compiler doesn't warn when you discard a return value? I suppose that's kind of an
by jeroenhd 6y ago
Very strange take in my opinion. I haven't used C# in a while but I guess the compiler doesn't warn when you discard a return value? I suppose that's kind of annoying when debugging. I don't know about many languages that do this by default though.
I also don't understand how you can have a "return true" for a function that's supposed to return a formatted value.
I don't know what a C# notebook is, but the difference between a statement and an expression is made in any imperative programming language I know. However, the example is very strange; why would putting a semicolon at the end of the line make any difference? Why should it even compile without it?
As for the ICompare interface, I think the author has a point. The example class they give is unnecessarily complex, but they're right that the lack of concise inline class definitions can sometimes be annoying. However, I'm pretty sure you can use lamba functions to do the exact same thing the author is showing in F#, down to storing the comparator as a Func<> variable.
The lack of HTML generation is also a weird one. C# is not a template language and is not intended to be one. You can use ASP to generate HTML pages fine, but I don't understand the value of a DSL to generate HTML in pure C#. Is the loj 't that the syntax can't be radically reformed? Because I consider that to be a good thing.
The point I take away from this rant is that the author is trying to use an imperative language with some functional language features as a fully functional language. These aren't shortcomings of C#, this is the result of using the wrong tool (or using the tool wrong) for the job.
- goto11 6y agoThe compiler does warn when you discard a value, but I assume a C# notebook is something like Jupyter? It is probably a special case in that environment. There is Comparer.Create convenience method which creates an IComparer instance from a lambda. But yeah it is a workaround.
- np_tedious 6y agoSounds fine to me. Unused valuable will get you some squiggle warnings in the editor, but not in a notebook. As far as "language gotcha" articles go this is pretty weak IMO
- dcanelhas 6y agoThe semicolon at the end of a statement is possibly matlab-inspired.
- siwatanejo 6y ago> The compiler does warn when you discard a value The C# compiler doesn't; the F# compiler does.