甲功六项检查什么| 检查肚子挂什么科| 肚子痛是什么原因| 智齿为什么叫智齿| 脚踩棉花感见于什么病| 六扇门是什么意思| 速干裤是什么面料| 治疗腱鞘炎用什么药效果好| 花中隐士是什么花| 心脏供血不足用什么药| 树冠是指什么| 副市长是什么级别| 孕早期吃什么水果好| 印字五行属什么| xo是什么酒| 正负得什么| 门口放什么植物好风水| 女儿红是什么| 红薯什么时候传入中国| 槊是什么意思| 报考护士资格证需要什么条件| 胸痛应该挂什么科| cache什么意思| 皮肤容易晒黑是什么原因| 应无所住而生其心是什么意思| 智齿拔了有什么影响| 吃什么不长肉还能瘦| 肝ca什么意思| 男人吃叶酸片有什么好处| 南瓜长什么样子的图片| 肾病钾高吃什么食物好| 血糖高什么水果不能吃| 宫腔镜手术是什么手术| m什么意思| 制作人是干什么的| 北是什么生肖| 魁拔4什么时候上映| 生理曲度变直什么意思| 黑色的猫是什么品种| 95年属什么生肖| 为什么腋下老是出汗| 塞上是什么意思| 一吃东西就牙疼是什么原因引起的| 口腔溃疡长什么样| h1v是什么病| 住院预交金是什么意思| 低压高吃什么药效果好| 子宫腺肌症有什么症状| 剥苔舌是什么原因| 拷贝是什么意思| 越五行属什么| 大学毕业送什么花| 腊肉炒什么好吃| 什么是资本家| 修身养性是什么意思| 第一个月怀孕有什么反应| 八月出生的是什么星座| 补肾壮阳吃什么药效果好| 子宫肌瘤挂什么科室| 红油抄手是什么| 蓝莓是什么味道| chuck是什么意思| 人流前需要检查什么项目| 慧外秀中什么意思| 过敏性鼻炎用什么药最好| 为什么乳头会疼| 绿豆汤放什么糖| lanvin是什么牌子| 头大是什么原因造成的| 特别怕热爱出汗是什么原因| 吃什么能减肥| 舌头麻木是什么征兆| 泰迪狗长什么样子| 意外流产有什么症状| 西洋参和人参有什么区别| 为什么要打破伤风| 象代表什么生肖| 舌苔厚白吃什么药最好| ECG是什么| 风向是指风什么的方向| 肝不好有什么症状有哪些表现| 为什么一喝阿胶睡眠就好了| 电轴右偏是什么意思| 马齿苋煮水喝有什么功效| 心超是检查什么的| 倒签是什么意思| 摔纹皮是什么皮| 活检是什么意思| 牛b克拉斯什么意思| 锁骨发适合什么脸型| 白血病是什么原因引起的| 麻长什么样子图片| 为什么小鸟站在电线上不会触电| 眼下长斑是什么原因| 耻骨疼是什么原因| 喉咙干是什么病的前兆| 吃什么流产最快| 985211是什么意思| 冰箱保鲜室不制冷是什么原因| 今年78岁属什么生肖| 梦见妈妈出轨预示什么意思| pet什么意思| 黄芪什么人不能吃| 白带褐色什么原因| 眼皮肿是什么原因| 什么时候放开二胎政策| 龙凤呈祥的意思是什么| dvd是什么意思| 8月2号是什么星座| o型血容易得什么病| 神经性呕吐是什么症状| 嘴巴苦是什么原因| 疱疹是什么病啊| 红枣泡水喝有什么功效| 北京有什么好玩的地方| 血小板偏低有什么危害| 7.6什么星座| 静脉曲张挂号挂什么科| 拉肚子不能吃什么食物| 查胆囊挂什么科| 总是口渴是什么原因| 普洱属于什么茶| 幽闭恐惧症是什么症状| 5像什么| 埋线有什么好处和坏处| 冚家铲是什么意思| 什么是主观什么是客观| 面瘫吃什么药好| 洗牙有什么好处和坏处| 吃什么补气虚| 淋巴门消失是什么意思| 什么是重生| 拐枣泡酒有什么功效| 夏枯草有什么作用| 泡热水脚有什么好处| e m s是什么快递| 晒背有什么好处| 阴阳八卦是什么生肖| 省委书记什么级别| 再生聚酯纤维是什么面料| 小肠气有什么症状| 梦到知了猴是什么意思| 染指是什么意思| 月经先期是什么意思| 药店为什么不让卖高锰酸钾| 大便干燥一粒一粒的是什么原因| k值是什么意思| 带状疱疹是什么症状| 古尔邦节什么意思| 刘少奇属什么生肖| ofs是什么意思| 胃胀吃什么| 性生活后尿路感染是什么原因| 肛门指检能查出什么| 乌龟能吃什么| 大什么什么什么成语| 脱发吃什么| 国药准字号是什么意思| 深海鱼都有什么鱼| 孩子不好好吃饭是什么原因| 复方阿胶浆适合什么样的人喝| 时令水果是什么意思| 未见明显胚芽是什么意思| 什么叫雷达| 全身痒是什么病的前兆| 人力资源是什么意思| ln是什么| hi是什么意思| 属虎的脖子戴什么招财| 梦到丧事场面什么意思| 口杯是什么意思| 吃玉米有什么好处| 验尿白细胞高是什么原因| 幼小衔接班是什么意思| 梦见着火了是什么征兆| 主人杯是什么意思| 尿道感染挂什么科| 梦到喝酒是什么意思| 人体出汗多是什么原因| 什么是大姨妈| 04属什么生肖| 冰丝和天丝有什么区别| 狗狗肠胃不好吃什么药最好| 牙齿脱矿是什么原因| crs是什么意思| 肝属于五行中的什么| 七五年属什么| 为什么叫买东西不叫买南北| 过敏了吃什么药好| 为什么下巴经常长痘痘| 景色奇异的异是什么意思| 肝肾阴虚吃什么中成药| 什么是瞬时速度| 月经提前是什么原因| 多吃什么对肾好| 脆皮是什么意思| 命中劫是什么意思| 精索静脉曲张有什么症状| 2023年属兔的是什么命| pv是什么| 珊瑚红是什么颜色| 学生早餐吃什么方便又营养| 梦见去扫墓是什么预兆| 一天从早到晚叫什么日| 严重失眠挂什么科| 沙漏是什么意思| 看淡是什么意思| 甲状腺吃什么盐| pwi是什么意思| 什么是取保候审| 梦见来月经是什么意思| 文殊菩萨是保佑什么的| 贫血有什么危害| 生育酚乙酸酯是什么| 单核细胞百分比偏高是什么原因| 从良是什么意思| 复方对乙酰氨基酚片是什么药| 夏季热是什么病| 肝部有阴影一般都是什么病| 勾芡用什么淀粉| 和风对什么| 盆腔炎用什么药好| 梦见陌生人死了是什么意思| 听什么音乐容易入睡| 为国为民是什么生肖| 没有胎心胎芽是什么原因造成的| 脚心抽筋是什么原因引起的| 黑手是什么意思| 什么的表达| 表里不一是什么意思| 桂圆和龙眼有什么区别| 胃体息肉是什么意思| 什么是阳气| 什么越来越什么什么越来越什么| 鲭鱼是什么鱼| cb是什么| 多囊卵巢综合症有什么症状| 滑板什么意思| 知柏地黄丸有什么功效| 西布曲明的危害及副作用分别是什么| 笔试是什么意思| 干性皮肤适合什么牌子的护肤品| 万年历是什么| 脸上不停的长痘痘是什么原因| 脚肿吃什么药消肿| gln是什么氨基酸| 酸梅汤不适合什么人喝| 三月18号是什么星座的| 包二奶什么意思| 93年的鸡是什么命| 北洋军阀是什么意思| 独家记忆是什么意思| 梦见车丢了是什么征兆| 什么茶解酒效果比较好| 澳门使用什么货币| 肥肠烧什么配菜好吃| 胃食管反流有什么症状| 喉结肿大是什么原因| 矿泉水敷脸有什么作用| 戒指带中指什么意思| 负压是什么意思| 头皮屑多是什么原因引起的| 掉头发缺什么维生素| 身份证末尾x代表什么| 百度Jump to content

[股票技术分析]如何看单根长阳线的买进信号?

From Wikipedia, the free encyclopedia
Oxygene
Paradigmobject-oriented
DeveloperRemObjects Software
First appeared2005; 20 years ago (2005)[1]
PlatformCommon Language Infrastructure, Java, Cocoa, CPU-Native, Windows 32/64 bit, Linux 32/64 bit, WebAssembly
LicenseTrialware
Websiteelementscompiler.com/elements/oxygene/
Influenced by
Delphi's Object Pascal, C#
百度   华南某大型基金公司基金经理认为,此番要求对于奔着建仓的前三个月能投存单而成立的债基影响较明显,部分银行委外会采用这种模式,其投债基初衷就是为了走通道冲同业存单规模。

Oxygene (formerly known as Chrome) is a programming language developed by RemObjects Software for Microsoft's Common Language Infrastructure, the Java Platform and Cocoa. Oxygene is based on Delphi's Object Pascal, but also has influences from C#, Eiffel, Java, F# and other languages.

Compared to the now deprecated Delphi.NET, Oxygene does not emphasize total backward compatibility, but is designed to be a "reinvention" of the language, be a good citizen on the managed development platforms, and leverage all the features and technologies provided by the .NET and Java runtimes.

Oxygene is a commercial product and offers full integration into Microsoft's Visual Studio IDE on Windows, and its own IDE called Fire for use on macOS. Oxygene is one of six languages supported by the underlying Elements Compiler toolchain, next to C#, Swift, Java, Go and Mercury (based on Visual Basic (.NET)).

From 2008 to 2012, RemObjects Software licensed its compiler and IDE technology to Embarcadero to be used as the backend compiler in their Embarcadero Prism product.[2] Starting in the Fall of 2011, Oxygene became available in two separate editions, with the second edition adding support for the Java and Android runtimes. Starting with the release of XE4, Embarcadero Prism is no longer part of the RAD Studio SKU. Numerous support and upgrade paths for Prism customers exist to migrate to Oxygene.[3] As of 2016, there is only one edition of Oxygene, which allows development on Windows or macOS, and which can create executables for Windows, Linux, WebAssembly .NET, iOS, Android, Java and macOS.

The language

[edit]

The Oxygene language has its origins in Object Pascal in general and Delphi in particular, but was designed to reflect the guidelines of .NET programming and to create fully CLR-compliant assemblies. Therefore, some minor language features known from Object Pascal – Delphi have been dropped or revised, while many new and more modern features, such as Generics or Sequences and Queries have been added to the language.

Oxygene is an Object-oriented programming language. Thus, it uses classes, which can hold data and execute code, to design programs.[clarification needed] Classes are "prototypes" for objects, like the idea of an apple is the prototype for the apple one can actually buy in a shop. It is known that an apple has a colour, and that it can be peeled: those are the data and executable "code" for the apple class.

Oxygene provides language-level support for some features of parallel programming. The goal is to use all cores or processors of a computer to improve performance. To reach this goal, tasks must be distributed among several threads. The .NET Framework's ThreadPool class offered a way to efficiently work with several threads. The Task Parallel Library (TPL) was introduced in .NET 4.0 to provide more features for parallel programming.

Operators can be overloaded in Oxygene using the class operator syntax:

class operator implicit(i : Integer) : MyClass;

Note, that for operator overloading each operator has a name, that has to be used in the operator overloading syntax, because for example "+" would not be a valid method name in Oxygene.[4]

Program structure

[edit]

Oxygene does not use "Units" like Delphi does, but uses .NET namespaces to organize and group types. A namespace can span multiple files (and assemblies), but one file can only contain types of one namespace. This namespace is defined at the very top of the file:

namespace ConsoleApplication1;

Oxygene files are separated into an interface and an implementation section, which is the structure known from Delphi. The interface section follows the declaration of the namespace. It contains the uses clause, which in Oxygene imports types from other namespaces:

uses
  System.Linq;

Imported namespaces must be in the project itself or in referenced assemblies. Unlike in C#, in Oxygene alias names cannot be defined for namespaces, only for single type names (see below).

Following the uses clause a file contains type declarations, like they are known from Delphi:

interface

type
  ConsoleApp = class
  public
    class method Main;
  end;

As in C#, the Main method is the entry point for every program. It can have a parameter args : Array of String for passing command line arguments to the program.

More types can be declared without repeating the type keyword.

The implementation of the declared methods is placed in the implementation section:

implementation

class method ConsoleApp.Main;
begin
  // add your own code here
  Console.WriteLine('Hello World.');
end;

end.

Files are always ended with end.

Types

[edit]

As a .NET language, Oxygene uses the .NET type system: There are value types (like structs) and reference types (like arrays or classes).

Although it does not introduce own "pre-defined" types, Oxygene offers more "pascalish" generic names for some of them,[5] so that for example the System.Int32 can be used as Integer and Boolean (System.Boolean), Char (System.Char), Real (System.Double) join the family of pascal-typenames, too. The struct character of these types, which is part of .NET, is fully preserved.

As in all .NET languages types in Oxygene have a visibility. In Oxygene the default visibility is assembly, which is equivalent to the internal visibility in C#. The other possible type visibility is public.

type
  MyClass = public class
end;

The visibility can be set for every type defined (classes, interfaces, records, ...).

An alias name can be defined for types, which can be used locally or in other Oxygene assemblies.

type
  IntList = public List<Integer>; //visible in other Oxygene-assemblies
  SecretEnumerable = IEnumerable<String>; //not visible in other assemblies

Public type aliases won't be visible for other languages.

Records

[edit]

Records are what .NET structs are called in Oxygene. They are declared just like classes, but with the record keyword:

type
  MyRecord = record
    method Foo;
  end;

As they're just .NET structs, records can have fields, methods and properties, but do not have inheritance and cannot implement interfaces.

Interfaces

[edit]

Interfaces are a very important concept in the .NET world, the framework itself makes heavy use of them. Interfaces are the specification of a small set of methods, properties and events a class has to implement when implementing the interface. For example, the interface IEnumerable<T> specifies the GetEnumerator method which is used to iterate over sequences.

Interfaces are declared just like classes:

type
  MyInterface = public interface
    method MakeItSo : IEnumerable;
    property Bar : String read write;
  end;

Please notice, that for properties the getter and setter are not explicitly specified.

Delegates

[edit]

Delegates define signatures for methods, so that these methods can be passed in parameters (e.g. callbacks) or stored in variables, etc. They're the type-safe NET equivalent to function pointers. They're also used in events. When assigning a method to a delegate, one has to use the @ operator, so the compiler knows, that one doesn't want to call the method but just assign it.

Oxygene can create anonymous delegates; for example methods can be passed to the Invoke method of a control without declaring the delegate:

method MainForm.MainForm_Load(sender: System.Object; e: System.EventArgs);
begin
  Invoke(@DoSomething);
end;

An anonymous delegate with the signature of the method DoSomething will be created by the compiler.

Oxygene supports polymorphic delegates, which means, that delegates which have parameters of descending types are assignment compatible. Assume two classes MyClass and MyClassEx = class(MyClass), then in the following code BlubbEx is assignment compatible to Blubb.

type
  delegate Blubb(sender : Object; m : MyClass);
  delegate BlubbEx(sender : Object; mx : MyClassEx);

Fields can be used to delegate the implementation of an interface, if the type they're of implements this interface:

Implementor = public class(IMyInterface)
  // ... implement interface ...
end;

MyClass = public class(IMyInterface)
  fSomeImplementor : Implementor; public implements IMyInterface; //takes care of implementing the interface
end;

In this example the compiler will create public methods and properties in MyClass, which call the methods / properties of fSomeImplementor, to implement the members of IMyInterface. This can be used to provide mixin-like functionality.[6]

Anonymous methods

[edit]

Anonymous methods are implemented inside other methods. They are not accessible outside of the method unless stored inside a delegate field. Anonymous methods can use the local variables of the method they're implemented in and the fields of the class they belong to.

Anonymous methods are especially useful when working with code that is supposed to be executed in a GUI thread, which is done in .NET by passing a method do the Invoke method (Control.Invoke in WinForms, Dispatcher.Invoke in WPF):

method Window1.PredictNearFuture;  //declared as async in the interface
begin
  // ... Calculate result here, store in variable "theFuture"
    Dispatcher.Invoke(DispatcherPriority.ApplicationIdle, method; begin
      theFutureTextBox.Text := theFuture;
    end);
end;

Anonymous methods can have parameters, too:

method Window1.PredictNearFuture;  //declared as async in the interface
begin
  // ... Calculate result here, store in variable "theFuture"
    Dispatcher.Invoke(DispatcherPriority.ApplicationIdle, method(aFuture : String); begin
      theFutureTextBox.Text := aFuture ;
    end, theFuture);
end;

Both source codes use anonymous delegates.

Property notification

[edit]

Property notification is used mainly for data binding, when the GUI has to know when the value of a property changes. The .NET framework provides the interfaces INotifyPropertyChanged and INotifyPropertyChanging (in .NET 3.5) for this purpose. These interfaces define events which must be fired when a property is changed / was changed.

Oxygene provides the notify modifier, which can be used on properties. If this modifier is used, the compiler will add the interfaces to the class, implement them and create code to raise the events when the property changes / was changed.

property Foo : String read fFoo write SetFoo; notify;
property Bar : String; notify 'Blubb'; //will notify that property "Blubb" was changed instead of "Bar"

The modifier can be used on properties which have a setter method. The code to raise the events will then be added to this method during compile time.

Code examples

[edit]

Hello World

[edit]
namespace HelloWorld;

interface

type
  HelloClass = class
  public
    class method Main;
  end;

implementation

class method HelloClass.Main;
begin
  writeLn('Hello World!');
end;

end.

Generic container

[edit]
namespace GenericContainer;

interface

type
  TestApp = class
  public
    class method Main;
  end;

  Person = class
  public
    property FirstName: String;
    property LastName: String;     
  end;

implementation

uses
  System.Collections.Generic;

class method TestApp.Main;
begin
  var myList := new List<Person>; //type inference
  myList.Add(new Person(FirstName := 'John', LastName := 'Doe')); 
  myList.Add(new Person(FirstName := 'Jane', LastName := 'Doe'));
  myList.Add(new Person(FirstName := 'James', LastName := 'Doe')); 
  Console.WriteLine(myList[1].FirstName);  //No casting needed
  Console.ReadLine;       
end;

end.

Generic method

[edit]
namespace GenericMethodTest;

interface

type
GenericMethodTest = static class
public
  class method Main;
private
  class method Swap<T>(var left, right : T);
  class method DoSwap<T>(left, right : T);
end;

implementation

class method GenericMethodTest.DoSwap<T>(left, right : T);
begin
  var a := left;
  var b := right;
  Console.WriteLine('Type: {0}', typeof(T));
  Console.WriteLine('-> a = {0}, b = {1}', a , b);
  Swap<T>(var a, var b);
  Console.WriteLine('-> a = {0}, b = {1}', a , b);
end;

class method GenericMethodTest.Main;
begin
  var a := 23;// type inference
  var b := 15;
  DoSwap<Integer>(a, b); // no downcasting to Object in this method.

  var aa := 'abc';// type inference
  var bb := 'def';
  DoSwap<String>(aa, bb); // no downcasting to Object in this method.

  DoSwap(1.1, 1.2); // type inference for generic parameters
  Console.ReadLine();
end;

class method GenericMethodTest.Swap<T>(var left, right : T);
begin
  var temp := left;
  left:= right;
  right := temp;
end;

end.

Program output:

Type: System.Int32
-> a = 23, b = 15
-> a = 15, b = 23
Type: System.String
-> a = abc, b = def
-> a = def, b = abc
Type: System.Double
-> a = 1,1, b = 1,2
-> a = 1,2, b = 1,1

Differences between Delphi and Oxygene

[edit]
  • unit: Replaced with the namespace keyword. Since Oxygene doesn't compile per-file but per-project, it does not depend on the name of the file. Instead the unit or namespace keyword is used to denote the default namespace that all types are defined in for that file
  • procedure and function: method is the preferred keyword, though procedure and function still work.
  • overload: In Oxygene all methods are overloaded by default, so no special keyword is needed for this
  • .Create(): This constructor call has been replaced by the new keyword. It can still be enabled in the project options for legacy reasons
  • string: Characters in strings are zero-based and read-only. Strings can have nil values, so testing against empty string is not always sufficient.

Criticism

[edit]

Some people[who?] would like to port their Win32 Delphi code to Oxygene without making major changes. This is not possible because while Oxygene looks like Delphi, there are enough changes so as to make it incompatible for a simple recompile. While the name gives it the appearance of another version of Delphi, that is not completely true.[7]

On top of the language difference, the Visual Component Library framework is not available in Oxygene.[8] This makes porting even more difficult because classic Delphi code relies heavily on the VCL.

See also

[edit]

References

[edit]
  1. ^ "Evolution of the Oxygene Language | Oxygene | Elements". Archived from the original on 2025-08-07. Retrieved 2025-08-07.
  2. ^ "Embarcadero Prism page, at the bottom of the page an image stating it is powered by RemObjects Oxygene". Archived from the original on 2025-08-07. Retrieved 2025-08-07.
  3. ^ "Prism XE4, Where Art Thou? | RemObjects Blogs". Archived from the original on 2025-08-07. Retrieved 2025-08-07.
  4. ^ "Operator Overloading - Delphi Prism". Archived from the original on 2025-08-07. Retrieved 2025-08-07.
  5. ^ "Built-In Types - Delphi Prism". Archived from the original on 2025-08-07. Retrieved 2025-08-07.
  6. ^ "Provide Mixin-like functionality - Delphi Prism". Archived from the original on 2025-08-07. Retrieved 2025-08-07.
  7. ^ "A Stack Overflow discussion where people remark that Oxygene is not Delphi Win32". Archived from the original on 2025-08-07. Retrieved 2025-08-07.
  8. ^ "Delphi Prism 2010 review where they state in the third paragraph that VCL.net is not available". Archived from the original on 2025-08-07. Retrieved 2025-08-07.
[edit]
激素六项什么时间查最好 梦见大黑蛇是什么预兆 1957年发生了什么 帕金森吃什么药效果好 小钙化灶是什么意思
双手麻木是什么原因 apc是什么药 鲩鱼是什么鱼 广西北海有什么好玩的地方 多喝水有什么好处和坏处
肺炎用什么药 吃力不讨好是什么意思 什么气什么足 老打瞌睡犯困是什么原因 手筋鼓起来是什么原因
二氧化碳是什么意思 alb是什么意思 普惠幼儿园是什么意思 2020年是属什么生肖 农历闰月有什么规律
心跳快吃什么药hcv8jop3ns3r.cn 48岁属什么生肖hcv9jop7ns5r.cn 一什么猪baiqunet.com 隔离和防晒有什么区别hcv9jop2ns7r.cn 天之骄子是什么意思onlinewuye.com
知了代表什么生肖hcv7jop9ns8r.cn 搪瓷杯为什么被淘汰了hcv9jop0ns7r.cn 什么是周围神经病gysmod.com 大脚趾头疼是什么原因hcv9jop0ns9r.cn 做月子吃什么菜hcv7jop7ns1r.cn
今年什么时间进伏hcv7jop5ns3r.cn 强的松又叫什么hcv7jop6ns9r.cn 涟漪是什么意思zhongyiyatai.com 女性腰酸是什么妇科病hcv8jop5ns9r.cn 鼻涕有血丝是什么原因hcv8jop9ns9r.cn
不正常的人有什么表现hcv8jop2ns0r.cn 幽灵是什么意思hcv9jop3ns9r.cn 青鱼吃什么hcv7jop4ns8r.cn 女性喝什么利尿最快hcv8jop1ns3r.cn 变蛋吃多了有什么危害dajiketang.com
百度