Share to: share facebook share twitter share wa share telegram print page

Oberon

Oberon
编程范型指令式, 结构化, 模块化, 面向对象
语言家族Wirth Oberon
設計者Niklaus Wirth
實作者苏黎世联邦理工学院
发行时间1987年,​37年前​(1987
型態系統强类型, 混合(静态动态
作用域词法
系统平台ARM, StrongARM; IA-32, x86-64; SPARC, Ceres英语Ceres (workstation) (NS32032英语NS32000)
操作系统Windows, Linux, Solaris, classic Mac OS, Atari TOS, AmigaOS
網站www.projectoberon.com
啟發語言
Modula-2
影響語言
Modula-3, Oberon-2英语Oberon-2, Component Pascal英语Component Pascal, Active Oberon英语Active Oberon, Oberon-07, Nim, Go, Zonnon英语Zonnon

Oberon是一种通用编程语言,最初由尼克劳斯·维尔特在1987年推出,是维尔特风格的类ALGOL语言中的最后一员(继Euler英语Euler (programming language)ALGOL WPascalModulaModula-2之后)[1][2][3][4]。Oberon是增进Pascal的直接后继者Modula-2的能力,并减少其复杂度的集中努力的结果。它的原理性新特征是记录类型的类型扩展的概念[5]。它允许新数据类型构造在现存数据类型之上并关联于它们,脱离了严格的静态类型数据的教条。Oberon是在瑞士苏黎世联邦理工学院作为Oberon操作系统英语Oberon (operating system)实现的一部份而开发的。这个名字来自天王星的卫星奧伯隆

Oberon的当前版本是2007年修订的Oberon-07,它仍由维尔特来维护而Oberon计划编译器最近更新于2020年3月6日[6]

设计

Oberon的基本指导原则是集中于基础和根本的特征,并忽略短暂性的问题。另一个因素是认识到了在语言如C++Ada中复杂度的增长。与它们相反,Oberon强调使用概念来扩展语言。在Modula-2中提供的枚举和子范围类型被省略了;类似的集合类型被限制为小的整数集合,而低层设施的数量被大幅度缩减(特别是省略了类型转移函数)。省略余下的潜在不安全设施,是得到真正的高级语言的最根本步骤。甚至跨越模块的非常紧密的类型检查,严格的运行时间索引检查空指针检查,和安全的类型扩展概念,在很大程度上允许编程单独的依仗于语言规则。

这种策略的意图是产生易于学习、实现更简单和高效的语言。Oberon编译器被认为是简明和快速的,却提供了可比拟于商业编译器的代码质量[7]

特征

Oberon的曾用标志

刻画Oberon语言的特征包括[8]

  • 具有大写关键字的大小写敏感语法。
  • 具有类型测试的类型扩展。
  • 模块和分离编译。
  • 字符串操作。
  • 孤立不安全代码。
  • 支持系统编程。

面向对象示例

Oberon支持对记录类型的扩展,用于抽象和异构结构的构造。不同于后期方言即1991年提出的Oberon-2英语Oberon-2和1998年提出的Active Oberon英语Active Oberon,最初的Oberon缺乏作为语言特征的分派机制,而是把它作为一种编程技术或设计模式。这给出了在OOP上的巨大灵活性。在Oberon操作系统英语Oberon (operating system)中,两种技术被一起用于分派调用:方法套件和消息处理器。

方法套件

在这种技术中,泛化模块定义过程变量的一个表格类型,而扩展模块中声明这个类型的一个共享变量,泛化模块中的方法要访问这个表格的对应项目,而扩展模块将这个表格的项目指派到自己相应的过程:

MODULE Figures; (* 抽象模块 *)

  TYPE
    Figure* = POINTER TO FigureDesc;
    Interface* = POINTER TO InterfaceDesc;
 
    InterfaceDesc* = RECORD
      draw* : PROCEDURE (f : Figure);
      clear* : PROCEDURE (f : Figure);
      mark* : PROCEDURE (f : Figure);
      move* : PROCEDURE (f : Figure; dx, dy : INTEGER);
    END;
 
    FigureDesc* = RECORD
      if : Interface;
    END;
 
  PROCEDURE Init* (f : Figure; if : Interface);
  BEGIN
    f.if := if;
  END Init;
 
  PROCEDURE Draw* (f : Figure);
  BEGIN
    f.if.draw(f);
  END Draw;
 
(* 这里是其他过程Clear、Mark和Move *)
 
END Figures.

扩展泛化类型Figure为特定形状Rectangles

MODULE Rectangles;
 
  IMPORT Figures;
 
  TYPE
    Rectangle* = POINTER TO RectangleDesc;
 
    RectangleDesc* = RECORD
      (Figures.FigureDesc)
      x, y, w, h : INTEGER;
    END;
 
  VAR
    if : Figures.Interface;
 
  PROCEDURE New* (VAR r : Rectangle);
  BEGIN
    NEW(r);
    Figures.Init(r, if);
  END New;
 
  PROCEDURE Draw* (f : Figure);
    VAR
      r : Rectangle;
  BEGIN
    r := f(Rectangle); (* f具有Rectangle类型 *)
    (* ... *)
  END Draw;
 
(* 这里是其他过程Clear、Mark和Move *)
 
BEGIN (* 模块初始化 *)
  NEW(if);
  if.draw := Draw;
  if.clear := Clear;
  if.mark := Mark;
  if.move := Move;
END Rectangles.

动态分派只能通过泛化模块的Figures中的方法集合完成,比如这里的DrawClearMarkMove过程,它们通过接口表格调用了扩展模块Rectangles中的同名过程。

消息处理器

这种技术形成于,在泛化模块中定义一个单一的处理器过程类型,并在扩展模块中声明这个类型的一个过程,用它处理对应各种方法并包含了相应的实际参数的消息记录:

MODULE Figures; (* 抽象模块 *)
 
  TYPE
    Figure* = POINTER TO FigureDesc;
 
    Message* = RECORD END;
    DrawMsg* = RECORD (Message) END;
    ClearMsg* = RECORD (Message) END;
    MarkMsg* = RECORD (Message) END;
    MoveMsg* = RECORD (Message) dx*, dy* : INTEGER END;
 
    Handler* = PROCEDURE (f : Figure; VAR msg : Message);
 
    FigureDesc* = RECORD
      (* 抽象 *)
      handle : Handler;
    END;
 
  PROCEDURE Handle* (f : Figure; VAR msg : Message);
  BEGIN
    f.handle(f, msg);
  END Handle;
 
  PROCEDURE Init* (f : Figure; handle : Handler);
  BEGIN
    f.handle := handle;
  END Init;
 
END Figures.

扩展泛化类型Figure为特定形状Rectangles

MODULE Rectangles;
 
  IMPORT Figures;
 
  TYPE
    Rectangle* = POINTER TO RectangleDesc;
 
    RectangleDesc* = RECORD (Figures.FigureDesc)
      x, y, w, h : INTEGER;
    END;
 
  PROCEDURE Draw* (r : Rectangle);
  BEGIN
    (* ... *)
  END Draw;
 
  (* 这里是其他过程Clear、Mark和Move *)
 
  PROCEDURE Handle* (f: Figure; VAR msg: Figures.Message);
    VAR
      r : Rectangle;
  BEGIN
    r := f(Rectangle);
    IF msg IS Figures.DrawMsg THEN Draw(r)
    ELSIF msg IS Figures.MarkMsg THEN Mark(r)
    ELSIF msg IS Figures.MoveMsg THEN 
      Move(r, msg(Figures.MoveMsg).dx, msg(Figures.MoveMsg).dy)
    ELSE (* 忽略 *)
    END
  END Handle;
 
  PROCEDURE New* (VAR r : Rectangle);
  BEGIN
    NEW(r);
    Figures.Init(r, Handle);
  END New;
 
END Rectangles.

在Oberon操作系统中,这两种技术都用于动态分派。前者用于已知的方法集合;后者用于在扩展模块中声明的任何新方法。例如,如果扩展模块Rectangles要实现一个新的Rotate()过程,在扩展模块之外只能通过它的消息处理器过程来调用。

参见

引用

  1. ^ Wirth, Niklaus. From Modula to Oberon and the programming language Oberon (报告). ETH Technical Reports D-INFK. Band 82. Wiley. [2021-06-18]. (原始内容存档于2021-12-17). 
  2. ^ Wirth, Niklaus. The Programming Language Oberon. Software: Practice and Experience. July 1988, 18 (7): 661–670. 
  3. ^ Wirth, Niklaus. From Modula to Oberon. Software: Practice and Experience. July 1988, 18 (7): 671–690. 
  4. ^ Wirth, Niklaus. Type Extensions. ACM Transactions on Programming Languages. April 1988, 10 (2): 204–214. 
  5. ^ Pountain, D. March 1991. Modula's Children, Part II: Oberon. Byte英语Byte (magazine). Vol. 16 no. 3: 135–142. 
  6. ^ Wirth, Niklaus. Oberon Change Log. ETH Zurich. [16 January 2021]. (原始内容存档于2019-04-07). 
  7. ^ Mössenböck, Hanspeter. Compiler Construction: The Art of Niklaus Wirth (PDF). Johannes Kepler University. [失效連結]
  8. ^ Niklaus Wirth; Jürg Gutknecht英语Jürg Gutknecht. Project Oberon. 1987–2021 [2021-06-18]. (原始内容存档于2021-07-19). 

外部资源链接

一般性

Oberon的演化

Read more information:

هذه المقالة تحتاج للمزيد من الوصلات للمقالات الأخرى للمساعدة في ترابط مقالات الموسوعة. فضلًا ساعد في تحسين هذه المقالة بإضافة وصلات إلى المقالات المتعلقة بها الموجودة في النص الحالي. (يوليو 2020) كلية ستانيسلاس في باريس معلومات التأسيس 1804  الموقع الجغرافي إحداثيات 48°50′41″N…

Organization Campaign for Science and EngineeringAbbreviationCaSEFormation1986 (Name changed in 2005)Legal statusNon-profit organisation, company limited by guaranteePurposePromoting science and engineering in the UKLocationLondon, WC1Region served United KingdomDirectorSarah MainWebsitewww.sciencecampaign.org.uk The Campaign for Science and Engineering (CaSE) is a non-profit organisation that is the UK's leading independent advocate for science and engineering. It focuses on arguing for more re…

Pour les articles homonymes, voir Lamy et Pierre Lamy (homonymie). Pierre LamyPierre LamyBiographieNaissance 23 mars 1909AngoulêmeDécès 18 juillet 1944 (à 35 ans)Saint-JoriozNationalité françaiseActivité RésistantAutres informationsConflit Seconde Guerre mondialeDistinctions Chevalier de la Légion d'honneur‎Croix de guerre 1939-1945Médaille de la Résistancemodifier - modifier le code - modifier Wikidata Pierre Lamy, né le 23 mars 1909 et mort le 18 juillet 1944, est une figure…

هذه المقالة يتيمة إذ تصل إليها مقالات أخرى قليلة جدًا. فضلًا، ساعد بإضافة وصلة إليها في مقالات متعلقة بها. (مايو 2016) نهج برنامج الرعاية في المملكة المتحدة عبارة عن نظام توصيل خدمات الصحة العقلية المجتمعية للأفراد المشخصة حالاتهم بـالمرض العقلي. طرح في إنجلترا عام 1991[1] وب

去區塊濾波器(英語:Deblocking Filter,縮寫:DBF)又稱去塊效應濾波器是一種減少在區塊邊界產生視覺上瑕疵的濾波器。這種視覺瑕疵可稱為區塊效應(Blocking Effect),這種效應主要構成原因是因為以區塊為基礎(Block-Based)的編解碼器(Codec)所造成的人造邊界(Blocking Artifacts)。以區塊為基底的編解碼器有很多種,H.264/高階視訊編碼(Advanced Video Coding, AVC)以及H.265/高效率視…

عرف الإنسان منذ القديم بعض العناصر الكيميائية كالذهب والفضة والحديد والنحاس، من ثم تم التعرف على بعض العناصر الأخرى مثل الكبريت والرصاص والفسفور وغيرها وعندما أعلن مندليف في أذار 1869 عن اكتشافه للقانون الدوري تسابق العلماء على اكتشاف الغرف الشاغرة في الجدول الدوري،والآن ي

AustriaJulukanDas Team (The Team)Burschen (The Boys)Unsere Burschen (Our Boys)AsosiasiÖsterreichischer Fußball-Bund (ÖFB)KonfederasiUEFA (Eropa)PelatihRalf RangnickKaptenJulian BaumgartlingerPenampilan terbanyakAndi Herzog (103)Pencetak gol terbanyakToni Polster (44)Stadion kandangErnst-Happel-StadionKode FIFAAUTPeringkat FIFATerkini 25 (26 Oktober 2023)[1]Tertinggi10 (Maret–Juni 2016)Terendah105 (Juli 2008)Peringkat EloTerkini 25 12 (18 Oktober 2023)[2] Warna pertama Warna …

Konferensi Waligereja IndonesiaLogo KWI sejak tahun 2017SingkatanKWITanggal pendirianNovember 1955StatusOrganisasi massa nirlabaTipeKonferensi waligerejaTujuanDukungan bagi pelayanan uskup-uskup IndonesiaKantor pusatKantor Waligereja IndonesiaLokasi IndonesiaWilayah layanan Seluruh wilayah IndonesiaJumlah anggota Uskup-uskup diosesan petahana di IndonesiaBahasa resmi IndonesiaKetua PresidiumMgr. Antonius Subianto Bunjamin, O.S.C.[1](Uskup Bandung)Sekretaris JenderalMgr. Paskalis Bru…

Gunilla Bergström Información personalNacimiento 3 de julio de 1942 Johannebergs församling (Suecia) Fallecimiento 23 de agosto de 2021 (79 años)Stockholms Gustav Vasa (Suecia) Nacionalidad SuecaInformación profesionalOcupación Escritora, ilustradora, escritora de literatura infantil y guionista Área Literatura infantil y juvenil e ilustración de libros Distinciones Elsa Beskow plaque (1979)Premio Astrid Lindgren (1981) (2006)Emil Prize (2011)Illis quorum (2012)M…

Eine kanadische 3-Cent-Briefmarke von 1917, die auf Robert Harris’ Gemälde „Fathers of Confederation“ basiert. Als Väter der Konföderation (englisch Fathers of Confederation, französisch Pères de la Confédération) werden die Personen bezeichnet, die an der Charlottetown-Konferenz, der Québec-Konferenz und der Londoner Konferenz teilnahmen. Diese Konferenzen führten zur Kanadischen Konföderation, also der Vereinigung von Kronkolonien in Britisch-Nordamerika zum Bundesstaat Kanada …

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Guest House TV series – news · newspapers · books · scholar · JSTOR (October 2021) (Learn how and when to remove this template message) Pakistani TV series or programme Guest HouseGenreComedy dramaWritten byQaiser FarooqMuhammad NisarShakir UzairDirected…

CamelCase CamelCase, CamelCaps of InterCaps is de gewoonte (onder andere in de informatica) om samengestelde woorden of zinnen, waar de woorden normaliter met een spatie gescheiden worden, als één woord te schrijven door de spatie en de daarop volgende letter te vervangen door de corresponderende hoofdletter. Meer algemeen is het het gebruik van een hoofdletter in een woord tussen kleine letters. De naam CamelCase verwijst, vanwege de midden in het samengestelde woord voorkomende hoofdletter(s…

Province of Italy Province in Emilia–Romagna, ItalyProvince of Forlì-CesenaProvincePalazzo dei Signori della Missione, the provincial seat in Forlì FlagCoat of armsMap highlighting the location of the province of Forlì-Cesena in ItalyCountry ItalyRegionEmilia–RomagnaCapital(s)ForlìComuni30Government • PresidentEnzo LattucaArea • Total2,378.4 km2 (918.3 sq mi)Population (2012) • Total398,322 • Density170/km2 (430/sq&…

Province of Afghanistan For the capital city of Afghanistan, see Kabul. Not to be confused with Zabul Province. Province in AfghanistanKabul کابلProvinceMap of Afghanistan with Kabul highlightedCoordinates (Capital): 34°00′N 69°00′E / 34.00°N 69.00°E / 34.00; 69.00Country AfghanistanCapitalKabulGovernment • GovernorShaikh Nida Mohammad[1] • Deputy GovernorMufti Mohammad Idris[1] • Police ChiefWali Ja…

Czech politician and physician You can help expand this article with text translated from the corresponding article in Czech. (February 2023) Click [show] for important translation instructions. View a machine-translated version of the Czech article. Machine translation, like DeepL or Google Translate, is a useful starting point for translations, but translators must revise errors as necessary and confirm that the translation is accurate, rather than simply copy-pasting machine-translated t…

Restaurant in Melbourne, AustraliaSwagman RestaurantRestaurant informationEstablished1972Closed1991CityMelbourneCountryAustralia A close-up of the Swagman sign The Swagman Restaurant was a restaurant in Ferntree Gully, Melbourne, Australia, which opened in 1972 and burnt down in 1991. The restaurant was famous in Melbourne for its long-running television commercials, cabaret shows, and smorgasbord. The Swagman was located on Burwood Highway, Ferntree Gully.[1] It was owned by Bastiaan (B…

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Cultural Complex of the Republic – news · newspapers · books · scholar · JSTOR (June 2015) (Learn how and when to remove this template message) Building in Brasilia, BrazilCultural Complex of the RepublicComplexo Cultural da RepúblicaAerial view.General informati…

The Endau river at Kampung Peta Kampung Peta is a Malaysian village in the upper Endau valley along the Endau River in Mersing District, Johor state. The inhabitants of Kampung Peta are mainly Orang Asli (indigenous people) from the Jakun people ethnic group.[1] Etymology The word Peta means map in Malay. Tourism The park gate of Endau-Rompin National Park is situated at Kampung Peta. There are several self-catering accommodation options in the park as well as a park lodge situated at th…

Rugby league season 2024 Super League XXIXLeagueSuper LeagueDuration27 RoundsTeams12Broadcast partners Sky Sports BBC Sport (highlights) Fox League Fox Soccer Plus Sport Klub beIN Sports 2024 Season← 20232025 → Super League XXIX, known as the Betfred Super League XXIX for sponsorship reasons, will be the 29th season of the Super League and 130th season of rugby league in Great Britain. Wigan Warriors will be the defending champions, having beaten Catalans Dragons in the Grand Final…

American actress Jayma MaysMays in 2010BornJamia Suzette Mays (1979-07-16) July 16, 1979 (age 44)[1]Bristol, Tennessee, U.S.Alma materRadford UniversityOccupationActressYears active2004–presentSpouse Adam Campbell ​(m. 2007)​Children1 Jamia Suzette Jayma Mays[2] (born July 16, 1979) is an American actress. She is known for playing Emma Pillsbury in the Fox musical series Glee (2009–2015) and for her starring roles in the films Red E…

Kembali kehalaman sebelumnya

Lokasi Pengunjung: 54.166.200.255