简体   繁体   English

Gosu C#是否为JVM?

[英]Is Gosu C# for the JVM?

From what I gather , Gosu is simply C# for the JVM (which is a good thing). 我收集的内容来看,Gosu只是JVM的C#(这是一件好事)。 Is it true? 这是真的吗? What are some difference between Gosu and C# (Except the class library and the fact it runs on JVM) ? Gosu和C#之间有什么区别(除了类库以及它在JVM上运行的事实)?

We didn't build Gosu to be one language or the other for the JVM. 我们没有将Gosu构建为JVM的一种语言或另一种语言。 Rather we built Gosu to be a useful language for the JVM. 相反,我们将Gosu构建为JVM的有用语言。 In addition, we recognized that Gosu needed to be familiar to the multitudes of existing programmers who are most comfortable with the imperative, object-oriented model. 此外,我们认识到Gosu需要熟悉那些对命令式,面向对象模型最熟悉的现有程序员。 To achieve that we borrowed heavily from several languages eg, Java, C#, EcmaScript, Ruby, and some others. 为了实现这一点,我们大量借用了几种语言,例如Java,C#,EcmaScript,Ruby和其他一些语言。 The result, we think, is a language that is uniquely positioned on the JVM. 我们认为,结果是一种独特定位于JVM的语言。

What is entirely unique about Gosu, however, is it's open type system . 然而,Gosu的独特之处在于它是开放式系统

Gosu's type system consists of a configurable number of type loaders. Gosu的类型系统由可配置数量的类型装载器组成。 A type loader's primary responsibility is to resolve a type name in its domain and return an implementation of Gosu's IType interface. 类型加载器的主要职责是解析其域中的类型名称并返回Gosu的IType接口的实现。 This is what is most unique about Gosu -- its type system is open to other domains to participate with first-class representation. 这是Gosu最独特的 - 它的类型系统对其他领域开放,可以参与一流的代表。 I frequently use the term, DST (Domain Specific Type), to get across the idea. 我经常使用术语DST(域特定类型)来理解这个想法。 For instance, Gosu does not discriminate between a Gosu Class a Java Class or XML Type or what have you; 例如,Gosu不区分Gosu类,Java类或XML类型或者您拥有的内容; they're all just types to Gosu's compiler. 他们都只是Gosu编译器的类型。 Check out the DynamicType example in the download to get a glimpse of the power and breadth the open type system provides. 查看下载中的DynamicType示例 ,以了解开放式系统提供的功能和广度。 Essentially, the example demonstrates that C#'s "dynamic types where required" can simply be a new type loader domain in Gosu. 本质上,该示例演示了C#的“动态类型在必要时”可以简单地成为Gosu中的新类型加载器域。 Or check out the Ronin framework to see how easily the web and database domains can map seamlessly into Gosu. 或者查看Ronin框架,了解Web和数据库域可以轻松地无缝映射到Gosu。

It is important to understand that not all type loader domains in Gosu are required to produce bytecode. 重要的是要理解并非Gosu中的所有类型加载器域都需要生成字节码。 Those that do implement an interface for getting at the corresponding Java class. 那些确实实现了获取相应Java类的接口的那些。 Those that don't provide call handlers and property accessors for reflective MethodInfo and PropertyInfo evaluation, respectively. 那些不分别为反射MethodInfo和PropertyInfo评估提供调用处理程序和属性访问器的程序。 Note all types provide TypeInfo, see IType.getTypeInfo(). 注意所有类型都提供TypeInfo,请参阅IType.getTypeInfo()。 For instance, the parser works against the TypeInfo, MethodInfo, etc. abstractions as the means for a level playing field between disparate types. 例如,解析器针对TypeInfo,MethodInfo等抽象作为不同类型之间的公平竞争场的手段。 At runtime, however, unless a type provides a Java bytecode class the MethodInfos and PropertyInfos also are responsible for handling calls. 但是,在运行时,除非类型提供Java字节码类,否则MethodInfos和PropertyInfos也负责处理调用。

No. If you look at the "notable differences" page (differences between Java and Gosu) you'll see a lot of things which are like C#, but also things which aren't in C# such as case-insensitivity and making semi-colons optional. 不,如果你看一下“显着差异”页面(Java和古薮之间的差异),你会看到很多东西像C#,也是东西是不是在C#如不区分大小写,使半冒号可选。 There are also things which certainly aren't mentioned but which are part of C#: 还有一些事情当然没有提到,但它们是C#的一部分:

  • Custom value types 自定义值类型
  • Operator overloading 运算符重载
  • LINQ LINQ
  • Dynamic typing where required 需要时动态打字

I think it would be a mistake to regard Gosu as "C# for the JVM" rather than "a JVM language which mixes bits of Java, bits of C# and some bits from other languages too". 我认为将Gosu视为“JVM的C#”而不是“混合Java的一些JVM语言,C#的位和其他语言的一些位”是错误的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM