-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
state of C# scripting in 2022? #309
Comments
I have just started researching this topic, literally this morning. Searching on the internet (google/ddg) is useless, swamped with useless stuff. I found both However So for it's onboarding, seems like |
LOL On a serious note, I feel funny about all this. CS-Script was my response to MS refusal to even consider support for executing C# in a scripting manner. in 2004 I got from a blunt response that "with .NET you do not need it". And this is when Python was already marching through the whole industry. And now... just looking at some of the scripting solutions with mixed feelings... seeing dotnet-script having almost all cs-script core features repeated and scriptcs even repeated it in the name. 😄 I touched on some of these points in my interview for InfoQ, a long time ago. TBH most I am not the best person to ask about other scripting products. Also, most likely you will find in every product some excellent features that are not present in others. Even though the features layout is dynamic and scripting solutions are constantly evolving and improving. Thus I will simply focus on core CS-Script features and its "attitude". CS-Script
The only experience/feature that CS-Script deliberately does not do is REPL. Even though one of CS-Script user donated one for .NET Framework edition. The reason for this is that REPL is a very simple tool that is available from quite a few third-parties. They are very decent and it is close to impossible to build another one that beats the competitors. I hope it gives you a perspective and helps you to make your choice. Cheers |
Eheh I know, but from the few interactions we've had in the past I felt like you are a straight shooter, so I figured why not get the info right from the horse's mouth 😁 !
Looks like I got my answer then. dotnet-script is likely good enough, unless you need advanced features.
Right, that's another point, IMO in the last few years MS has done a great job of catching up with the real world (.NET Core, GitHub, VsCode, etc), and has been surprisingly fast and agile for such a big unwieldly corporation. I think what I'm trying to say with this post too, is that maybe your front page should mention all this, a "disclaimer/state of the art" section at the top: what CS-script solves, how it's different from its competitor (where it's better, where they're similar), and also maybe why CS-script exists (history that led to this odd situation). I may try to take your bullet list below and compare for myself with dotnet-script (I'll probably pretend like scriptcs doesn't exist). Another big thing you didn't mention is performance too: I mostly write one-off scripts, so iteration is key to me, and in the past (at least 2-3 years ago) I've found first-time runs to be slower than ideal (that's one area where Python still has a leg up)... compilation is compilation right, but I'd be interested to see if dotnet-script can do better there.
Wait, what? Roslyn and dotnet are 2 different compilers?
Fine by me, I never got into REPL, in any language... maybe I would with C# though, never really thought about it! In any case I'd probably just use dotnet-shell then. |
Yep, it looks like we are in the agreement then.
Three to be precise. And they give the user some unique scripting experiences. Or you can avoid installing SDK and use just .NET runtime if you use roslyn. The details are here: https://github.com/oleg-shilo/cs-script/wiki/Choosing-Compiler-Engine#compiling-engines-summary |
BTW, I have updated the README.md with the disclaimer and the link to the features overview. |
Hmm, so if I understand correcly:
You know... I hadn't even seen that overview page yet 😅, so thanks for that! |
Correct, except for one thing - dotnet
While first compile time of 8 seconds is shockingly bad (on a good machine 3.5 seconds). I can see how in some scenarios you may choose this option. |
I looked at this all day, have some stuff to share about my 90% complete but successful use case and scripting in general, and the contentious issue of hot reload, debuggers, IDEs that cost money, and coredebug... re: My greatest joy is that no one is debating if we need scripting. again, thanks for keeping such a good humor and giving .net what they alwasy needed all these years. useful for experimental work like fluid dyanmics and AI with tensorflow in C , but with a python front end, but, leaving you wiht something you can deploy and ship, and now on about 10 platforms, with a visualizer like monogame, in a custom CAD like IDE with docking windows, and entity plugins, its great. now net7 is giving me generalized SIMD intrinsics , i have performance gens of 50% this year by going a big 6 week step to Net6, then effortlessly to Net7 last week by changing 6's to 7's. on an aside: So... scripting in CS and .net lives on.. an because of politics between JetBrains and Microsoft.. i think it will need 3rd party support for a while.
In own use case if your are curious, problems almost all solved: updating this an the other stuff i had. i'll share if you care, otherwise skip to the debugger bit at the end... for me i now have everything I really need with cs-script AvalonEdit updated, with the debug.Writelin, the Debug.Break,, injected in th escript and some UI cut from AvalonEdit. my remaining issue is codecompletion and getting off NRefactory and the old c# syntax. so all my old AvalonEdit based stuff is working.. in wpf edit, since its slower now to activate a script after it does preparse, i added buttons to toggle off CSharpParser.SupressCodeAnalysis,, so if i dont want to debug or havent attached one, i shut it off... in my case CodeAnalyiss hasn't any benefit.. and make its slower . its fine.. if the code has errors from new c# sntax i can do a force build and wait, it maybe report errors or just work .. . i need to reference more assemblies more i think for better intellisense. I added a button to switch to CodeDom, that might give me a sort of way to HotReload into the main appdomain, not sure. probably never use it though. I solved the css type prefix i mentioned earlier simply by casting to object for the parameters. The class serializes the same regardless of script or precomilied, wiht a name i provide as attribute. Reflection should give me the properties so im fine, it doenst need strict type i can use reflectoin or type casts to either. so i can load parameters from script that were saved from the original assembly.. havet tried the Syntax tree yet , but i want to look for a complete solution with moer intellisense and mabye even debugging first, and i so I firsr evaluate Notepad ++ and Rosyln pad code code completion, intellisense, and i think i should dig more into roysln pad. Avalonia edit... next.. because the light bulb , intellisense the wpf UI in royln pad is better adn similar to what i have in hy codebase and VS2022 now , and ill then use the CSScript dong the final build... i only care about c#. ill find a solution ... but The real issue is debugging/ inspection... using two tools is a huge context switch.. inspection with writeline sucks but i could probably make a watcher UI rathr than a logger window .... anways i dug to the bottom and i got almost something:
debugging c# outside of VSCode or VS studo or jetbrains who sponsor and have payrolled staff in NetFoundation and compete, its a contentious huge issue wiht legal complications.. but there is a way. its amazing it exists at all...adn so powerful because of new cloud businesses models i guess... **NOPE: https://github.com/eclipse/aCute#concept : mabye, havent looked... https://github.com/Samsung/netcored : the core piece. So if anyone wants to dig deeper or has other vautls i should look at, this is where i stopped for now ..** sorry for the typos im just really overworked now... |
Good stuff. Thank you for sharing. Keep in mind I created CS-Syntaxer so I never need to reverse engineer Roslyn-based intellisense ever again. |
um, just reporting more on the state of debugging scripts since i never found a solution, but seems a major structural shift is in progress at .net foundation, so im curious for an expert's opinion on this , now im sort of future proofing my own roadmap, triaging stuff.. Q: Do you think that a debugging script host should be using the [ LSP protocol ?] https://github.com/julia-vscode/DebugAdapter.jl/blob/master/src/debugger_requests.jl does it seen like an ideal that won't be realized soon for .net? require major, months long overhaul to existing syntaxers? julia IDEs have already moved to this i believe. and Might that mabye allow julia scripts, other langauges ( even unmanaged?) , and .net hosts to speak to each other? and for debuggers and custom tooling IDEs to be buld around that standard? it looks to me like it includes the hooks for code completion, and mabye other domain- specific stuff for a particular application. id love to be able to add julia scripts even if not as binary components. I don't care about VB, but mabye f#.. right now, im all c#.. But i wont proceed with my debugger plans in an adhoc way, if someone else will do it later, adhering to this standards, so that i can live wiitout it then update to .net 8, without my custom IDE limited or breaking. There was an official announcement about MSFT Omnisharp mvoing to that LSP standard, for VSCODE , and it provoced a big flame thread.. since they said some intellisense features will be closed source, tons of peope were triggered , saying that .net and MSFT is tryng ot lock them in to a specific toolling for short term profits, but i think its just the opposite, I think thats reasonable and progressive, if not essential , for .net ecosystem, but based mostly on my intuition.. theres AI , telemetry, privacy, security concerns, involved, and it seems like quite a big, contentious subject, especially if misunderstood or miscommunicated. i dindnt link the MSFT announcement and flame because it will link trace back here, but u'd find it on google and my take is going to be have many thumbs down for not jumping on the MSFT bash mob, as i tend to ramble, get labelled as disruptive even when im offering praise, but i make typos, and fail to be concise, but you seem to understand me anyways :) im on .net 7 and CS-Script and everything basically works except preparsee new c# systaxx, while this pans out...as i don't know how much work is involved for me to to update the preparsing/intellisense..
|
Ho Damian, I have to say that the points you are describing are the very points I also have my focus on. :)
|
I have done some experimenting and was able to solve one of the first problems - mapping StackFrame variables to the variable names. It was in fact non-trivial problem as it required reading portable-pdb. Thus if a poor-man debugger concept is to see the light then the following fundamental POCs need to be accomplished:
As you can see only 1.b is really problematic. I did not find the solution. At least yet. |
Thanks for your advice, I was off my rails with "future proof " worries.. its a really hard problem , both, debugging and about the backbone framework for code completion, debugging ,looking in netcore histories, this "Babel" abstraction they want ,especially wrt to LLVM is kind of unsolved, has things like Vector3 with posits and other numerical types net 7 doesn even have.. etc.. several Archived attempts since 2015 so probably aint gonna happen, soon or ever.. For simpler languages. if it takes an MxN ( features vs languages) problem to a M complexity problem, nice goal ,I've never been there but the brochure looks nice. so agreed.the Omnisharp masterplan doesn't matter like you said. so I plan to do exactly as you advise, try Syntaxer ,improve code completion basics, and test more options to speed it up, and abstractions on CS-script and then 2. But i have an practical simple idea for the debugger...with an idea for. Step In, Out, and Over (below) your suggestion 2 sleep loop Breakpoints, because it's actually better for my case.. in my use case, a frame is a slice in time.. just model state i really need to inspect , not locals or stack frames. .mayge the caller metadata stuff I saw earlier might give me extra stuff for a call stack display. i just usually want to inspect my model and controllers state , the inspectors use the UI thread/ wpf... so ..i do i realize now i can step over / out / and in... at least in script. STEPPING: to step to next, just inject another fake BP after the next statement via parsing for the next statements to the ";" then toggle off the first, and that's a step over. to step In, first put one after the next line as before. But then **Search or parse for the method I'm going to enter which must be in my script but that's usually my focus in that session.. overloads can make this maybe difficult or just put them on all the methods, keep a list to remove after. and then put another fake BP after the first { , then release the top one. so now im Stepped in. To step out.. just means toggle just the last BP placed .. it should revisit the one i put after the caller**. Then I remove all the entry bps i put in the methods. So it's all doable I think. Hope i will find time to try this and report if it worked. Problem would be that when I adjust the script or toggle injected code like this , it recompiles and reloads the plugin, so in my case it will revert the state and called the Loaded method.. Interesting Frame state for me is my model and controller data. its a slice of time usually i put a break in Update(dt) . I need to just stop the simulation and look at the physics objects state,mabye some neuron nodes, filters, feedback control biases, things like that and most those have properties most that notify on changed anyways.. I can visualize with custom visualizers in WPF, property grids, I already use INotifyProperty changed on most . Or an reflect and use mabye the CallerMeta Data will help. So if i get to try this ,ill report and i might have a better experience than vs VStudio debugger that never hotreloads or edit and continue, anymore , and the git copilot AI is spitting crazy Git hub plagiarism bloat..90% of the time. Also for GPGPU and compute shader and tne new Net 7 Generalized SIMD Intrinsics, and other parallel stuff, most practicioners say they don't use stepping debuggers. We need to script and visualize. LIke with Shadertoy.. For the GPGPU or compute shader code.. the SIMD and the C# code that loaded params to the shaders, scripting and seeing changes to those in a custom IDE . Hopefully after i finsih prototyping fluids in my case ill might see huge gains from this stuff.. low effort 2x on vector2 20x,-1000x even, if I learn to use a platform generalized compute shader. As far as Ui and IDEs like dev studio, I need all that stuff the undead wpf has. The docking and access to the backing texture unlocked so I can use.my own graphics renderer, and drive simulation in background threads at 4000 fps while drawing the last unlocked frame at 60 or 120hz hz ,whatever the tv baby wants.Via producer./ Consumer pattern. So I'm using the undead wpf net6 open source ,but it's windows only. There's Avalonia too..I've asked netcore if they might make wpf target open gl , drop SharpDx, or if Silk Windowing abstractions can make some of this more likely.. Doubt it though. but now I'm starting to use touch and stylus more and more ..and wishing for low code techinques like those connectanle custom node graphs for pipelines flows and controller loops .. so I'm clearly interested in maybe doing my IDE on tablets or when I fold my.surface studio to tablet at.least for debugging and tuning, so if Silk Windowing keeps advancing I might be able to one day realize a multiwindow IDE that works on phones , tablets and all PCs too. But for now the existing scripting Net7 might be enough . This i mentioned is way out of my realistic scope.. wish I could be more concise , and |
Glad to see you in such good spirits. 😄 BTW, 1.b in your case can be solved quite easily since you need to access globals but not local variables. Thus you can simply define some static object that has references to your model state. Thus you don't even need to go through the pain of StackFrame but rely on raw Reflection. Good luck. |
just a heads up.. im still studying all your syntaxer and really if i have parameter and overload hints to avalonEdit via your syntaxer ill be ok.. I thnk DomCom is ok. with a long start u tem if i figure out how to set up that and the .syntaxer and get a server runnng for code completion.. Ima assuming that CCScript doenst not include that pre parser/ autocompile dependencies and I need to study synaxer or find an example..how to use Intelillsense Common and the RosylnIntellisnese with AvalonEdit. as far as COD Dom i dont mind the start up i just need to study the local server and what my tech copy pasted from old code, and update to avalonEdit newest stuff.. my trouble is parameter suggestings then i start to type a method. stil im using rosylin for autocomplete and then codedom for buidling? i was less confused about nrefactory. but then I saw this issue icsharpcode/AvalonEdit#333 i look a monaco..https://github.com/microsoft/monaco-editor i though you might be curious.. to me i cant use the websandbox and its so broad in scope im afraind its too much for my needs. tehn i see a net6 update on NRefacotry used my some Mono soft debuger project.. im so confused... I see you also mabye have code on injecting of similar i much study. but im seeing examples on softbreakpoints on mono, a net 6 resurection on NRefactory , all kinds of stuff on github thats got me off my rails aagain.. sorry .. just though you might be curious about monaco-editor... i m gong to study your stuff more thouroughly.. i htink my tech lead copy paste a bunch of old AvaloniaEdit source and i can get a better UI if i can integrate your stuff, that will be find. now suer that the comment 333 really meant but its recent... Sorry ;) im always all over the place finding stuff and not focusing, github is just this massive supernova of stuff... I don't expect a response., ill just though you might want to look at this if you havent) https://microsoft.github.io/monaco-editor/playground.html i wasnt too impressed but is very generalized... can make anyy Domain specific language as well.. |
:) It's pretty interesting. I am arguably 80% done with the POC and aim to release it with the next CS-Script release. It will be an experimental feature that may show the way for devs in a situation as yours. If I am indeed successful then it will have the following features: Core features
Good-to-have features
Limitations:
Will keep you informed. |
thanks for thinking about all ths stuff while actaully getting progress done on your vaults! if you didn see that mono soft breakpoit projct i could try to find it again.. its what i want as well.. i dont wann block and worry about security things.. ..or the fantasy of unifying all those langauages and runtimes, seems a bit far off, and execs dream. but i can build buiding LLVM from Xamarin. for android . but i donn if julia types have any equivalent in .net .. they are more advanced.. tgheres no translatoin from posit to float , yet or varaible lenght int types.. not for SIM .. btw it was a xamarin person who rebuilt the NRefactorhy to net6 after 9 years untouched/ its related to cecil.. mono.. on my use case: because i Cannot find anywone who can code WPF , they are all taken,, and i spend 3 weeks cleaning junior coder repeat code stuff, hack fixes, from former staff, and i cant afford a experience coder, or myself lol...or former staff . so im thinking more using of those Node graph kind of things CAD and electrical design , audio filter tools use.. so you can reorder filters and such.. visuallly then i can minimzie scripting where order of state changes is so hard to cope with if you cant see its flow.. and i can outsource Level design and robot control feedback loop visualizatoins, wiht little gain levels on them, to Fans.. ( whoo love modding) and even sell inhouse tools with a bit of stripting... . ehehe, but i need scripting but i of course will need viusalization.. for shaders, for cad, for paramaterized cad, like Rhino ts all the rage to use those graphs and for even neural nets.. you want to see the neurons and dentrites and gains and biases.... im do plugins because im an old Audoesk alum.. but still .. got to be practical and there will be plugins and scripts.. especially to generate design rom seed like phentotypes .. really i dont need all the latest stuff.. i need to chill out , im just too curious like the um cat... thx for reading my mad thoughts |
Just released the latest version: https://github.com/oleg-shilo/cs-script/releases/tag/v4.6.2.0 |
so this topic went #offtic into #312 (comment) so linking back.. in case that specific issue gets closed mabye this will help peple choose an IDE approach or roadmap. my prose is long winded but i spend over 10- 40 hours following trails networks, some politicis, funding models, corporate relations, and links just to make it that assesssment.. for my usecase at least . and in 3 months it mightg be differfent.. but things recently are starting to show true colors. and i think i feel im aware enough to delegate some further feasibiltiy tests integating for my use case: physics, scripting , controlers for animation and fluid dynamics engines, and real time + simuation visualization/ with producer consumer pattern/ using some touch, with IDE like editiing soft debugger, and live visualization for which there is no general- purpose or at all suitable tool. rapid prototyping c# , f# or whatever via tooling, asnd scripts is now produce assets direclty deployable, as fast and much cheper than deployable c++ code. and chimeras OSS approaches are best.. IMO |
Not a problem, I will close this thread and we can always reopen the discussion 😄 |
I've been using cs-script off and on for quite a few years now, and recently I've gotten quite confused with all the options on the market: cs-script, dotnet-script, Roslyn/CLI/REPL mumbo-jumbo, scriptcs (OMG they just took your name and reversed it, how much more confusing can you get?!)... would you mind summing up their pros and cons?
Basically what I'm really wondering is, is dotnet-script the new standard, and is there still a point to having users install cs-script, when dotnet-script is more or less builtin now? Does cs-script allow for more advances usecases, eg Nuget directives?
The text was updated successfully, but these errors were encountered: