脚本语言21世纪的高级编程语言.pdf
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《脚本语言21世纪的高级编程语言.pdf》由会员分享,可在线阅读,更多相关《脚本语言21世纪的高级编程语言.pdf(17页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Scripting:Higher LevelProgrammingfor the 21st CenturyJohn K.Ousterhouthttp:/ article appears in IEEE Computer magazine,March 1998)AbstractScripting languages such as Perl and Tcl represent a very differentstyle of programming than system programming languages such asC or JavaTM.Scripting languages a
2、re designed for gluingapplications;they use typeless approaches to achieve a higher levelof programming and more rapid application development thansystem programming languages.Increases in computer speed andchanges in the application mix are making scripting languages moreand more important for appl
3、ications of the future.Keywords:component frameworks,object-oriented programming,scripting,strong typing,system programming.1 IntroductionFor the last fifteen years a fundamental change has been occurring in theway people write computer programs.The change is a transition from systemprogramming lang
4、uages such as C or C+to scripting languages such asPerl or Tcl.Although many people are participating in the change,few peoplerealize that it is occurring and even fewer people know why it is happening.This article is an opinion piece that explains why scripting languages willhandle many of the prog
5、ramming tasks of the next century better thansystem programming languages.Scripting languages are designed for different tasks than systemprogramming languages,and this leads to fundamental differences in thelanguages.System programming languages were designed for building datastructures and algorit
6、hms from scratch,starting from the most primitivecomputer elements such as words of memory.In contrast,scriptinglanguages are designed for gluing:they assume the existence of a set ofpowerful components and are intended primarily for connecting componentsScriptinghttp:/ 共17页2009年05月05日 12:34together
7、.System programming languages are strongly typed to help managecomplexity,while scripting languages are typeless to simplify connectionsbetween components and provide rapid application development.Scripting languages and system programming languages are complementary,and most major computing platfor
8、ms since the 1960s have provided bothkinds of languages.The languages are typically used together in componentframeworks,where components are created with system programminglanguages and glued together with scripting languages.However,severalrecent trends,such as faster machines,better scripting lan
9、guages,theincreasing importance of graphical user interfaces and componentarchitectures,and the growth of the Internet,have greatly increased theapplicability of scripting languages.These trends will continue over the nextdecade,with more and more new applications written entirely in scriptinglangua
10、ges and system programming languages used primarily for creatingcomponents.2 System programming languagesIn order to understand the differences between scripting languages andsystem programming languages,it is important to understand how systemprogramming languages evolved.System programming languag
11、es wereintroduced as an alternative to assembly languages.In assembly languages,virtually every aspect of the machine is reflected in the program.Eachstatement represents a single machine instruction and programmers mustdeal with low-level details such as register allocation and procedure callingseq
12、uences.As a result,it is difficult to write and maintain large programs inassembly language.By the late 1950s higher level languages such as Lisp,Fortran,and Algolbegan to appear.In these languages statements no longer correspondexactly to machine instructions;a compiler translates each statement in
13、 thesource program into a sequence of binary instructions.Over time a series ofsystem programming languages evolved from Algol,including such languagesas PL/1,Pascal,C,C+,and Java.System programming languages are lessefficient then assembly languages but they allow applications to be developedmuch m
14、ore quickly.As a result,they have almost completely replacedassembly languages for the development of large applications.System programming languages differ from assembly languages in two ways:they are higher level and they are strongly typed.The term higher levelmeans that many details are handled
15、automatically so that programmers canwrite less code to get the same job done.For example:Scriptinghttp:/ 共17页2009年05月05日 12:34Register allocation is handled by the compiler so that programmers neednot write code to move information between registers and memory.Procedure calling sequences are genera
16、ted automatically:programmersneed not worry about moving arguments to and from the call stack.Programmers can use simple keywords such as while and if for controlstructures;the compiler generates all the detailed instructions toimplement the control structures.On average,each line of code in a syste
17、m programming language translatesto about five machine instructions,compared to one instruction per line inassembly language(in an informal analysis of eight C files written by fivedifferent people,I found that the ratio ranged from about 3 to 7 instructionsper line7;in a study of numerous languages
18、 Capers Jones found that for agiven task,assembly languages require about 3-6 times as many lines of codeas system programming languages3).Programmers can write roughly thesame number of lines of code per year regardless of language1,so systemprogramming languages allow applications to be written mu
19、ch more quicklythan assembly language.The second difference between assembly language and system programminglanguages is typing.I use the term typing to refer to the degree to whichthe meaning of information is specified in advance of its use.In a stronglytyped language the programmer declares how e
20、ach piece of information willbe used and the language prevents the information from being used in anyother way.In a weakly typed language there are no a priori restrictions on howinformation can be used:the meaning of information is determined solely bythe way it is used,not by any initial promises.
21、1Modern computers are fundamentally typeless:any word in memory can holdany kind of value,such as an integer,a floating-point number,a pointer,or aninstruction.The meaning of a value is determined by how it is used:if theprogram counter points at a word of memory then it is treated as aninstruction;
22、if a word is referenced by an integer add instruction then it istreated as an integer;and so on.The same word can be used in differentways at different times.In contrast,todays system programming languages are strongly typed.Forexample:Each variable in a system programming language must be declared
23、witha particular type such as integer or pointer to string,and it must be usedin ways that are appropriate for the type.Data and code are totally segregated:it is difficult or impossible tocreate new code on the fly.Variables can be collected into structures or objects with well-definedScriptinghttp
24、:/ 共17页2009年05月05日 12:34substructure and procedures or methods to manipulate them;an objectof one type cannot be used where an object of a different type isexpected.Typing has several advantages.First,it makes large programs moremanageable by clarifying how things are used and differentiating betwee
25、nthings that must be treated differently.Second,compilers can use typeinformation to detect certain kinds of errors,such as an attempt to use afloating-point value as a pointer.Third,typing improves performance byallowing compilers to generate specialized code.For example,if a compilerknows that a v
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 脚本语言 21 世纪 高级 编程 语言
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内