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.
If 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 =…
CShell: A simple, yet powerful, C# scripting IDE
81–90 of 90 posts
Re: CShell: A simple, yet powerful, C# scripting IDE
#82Earlier quoted context omitted.
It probably should have been named CSShell :-)
But I read it as CSS hell. Maybe SharpShell? Anyways, both are better than the original IMHO. By the way, this is really useful. Loaded all our app libraries and works like a charm. I feel much more productive now except for the fact that it made me comment on HN =)
Re: CShell: A simple, yet powerful, C# scripting IDE
#83Nice to see another entrant in this space, offering functionality beyond LINQPad⁰ and the old SnippetCompiler¹. Microsoft has experimented with a REPL of their own² but there's nothing official yet. Mono's REPL³ (MIT X11/GNU GPL; 2008) still has some rough edges on Windows. CS-Script⁴ (MIT; 2009) seems to have received the widest use but was hampered by a weird license until recently. Microsoft MVPs have stepped into…
Filling this gap is what I tried to achieve with CShell. When I started, the Mono REPL was quite a bit ahead of Roslyn still, but now Roslyn overtook it. I'm planning to switch to Roslyn for the execution engine and use NRefactory for the code completion still (especially now that Roslyn is open source).
Where I want CShell to go, is it being a light-weight IDE with a focus on iterative execution. I use LINQPad evey day for DB stuff for example, but when I want to write progressing code, usually exploring some kind of data space - where I test each line, plot some charts, look at the data the variables contain - then there's no real competitor so far for C#. Either you have Matlab, R one one side, or linear code execution environments on the other.
Re: CShell: A simple, yet powerful, C# scripting IDE
#84Earlier quoted context omitted.
But I read it as CSS hell. Maybe SharpShell? Anyways, both are better than the original IMHO. By the way, this is really useful. Loaded all our app libraries and works like a charm. I feel much more productive now except for the fact that it made me comment on HN =)
SharpShell would be a great name - fun alliteration and pretty clear what it's for.
Re: CShell: A simple, yet powerful, C# scripting IDE
#85A combined REPL and editor for C# looks useful. I will try it next time I have some spare time. The name is confusing. A C shell already exists ( http://en.wikipedia.org/wiki/C_shell ). An alternative name could be CSharpShell. Btw, while googling that name, I found CsharpRepl, which seems to be a somewhat similar tool.
For example, I make use of both ipython and bpython, both of which I refer to as either shells or REPLs; though neither program is a proper shell (in the /bin/chsh sense), and though people also call them “interpreters” (technically, the python interpreter still interprets), “environments” (vague) or even “IDEs” (wat?) – the concept behind the tools is popular and well-understood.
Personally I think it’s particularly funny to call these Enhanced REPL Shell Interpreter Environments (or what have you) “IDEs” and lump them in with Eclipse or Visual Studio or those other behemoth coding tools; I like bpython and ipython for the myriad ways they are un-Eclipse-y, and if I did C# I would presumably get into CSharp for the same reasons. All of which, like many bicycle-shed innovations, are mere matters of taste.
Re: CShell: A simple, yet powerful, C# scripting IDE
#86Earlier quoted context omitted.
If 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 =…
They're doing dictionaries in CS6.
Re: CShell: A simple, yet powerful, C# scripting IDE
#87Earlier quoted context omitted.
They're doing dictionaries in CS6.
That's sad. They should do tuples and top-level functions and solve it naturally.
The ugly part of the dictionary is the type parameters, but I can't see a workaround for that without some really hard type-inferencing for all generics. I mean, you'd have to infer the type-parameters of a generic class based on the type-parameter of the IEnumerable passed into its constructor (dictionary takes an IEnumerable of KeyValuePairs of TKey, TValue). That's a little messy.
Re: CShell: A simple, yet powerful, C# scripting IDE
#88Well presented. I clicked the link and spent my loading-spinner time thinking thoughts along the lines of "This is silly. Why would anybody build a C# IDE to compete with VS.NET + ReSharper? Surely nobody would ever use anything but that??? I can't believe that anybody would be cheap enough to..." ... and then I arrived at a page that spent ten seconds clearly explaining exactly why I would want to use this thing eve…
Re: CShell: A simple, yet powerful, C# scripting IDE
#89Earlier quoted context omitted.
That's sad. They should do tuples and top-level functions and solve it naturally.
They are doing a hack for top-level functions - they're adding "using" for static classes so you can pull all the static methods of a class into the local namespace. Don't see how that would help for dictionaries, though. The ugly part of the dictionary is the type parameters, but I can't see a workaround for that without some really hard type-inferencing for all generics. I mean, you'd have to infer the type-paramet…
> let myd = dict [ "a", 1; "the", 2; "train", 3 ];;
val myd : System.Collections.Generic.IDictionary
> let myd = dict [ "a", System.String.IsNullOrEmpty ];;
val myd : System.Collections.Generic.IDictionary bool)>
If C# had tuples, then you might be able to do something like: var myd = createdict(new[] { {"a", 1} , { "the", 2} ...})
The tuples should get a type inferred, then the array, then that can pass the type to createdict and all good. And the array could be removed if there was some other sort of list-like literal. This might be really difficult to implement in the C# compiler, for all I know.More likely, they'll graft in yet another special rule in the compiler (not accessible to user code!), just as they did with other collections, foreach, async, etc. I find it ugly that the compiler is happy to use static duck typing when convenient, but such a feature isn't exposed in the language.
Re: CShell: A simple, yet powerful, C# scripting IDE
#90I'm getting "(35,0): error CS1525: Unexpected symbol `static'" trying to run Tutorial.csx (when MyMath is uncommented), whether running the entire script or just the class and the MyMath.Fibonacci call alone, by Run Selection (then it's "Unexpected symbol `MyMath'"). public static class Foo { public static string B; } Foo.B = "5"; doesn't work either ("Unexpected symbol `Foo'"). I really don't get how to use that thi…
the thing is you can't really mix class definitions and straight scripting lines in one execution. So what you need to do, is execute the class first and then execute the other part. For the MyMath example you'd just select the lines for that class, press Alt+Enter. And then run: > MyMath.Fibonacci(12); With your example, you would enter following in the REPL: > public static class Foo { public static string B; } > F…