4 ms·
As much as i like C#, static typed languages are inadequate when using them in shell. You really don't want to type all that. Powershell has access to the BCL
by mariusmg 12y ago
As much as i like C#, static typed languages are inadequate when using them in shell. You really don't want to type all that.
Powershell has access to the BCL and can do all that with a nicer syntax when using it in the shell.
- ygra 12y agoIt depends. I mostly use PowerShell when trying out things with .NET, sometimes before or while I'm implementing them in C# as well. But depending on what I want to do, LINQ is a very nice thing to have, even though PowerShell has similar capabilities with the pipeline. (Can't really point to anything specific right now – there are instances when I prefer PowerShell and those where I prefer LINQ.) One major reason might be speed, though. PowerShell can be very slow on large-ish data sets. And var in C# saves you from a lot of type-typing.
- TheAnimus 12y ago>static typed languages are inadequate when using them in shell. You really don't want to type all that I'm not sure I understand, what is wrong with dynamic in C#? You've got the anonymous types for quick data structures.
- deleted 12y ago[deleted]
- zeugmasyllepsis 12y agoScala, OCaml/F#, and Haskell beg to differ.
- aroberge 12y agoDid you even look at the link? It is about a REPL for C#.
- alkonaut 12y agoIf your language has you type more because it has a static ype system then it's just poor at inferring types and/or it's syntax has you write out things that it could infer anyway. You may have to write types in C# from time to time, but often you don't have to: // This an array of integers. var x = new[]{1, 2, 3}; // This is a list of integers. var y = x.ToList(); // This is an anonymous type. var pet = new { Age = 10, Name = "Fluffy" }; Zero type names there. Not all types can be inferred by literals though, most annoyingly dictionaries: var myDict = new Dictionary<string, string>{ { "test", "test" }, { "test2", "test2" } }; although I'm sure that could also have been created without typing out the name if you really wanted.
- JoeAltmaier 12y agoInferring types is cool, if it doesn't create bugs. But it does. Its not a lot of work to just say it outright, and it can save your life.
- nlawalker 12y agoCan you elaborate? I'm not sure what you mean.
- JoeAltmaier 12y agoUnexpected conversions can add bugs. Putting a string into a table that was implicitely integer - if your string doesn't start with digits it gets converted to zero. Was that what you intended? Did you think the table would hold a string?
- profquail 12y agoSo it's not actually the type inference that's the problem -- it's developers who carelessly define implicit conversion operators on their classes.
- JoeAltmaier 12y agoStrings have built-in conversion, right?
- nanofortnight 12y agoThe only built-in implicit conversions in C# are for numerics, and there isn't a loss in precision for those (with the exception of int/uint/long/ulong -> float and long/ulong -> double, where there is a loss of precision). http://msdn.microsoft.com/en-us/library/y5b434w4.aspx http://msdn.microsoft.com/en-us/library/y5b434w4.aspx int i = "5"; would not work.
- recursive 12y ago