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

CLU

CLU
编程范型多范型: 面向对象, 过程式
設計者芭芭拉·利斯科夫和她的学生
實作者麻省理工学院
发行时间1975年,​49年前​(1975
型態系統强类型
網站www.pmg.lcs.mit.edu/CLU.html
主要實作產品
Native CLU[1], Portable CLU[2], clu2c[3]
啟發語言
ALGOL 60, Lisp[4], Simula[5]
影響語言
Ada, Argus, C++, Lua, Python[6], Ruby, Sather英语Sather, Swift[7]

CLU是一门编程语言,由芭芭拉·利斯科夫和她的学生在1974年到1975年于麻省理工学院(MIT)创造。虽然它没有被广泛使用,但它引入了抽象数据类型[8],和许多现在广泛使用的特性,而被视为面向对象编程发展的重要一步。

主要贡献还包括:传共享调用迭代器、多值返回(并行赋值形式)、参数化类型可变类型。值得注意的是它使用了具有构造器方法,但没有继承

聚类

CLU的语法基于了ALGOL,这是当时多数新语言设计的起点。关键增补是“聚类”(cluster)概念,它是CLU的类型扩展系统和语言名字的根源(CLUster)[9]。聚类一般对应于面向对象语言中“类”(class)的概念。例如,下面是CLU用来实现复数的语法:

complex_number = cluster is add, subtract, multiply, ...
    rep = record [ real_part: real, imag_part: real ]
    add = proc ... end add;
    subtract = proc ... end subtract;
    multiply = proc ... end multiply;
    ...
end complex_number;

聚类是一个模块,它封装了除了那些在is子句中显式命名的成员之外的所有成员。这些成员对应于现在面向对象语言中一个类的公开成员。聚类还定义了可以在聚类之外引用名字的一个类型(在这个案例中是complex_number),但是它的表示类型(这里的rep)对于外部客户是隐藏的。

聚类名字是全局的,不提供名字空间机制来组织聚类,也不允许它们在其他聚类内部被“局部”创建。

CLU不进行隐式类型转换。在聚类中,显式类型转换updown抽象类型和表示之间进行变更。有一个全体类型any,和一个过程force[]来检查一个对象是否是一个特定类型。对象可以是可变的或不可变的,后者是基础类型,比如整数、布尔值、字符和字符串[9]

其他特征

CLU类型系统的另一个关键特征是迭代器,它一个接一个的按顺序的从一个搜集返回对象[9]。迭代器提供了一致的应用编程接口(API),而不管所用于的是什么数据。因此针对complex_number搜集的迭代器,与针对integer数组的迭代器,可以互换使用。CLU迭代器的显著特征是它们被实现为协程,每个值都是通过yield语句提供给调用者的。像CLU中这样的迭代器,现在是很多现代语言比如C#RubyPython的常见特征,然而它们近来经常被称为生成器。下面是迭代器的例子:

% 产生从1到n的奇数
odds = iter(n:int) yields int
    i:int
    i = 1
    while i < n do
        yield i
        i := i + 2
    end
end odds  
 
for i:int in odds(13) do
    print int$unparse(i) || "\n"
end

CLU还包括了异常处理,它参考了在其他语言中的各种尝试;异常使用signal引发,并通过except处理。不同于具有异常处理的多数其他语言,异常不会被隐式的沿着调用链重新发起。不同之处还有,在CLU中异常被当作是正常执行流程的一部份,并作为“正常”而有效的一种类型安全的方式,用来退出循环或从函数返回;这种方式下,“除非”其他条件适用,可以直接指定返回值。既未捕获也未显式的重新发起的异常,被立即转换成特殊失败异常,这典型的会终止程序。

CLU经常被引证为具有类型安全的可变类型的第一个语言,在这里叫作oneof,早于ML语言拥有的叫做代数数据类型标签联合

CLU中最后一个显著特征是并行赋值(多赋值),这里多于一个变量可以出现在赋值算符的左侧。例如,书写x,y := y,x将交换xy的值。以相同的方式,函数可以返回多个值,比如x,y,z := f(t)。并行赋值(但未包括多返回值),在CLU之前已经出现在CPL(1963年)之中,叫作“同时赋值”[10],然而确是CLU使之流行,并被引证为对后来语言中出现的并行赋值有直接的影响。

在CLU程序中所有对象都存活在堆中,而内存管理是自动化的。

CLU支持参数化类型的用户定义数据抽象。它是提供类型安全限定的参数化类型的第一个语言,它使用where子句结构,来表达在实际类型实际参数上的约束。

影响

CLU和AdaC++模板的主要启发者[11]

CLU的异常处理机制影响了后来的语言如C++Java[12]

Sather英语SatherPythonC#所包含的迭代器,最早出现在CLU中。

PerlLua采用的多赋值和从函数调用返回多个值来自CLU[13]

PythonRuby从它引入了传共享调用yield语句[14]和多赋值[15]

参考资料

  1. ^ 1.0 1.1 Curtis, Dorothy. CLU home page. Programming Methodology Group, Computer Science and Artificial Intelligence Laboratory. Massachusetts Institute of Technology. 2009-11-06 [2016-05-26]. (原始内容存档于2016-06-02). 
  2. ^ 2.0 2.1 Curtis, Dorothy. Index of /pub/pclu. Programming Methodology Group, Computer Science and Artificial Intelligence Laboratory. Massachusetts Institute of Technology. 2009-11-06 [2016-05-26]. 
  3. ^ Ushijima, Tetsu. clu2c. clu2c. woodsheep.jp. [2016-05-26]. (原始内容存档于2016-03-04). 
  4. ^ Barbara Liskov. A history of CLU (PDF). 1992 [2022-04-27]. (原始内容 (PDF)存档于2021-11-05). CLU looks like an Algol-like language, but its semantics is like that of Lisp: CLU objects reside in an object universe (or heap), and a variable just identifies (or refers to) an object. We decided early on to have objects in the heap, although we had numerous discussions about the cost of garbage collection. This decision greatly simplified the data abstraction mechanism ……. A language that allocates objects only on the stack is not sufficiently expressive; the heap is needed for objects whose sizes must change and for objects whose lifetime exceeds that of the procedure that creates them. …… Therefore, the choice is: just heap, or both. ……
    One unusual aspect of CLU is that our procedures have no free (global) variables ……. The view of procedures in CLU is similar to that in Lisp: CLU procedures are not nested (except that there can be local procedures within a cluster) but instead are defined at the "top" level, and can be called from any other module. In Lisp such procedures can have free variables that are scoped dynamically, a well-known source of confusion.
     
  5. ^ Barbara Liskov. A history of CLU (PDF). 1992 [2022-04-27]. (原始内容 (PDF)存档于2021-11-05). Programming languages that existed when the concept of data abstraction arose did not support abstract data types, but some languages contained constructs that were precursors of this notion. …… The mechanism that matched the best was the class mechanism of Simula 67. A Simula class groups a set of procedures with some variables. A class can be instantiated to provide an object containing its own copies of the variables; the class contains code that initializes these variables at instantiation time. However, Simula classes did not enforce encapsulation ……, and Simula was lacking several other features needed to support data abstraction, ……. 
  6. ^ Lundh, Fredrik. Call By Object. effbot.org. [21 November 2017]. (原始内容存档于2019-11-23). replace "CLU" with "Python", "record" with "instance", and "procedure" with "function or method", and you get a pretty accurate description of Python's object model. 
  7. ^ Lattner, Chris. Chris Lattner's Homepage. Chris Lattner. 2014-06-03 [2014-06-03]. (原始内容存档于2018-12-25). The Swift language is the product of tireless effort from a team of language experts, documentation gurus, compiler optimization ninjas, and an incredibly important internal dogfooding group who provided feedback to help refine and battle-test ideas. Of course, it also greatly benefited from the experiences hard-won by many other languages in the field, drawing ideas from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list. 
  8. ^ Liskov, Barbara; Zilles, Stephen. Programming with abstract data types. Proceedings of the ACM SIGPLAN symposium on Very high level languages. 1974: 50–59. doi:10.1145/800233.807045. 
  9. ^ 9.0 9.1 9.2 Liskov, B.; Snyder, A.; Atkinson, R.; Schaffert, C. Abstraction mechanisms in CLU (PDF). Communications of the ACM. August 1977, 20 (8): 564–576 [2021-03-09]. doi:10.1145/359763.359789. (原始内容 (PDF)存档于2021-08-09). 
  10. ^ Barron, D. W.; Buxton, J. N.; Hartley, D. F.; Nixon, E.; Strachey, C. The main features of CPL. Computer Journal. 1963, 6 (2): 134–143 [2021-03-09]. doi:10.1093/comjnl/6.2.134. (原始内容存档于2012-07-07). 
  11. ^ Stroustrup, Bjarne. The C++ Programming Language (Third Edition and Special Edition). Bjarne Stroustrup's homepage. 2004-09-08 [2020-09-21]. (原始内容存档于2019-05-14). 
  12. ^ Bruce Eckel's MindView, Inc: Does Java need Checked Exceptions?. Mindview.net. [2011-12-15]. (原始内容存档于2002-04-05). 
  13. ^ Ierusalimschy, R.; De Figueiredo, L. H.; Celes, W. The evolution of Lua. Proceedings of the third ACM SIGPLAN conference on History of programming languages – HOPL III (PDF). 2007: 2–1–2–26 [2020-09-21]. ISBN 978-1-59593-766-7. doi:10.1145/1238844.1238846. (原始内容存档 (PDF)于2020-08-17). 
  14. ^ Ruby's Roots and Matz's Leadership. Appfolio Engineering. 2019-11-08 [2019-11-15]. (原始内容存档于2019-11-14). Matz feels that blocks are the greatest invention of Ruby (I agree.) He got the idea from a 1970s language called CLU from MIT, which called them 'iterators'... 
  15. ^ Functional Programming HOWTO — Python 3.8.3 documentation. docs.python.org. [2020-05-25]. (原始内容存档于2012-10-24). 

外部链接

Read more information:

إيفيكا أوليتش معلومات شخصية الاسم الكامل إيفيكا أوليتش الميلاد 14 سبتمبر 1979 (العمر 44 سنة)دافور الطول 1.82 م (5 قدم 11 1⁄2 بوصة)[1][1] مركز اللعب مهاجم الجنسية كرواتيا (25 يونيو 1991–) جمهورية يوغوسلافيا الاشتراكية الاتحادية (–24 يونيو 1991)  معلومات النادي النادي ا

Untuk kegunaan lain, lihat Kawin Kontrak (disambiguasi). Kawin Kontrak LagiSutradara Ody C. Harahap Produser Raam Punjabi Ditulis oleh Ody C. Harahap Joko Nugroho SkenarioOdy C. HarahapJoko NugrohoCeritaOdy C. HarahapPemeranRicky HarunLukman SardiWiwid GunawanThalita LatiefTeno AliYogi AldiAditya FirmansyahHardi FadhillahDebby AyuAdelia RasyaNiken AnjaniCut Mini TheoCynthiara AlonaPenata musikJoseph S. DjafarSinematograferIcal TanjungPenyuntingAline JusriaPerusahaanproduksiMulti Vision Plu…

Ця стаття про комуну. Про село див. Чобану. комуна ЧобануCiobanu Країна  Румунія Повіт  Констанца Телефонний код +40 241 (Romtelecom, TR)+40 341 (інші оператори) Координати 44°43′00″ пн. ш. 27°59′11″ сх. д.H G O Висота 32 м.н.р.м. Площа 91,77 км² Населення 3477[1] (2009) Розташування Влада П

For the mythology and culture of women warriors, see Woman warrior (disambiguation). 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: List of women warriors in folklore – news · newspapers · books · scholar · JSTOR (December 2012) (Learn how and when to remove this template message) The Swedish heroine Blenda ad…

Untuk the poet, lihat Shin Dong-yup (penyair). Ini adalah nama Korea; marganya adalah Shin. Shin Dong-yupLahir17 Februari 1971 (umur 52)SeoulKebangsaanKorea SelatanTahun aktif1991–sekarangSuami/istriSun Hye-yoonNama KoreaHangul신동엽 Hanja申東燁 Alih AksaraSin DongyeopMcCune–ReischauerSin Tongyŏp Shin Dong-yup (Hangul: 신동엽; lahir 17 Februari 1971) adalah pembawa acara komedi televisi dan komedian asal Korea Selatan. Ia lulus dari Seoul Institute of the Arts. Pada s…

Medalla «La Nación Argentina al Valor en Combate» Otorgada por ArgentinaTipo MedallaElegibilidad Personal militar, policial o civil, argentino o extranjeroOtorgada por Realizar una acción destacada considerablemente respecto de las pautas de conducta correctasEstadísticasOtorgadas totales 321Póstumas 64PrecedenciaSiguiente mayor Cruz al Heroico Valor en CombateSiguiente menor Medalla al Muerto en Combate[editar datos en Wikidata] La medalla «La Nación Argent…

British CoachwaysPreserved Plaxton bodied Volvo B58 in January 2011FoundedOctober 1980Ceased operationOctober 1982Service typeLong distance coach operatorRoutes6HubsLondonAnnual ridership750,000OperatorBarton TransportEllerman Bee LineExcelsior CoachesGrey-GreenMorris BrosPark's Motor GroupShearingsWallace ArnoldYork'sWarner Fairfax British Coachways was a consortium of independent coach operating companies in the United Kingdom. Formed immediately after the deregulation of coach services in Oct…

1st Chief Minister of Gujarat Dr. Jivraj MehtaMehta in October 19471st Chief Minister of GujaratIn office1 May 1960 – 25 February 1963Preceded byOffice EstablishedSucceeded byBalwantrai MehtaMember of Parliament, Lok SabhaIn office1971-1977Preceded byJayaben ShahSucceeded byDwarkadas PatelConstituencyAmreli, Gujarat Personal detailsBorn(1887-08-29)29 August 1887Amreli, Bombay Presidency, British IndiaDied7 November 1978(1978-11-07) (aged 91)Bombay, Maharashtra, IndiaPolitical…

For Herbie the Love Bug, see Herbie. Comics character H.E.R.B.I.E.H.E.R.B.I.E. and Franklin Richards by Chris Eliopoulos.Publication informationPublisherMarvel ComicsFirst appearanceThe New Fantastic FourA Monster Among Us (1978)First comic appearanceFantastic Four #209 (August 1979)Created byStan Lee (writer)Jack Kirby (artist)In-story informationAlter egoHumanoid Experimental Robot B-Type Integrated ElectronicsTeam affiliationsA.I. ArmyFantastic FourAbilitiesAbility to connect to any computer …

У Вікіпедії є статті про інші значення цього терміна: В пошуках Аляски (2019). «У пошуках Аляски» Обкладинка українського виданняАвтор Джон ГрінНазва мовою оригіналу Looking for AlaskaКраїна СШАМова англійськаЖанр підліткова літератураВидано 2005Видано українською 2016Сторінок 288 «У …

いざわ かのみ井澤 佳の実プロフィール性別 女性出身地 日本・北海道釧路町[1]誕生日 9月11日血液型 O型[1]身長 159 cm[2]事務所 studio A-CAT[1]公式サイト 井澤 佳の実|株式会社studio A-CAT声優:テンプレート | プロジェクト | カテゴリ 井澤 佳の実(いざわ かのみ、9月11日[1] - )は、日本の女性声優、歌手。北海道釧路町出身[1]。studio A…

Le sujet des droits de l'Homme aux États-Unis est controversé et complexe. Historiquement, les États-Unis sont attachés au principe de liberté et ont accueilli de nombreux réfugiés économiques et politiques en périodes de troubles. Ils ont un appareil judiciaire puissant et indépendant et une constitution qui sépare les pouvoirs pour prévenir la tyrannie. Légalement, les droits de Homme au sein des États-Unis sont ceux reconnus par sa constitution, par les traités ratifiés par le…

Bambang Pamungkas Informasi pribadiNama lengkap Bambang PamungkasTanggal lahir 10 Juni 1980 (umur 43)Tempat lahir Semarang, Indonesia[1]Tinggi 1,70 m (5 ft 7 in)Posisi bermain PenyerangKarier junior1988–1989 SSB Hobby Sepakbola Getas1989–1993 SSB Ungaran Serasi1993–1994 Persada Utama Ungaran1994–1996 Persikas Semarang1996–1999 Diklat SalatigaKarier senior*Tahun Tim Tampil (Gol)1999–2000 Persija Jakarta 30 (24)2000 → EHC Norad (pinjaman) 11 (7)2000–2004…

German field hockey player Christian Schulte Personal informationBorn (1975-08-17) 17 August 1975 (age 48)Neuss, West GermanyPlaying position GoalkeeperSenior careerYears Team1980–1986 Grimlinghausen1986–1992 Neuss1992–2003 Crefeld2003–2004 Barcelona2004–2012 CrefeldNational teamYears Team Apps (Gls) Germany Medal record Men's field hockey Representing  Germany Olympic Games 2004 Athens Team World Cup 2002 Kuala Lumpur Team 2006 Mönchengladbach Team Champions Trophy 2007 Kua…

Government agency of Pakistan Pakistan Horticulture Development and Export Company (PHDEC)[1] (Urdu: شرکتِ پاکستان برائے صادراتِ و فروغِ باغبانی) is a department of Ministry of Commerce of Pakistan. Pakistan Horticulture Development and Export Company was created due to the enormous potential of Pakistan's horticulture products in the global market. In the absence of a single ministry or institution responsible for development at all levels of the hor…

Ancient altar in Athens, Greece Plan showing major buildings and structures of the Agora of Classical Athens, c. 5th century BC, with the Altar of the Twelve Gods labelled 16 The Altar of the Twelve Gods (also called the Sanctuary of the Twelve Gods), was an important altar and sanctuary at Athens, located in the northwest corner of the Classical Agora.[1] The Altar was set up by Pisistratus the Younger, (the grandson of the tyrant Pisistratus) during his archonship, in 522/1 BC. It mark…

Painting by Thomas Cole This article is about the painting. For the region, see Roman Campagna. Roman CampagnaRoman Campagna, 1843ArtistThomas ColeYear1843MediumOil on CanvasDimensions80 cm × 106.7 cm (31.5 in × 42 in)LocationWadsworth Atheneum, Hartford, Connecticut Roman Campagna, also called Ruins of Aqueducts in the Campagna Di Roma, is an 1843 oil on canvas painting by Thomas Cole. It is currently displayed at the Wadsworth Atheneum in Connecticut…

This article needs to be updated. The reason given is: BGO (formerly BGFIC) was closed down on 1 September 2023. Please help update this article to reflect recent events or newly available information. (September 2023) Girlguiding BGIFC (British Guides in Foreign Countries) is part of Girlguiding UK and is for British nationals living overseas. Administratively it is based in Commonwealth Guide Headquarters in Victoria, London. Members in this section of Girlguiding UK follow the normal programm…

Sailboat class Class symbolLaser StandardDevelopmentDesignerBruce Kirby, Ian Bruce Year1969Builder(s)LaserPerformance BoatCrew1Draft0.787 m (2 ft 7.0 in)HullHull weight58.97 kg (130.0 lb)LOA4.2 m (13 ft 9 in)LWL3.81 m (12 ft 6 in)Beam1.39 m (4 ft 7 in)RigSailsMainsail area7.06 m2 (76.0 sq ft)RacingD-PN91.1RYA PN1088PHRF217Current Olympic equipment[edit on Wikidata] The Laser is a class of single-ha…

Copa de la Reina 2012 XXX Copa de la Reina de fútbol La Ciudad del Fútbol de Las Rozas fue la sede de la final.Datos generalesSede España EspañaFecha 8 de junio de 201210 de junio de 2012Edición 30Organizador Real Federación Española de FútbolPalmarésPrimero RCD EspanyolSegundo Athletic ClubDatos estadísticosParticipantes 4 Cronología Copa de la Reina 2011 Copa de la Reina 2012 Copa de la Reina 2013 [editar datos en Wikidata] La Copa de la Reina de Fútbol 2012 se dispu…

Kembali kehalaman sebelumnya

Lokasi Pengunjung: 18.191.216.163