Script# 0.8 changes in generated code

你离开我真会死。 提交于 2019-12-11 05:57:14

问题


I've built the latest script# source from Github and started using it in a project. It looks like the way code is generated has changed.

How do I make the compiler go back to the old way of generating code? (the 0.7.x way)


回答1:


There isn't a flag to go back to the old output. The new output brings the AMD pattern for creating script modules to script# generated output, and takes advantage of it to streamline things and make generated script more consistent with accepted patterns.

First is use of the module scope to generate private types better so they are more minimizable. Specifically the whole identifier using '$' as separator is minimized, rather than being left as unminimizable because of the "."... eventually I'll be using that for private members as well.

Public types are exposed in the same way outside the module if you were using the assembly ScriptNamespace attribute previously to minimizing typically longer c# namespaces.

If you weren't using ScriptNamespace, and instead previously you were exposing type such as SomeNamespace.SomeSubnamespace.SomeType, then there is a change on the public surface area as well - the same type is now exposed as SomeModule.MyType (like you would with a ScriptNamespace = SomeModule). Every c# assembly maps to a module.

Again, this is to minimize better, as well as being in sync with patterns that most other script frameworks have adopted. Hope that provides some of the context for the change.

Was there a particular aspect of the old output that you need, rather than essentially the need to keep it the same? If you need exactly the same output as before, then 0.7.x is going to be the version to use.



来源:https://stackoverflow.com/questions/14557863/script-0-8-changes-in-generated-code

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!