-*- fill-column: 1000 -*- This document is licensed under GFDL (GNU Free Documentation License). ******************************************************************************** Various An Introduction to Programming Languages http://www.andrewcooke.free-online.co.uk/andrew/writing/lang.html (very good) Structure and Interpretation of Computer Programs http://mitpress.mit.edu/sicp/full-text/sicp/book/book.html Concepts, Techniques and Models of CP http://www.info.ucl.ac.be/~pvr/book.ps.gz How To Design A (Scripting) Language (mostly syntax) http://www.geocities.com/tablizer/langopts.htm http://web.cs.mun.ca/~ulf/pld/ http://lsi.uniovi.es/~labra/APL.html collected features: http://www.cs.colorado.edu/~humphrie/pl/ list The Dictionary of Programming Languages http://www.erols.com/ziring/dopl.html early history http://www.computer.org/students/looking/spring97/janlee/ simple history http://www.princeton.edu/~ferguson/adw/programming_languages.shtml history diagram http://perso.wanadoo.fr/levenez/lang/ http://www.epemag.com/zuse/Images/43ab.gif features http://www.cs.fsu.edu/~engelen/courses/COP4020/notes1.html features http://www.engin.umd.umich.edu/CIS/course.des/cis400/maxim/lectures/chp2.htm Programming Languages Genealogy Project at http://everything2.com Being Popular http://www.paulgraham.com/popular.html Things to Say When You're Losing a Technical Argument http://pigdog.org/auto/mr_bads_list/shortcolumn/1914.html rot13 in different languages (string manipulation) http://ucsub.colorado.edu/~kominek/rot13/ vier-neun in different languages (constraints programming) http://members.home.net/js.graham/vierneun.html OO Example Code http://w3.one.net/~jweirich/oostuff/ http://www.angelfire.com/tx4/cus/shapes/index.html pleac (Programming Language Examples Alike Cookbook) http://pleac.sf.net/ Examples of programs in different programming languages http://www.uni-karlsruhe.de/~uu9r/lang/html/lang.en.html reference papers http://www.cs.uu.nl/people/franka/ref.html Dylan design notes http://oop.rosweb.ru/dylan/design-notes/home.html ******************************************************************************** Syntax 888l syntax (http://www.cs.mdx.ac.uk/harold/papers/javaspae.html): 1. In Java the 32 bit numeral 71 can be made into a 64 bit numeral by appending a letter l, as in 71l. Arguably, the notation should make this sort of difference clearer. Or it would have been easier if Java had been designed so numerals took just as many bits (char, int, long) as they required, and the compiler complained when there was numeric overflow. suffix casts are more OO Indentation to show block structure? http://www.cs.man.ac.uk/~pjj/cs2112/langdes/indent.html Blocks and scoping (C vs C++, Python) OO Examples http://w3.one.net/~jweirich/oostuff/ overloading: Koenig lookup http://devresource.hp.com/devresource/Docs/TechPapers/KoenigLookup.html short-hands (things like perl's $_) http://www.research.microsoft.com/scripts/pubs/view.asp?TR_ID=MSR-TR-2000-03 Syntax Checking the Scripting Way http://www.unixreview.com/documents/uni1018986621203/ SML to OCaml http://www.ps.uni-sb.de/~rossberg/SMLvsOcaml.html ******************************************************************************** Macros (from http://lambda.weblogs.com/discuss/msgReader$1245) One use of macros is emulating higher-order polymorphic functions. In C, this is the only way to achieve parametric polymorphism. For example, see "man 3 queue" on a BSD system. In C++, templates serve the same purpose. Functional languages offer higher-order polymorphic functions natively. Macros are essential in writing custom control structures in eager languages, e.g., assertions, three-way conditionals, guarded execution (similar to evaluation of a clause in Prolog or a list comprehension expression in Haskell). Macros can be used as a poor-man configuration language: conditional compilation in C/C++, configuration language in Lisp and Scheme. In a more refined form, macros can implement a limited module system. proposition for haskell (talks about other languages too) http://www.cl.cam.ac.uk/~kw217/research/papers.html#Wansbrough99:Macros Meta Haskell (very good!) http://www.research.microsoft.com/~simonpj/papers/meta-haskell/ ******************************************************************************** Value sharing, aliasing, references/pointers simulating pointers in scheme,Python,ruby http://c2.com/cgi/wiki?SinisterSchemeSamplePerplexesPythonPorter ******************************************************************************** Lazyness, Iterators Sather iterators http://www.icsi.berkeley.edu/~sather/Publications/toplas.html ******************************************************************************** Modules / package Provide an abstraction or information hiding mechanism so that a module's implementation can be changed without requiring any change to other modules. In this respect they are similar to objects in an object-oriented language, though a module may contain many procedures and/or functions which would correspond to many objects. A module often has its own name space for identifiers so the same identifier may be used to mean different things in different modules. created in Modula-2 (1978) Available in all used languages except C ******************************************************************************** Polymorphism Polymorphism / \ Unified Ad'hoc / \ / \ Para Inclusion Overload Coercion ML,C++ subtyping haskell,C++ C explained in java http://www.javaworld.com/javaworld/jw-04-2001/jw-0413-polymorph_p.htm see also http://research.microsoft.com/Users/luca/Papers/OnUnderstanding.pdf ******************************************************************************** Typing - Static vs dynamic static typing ensure no type error can occurs at runtime (except for dynamic cast, cf RTTI) - Strong typing / weak typing (!! meaning can differ) 1: avaibility of a lot of coercions 2: can the program inappropriately use a value of one type as another type - Type equivalence name or structural Fortran: int, floating points format ocaml typing http://www.cs.jhu.edu/~scott/plbook/book/html/main.html (not) complete type inference ocaml http://caml.inria.fr/archives/200111/msg00362.html polymorphism and side-effects, value restriction http://www.cs.rice.edu/CS/PLT/Publications/lasc95-w.ps.gz http://cm.bell-labs.com/cm/cs/what/smlnj/doc/Conversion/types.html Various stuff about types (existancial types, subtyping) http://research.microsoft.com/Users/luca/Papers/OnUnderstanding.A4.pdf (good) Quest: powerful subtyping http://gatekeeper.dec.com/pub/DEC/SRC/research-reports/abstracts/src-rr-045.html typing C&pascal vs ML vs Perl http://perl.plover.com/yak/typing/typing.html Dimension Types http://citeseer.nj.nec.com/kennedy94dimension.html Alice (SML + first class modules + some RTTI + open types (?)) http://www.ps.uni-sb.de/alice/ Using types known at run-time in static typing (eg: getCode "FFT" "fft" loads code with type ...) http://citeseer.nj.nec.com/shields97dynamic.html Soft typing http://merd.net/types.html#soft_typing rank 2 intersection types http://lambda.di.unito.it/rank2/ printf-like typing - Cayenne (see below) - ocaml's printf (special typing done by the compiler) http://caml.inria.fr/oreilly-book/html/book-ora076.html#toc105 - ocaml's printf could also be achieved via camlp4 (?) - you can also give up the sugar and write it (irk!): format (int oo lit " is " oo str oo eol) instead of sprintf "%d is %s\n" see "Functional Unparsing" http://www.brics.dk/RS/98/12/ http://tkb.mpl.com/~tkb/software.html (in ocaml) http://www.informatik.uni-bonn.de/~ralf/publications.html#J11 (in haskell) dependent types (stalled though) http://www.ececs.uc.edu/~hwxi/DML/DML.html **************************************** Haskell typing Typing haskell in haskell http://www.cse.ogi.edu/~mpj/thih/ Nuke contexts on data type declarations http://www.cs.chalmers.se/~rjmh/Haskell/Messages/Display.cgi?id=302 existential types http://www.numeric-quest.com/haskell/hcompanion/extensions.html http://www.mail-archive.com/haskell@haskell.org/msg08073.html http://www.mail-archive.com/haskell@haskell.org/msg04998.html (dynamic type class casts proposal) Combining Type Classes And Existential Types http://citeseer.nj.nec.com/laufer94combining.html Polymorphic recursion f :: (Eq a) => a -> Integer -> Bool f x 0 = x == x f x n = f [x] (n-1) Generic default method (a la ``=='' in class Eq) http://research.microsoft.com/~simonpj/Papers/derive.ps.gz http://www.generic-haskell.org Extending Fold and Unfold to Exponential (recursive) Types http://citeseer.nj.nec.com/293490.html Overloading and Polymorphic Recursion with Decidable Type Inference http://www.dcc.ufmg.br/~camarao/CT/ http://www.cse.ogi.edu/~mbs/pub/overloading/ A Second Look at Overloading http://citeseer.nj.nec.com/odersky95second.html Cayenne type system http://www.cs.chalmers.se/~augustss/cayenne/ ******************************************************************************** Analysis Terminaison, space bound... http://www.cs.chalmers.se/~pareto/t.ps (good general intro) design by contract: http://www.elj.com/eiffel/dbc/ Behavioral Contracts and Behavioral Subtyping http://citeseer.nj.nec.com/findler01behavioral.html Extended Static Checking for Java http://research.compaq.com/SRC/esc/ (bound checking, null pointers dereference, bad down-casting...) linux kernel source checking http://www.stanford.edu/~engler http://www.stanford.edu/~engler/mc-osdi.ps http://www.stanford.edu/~engler/p401-xie.pdf Soft Typing http://merd.net/types.html#soft_typing ******************************************************************************** Memory management The Memory Management Reference http://www.xanalys.com/software_tools/mm/ (very good) (per languages http://www.xanalys.com/software_tools/mm/articles/lang.html) Garbage Collection Can Be Faster Than Stack Allocation (in case you have plenty of memory and don't care about keeping a lot of it allocated for a long time) http://citeseer.nj.nec.com/appel87garbage.html exception handling with manual memory management a false sense of security http://cseng.aw.com/book/related/0,3833,020163371X+11,00.html safe memory http://www.srcf.ucam.org/~mrs35/comp/safe-c/ slab allocator (caching of pre-created objects when using many same objects and the cost of creating the object is important) http://citeseer.nj.nec.com/bonwick94slab.html region inference: replace most (in some programs, all) of the need of GC by stack-based memory management introductions: http://www.diku.dk/research-groups/topps/activities/kit2/summerschool/toc.html http://www.acm.org/sigplan/pldi/pldi2001/pldi01-presentations/DavidGay.pdf http://www.acm.org/sigplan/pldi/pldi2001/pldi01-presentations/DavidGay.ppt http://www.memorymanagement.org/glossary/r.html#region.inference http://citeseer.nj.nec.com/tofte98region.html Portable, Modular Expression of Locality http://www.stoutamire.com/david/publications.html ******************************************************************************** OO http://ootips.org/ simula history http://www.ifi.uio.no/~kristen/FORSKNINGSDOK_MAPPE/F_OO_start.html object-centric: Self, JavaScript, ... (singletons) class-centric: Smalltalk, C++, Java, OCaml ... method-centric: CLOS, Dylan, ... mixed: object&class-centric (Ruby) object-oriented = data abstractions + object types + type inheritance class == first-class namespace ``inheritance emerged in Simula as a generalization of block nesting'' first class citizen defined in http://www.cs.chalmers.se/~patrikj/poly/afp98/genprogintro.ps.gz page 1 the case against "new" single entry point for object creation http://www.ddj.com/documents/s=7027/ddj0204a/0204a.htm - "new" is monomorphic - "new" always create a new object in memory OO is a moving target http://www.paulgraham.com/paulgraham/reesoo.html O'Haskell subtyping http://www.cs.chalmers.se/~nordland/ohaskell/dtp.ps.gz Covariance and contravariance http://citeseer.ist.psu.edu/castagna94covariance.html (good) (http://research.compaq.com/SRC/personal/luca/TheoryOfObjects/FAQ.html) - What is the difference between inheritance and subtyping? Subtyping is a relation between (object) types, having to do with keeping track of the messages that objects can accept. Inheritance is a relation between classes, having to do with the superclass-subclass relation and with method reuse. The usual connection between inheritance and subtyping is the following: a subclass generates objects whose type is a subtype of the objects generated by a superclass. Initially, object-oriented languages confused classes with object types, and therefore ended up blurring the distinction between implementations (classes) and interfaces (object types), and between inheritance (code sharing) and subtyping (interface sharing). Recent object-oriented languages are designed to make these distinctions and to take advantage of them. introductory/various http://www.andrewcooke.free-online.co.uk/andrew/writing/oop.pdf OOP criticism http://www.geocities.com/tablizer/oopbad.htm Does OOP really separate interface from implementation? http://pobox.com/~oleg/ftp/Computation/Subtyping/ pbs with subtyping http://marshall-cline.home.att.net/cpp-faq-lite/proper-inheritance.html Intersection Types and Bounded Polymorphism http://citeseer.nj.nec.com/54630.html MacQueen HOT languages http://www.cs.bell-labs.com/who/dbm/Marktoberdorf/paper-a4.ps design patterns http://citeseer.nj.nec.com/bosch98design.html multi methods Efficient Compression of Generic Function Dispatch Tables http://www.cs.dartmouth.edu/reports/abstracts/TR2001-404/ Fast Algorithms for Compressed Multi-Method Dispatch Tables Generation http://citeseer.nj.nec.com/dujardin96fast.html http://citeseer.nj.nec.com/ferragina99multimethod.html late-binding (dispatching) in various languages comparison http://perso-info.enst-bretagne.fr/~beugnard/papiers/lb-sem.shtml ******************************************************************************** AOP aspect programming seems to be give a way - reflexivity: give a way to ``advice'' functions (think lisp), aka doing things before/after a function call (enable logging, link an object to another) - to rewrite a program in a more efficient way (de-foresting, only pass part of an object in corba calls) aspectJ http://aspectj.org/servlets/AJSite?channel=documentation&subChannel=papersAndSlides (simple, demagogue) http://www.parc.xerox.com/csl/groups/sda/publications/papers/Kiczales-ECOOP97/ (moot, verbose) ******************************************************************************** Languages critiques http://tunes.org/Review/Languages.html http://www.lib.uchicago.edu/keith/crisis/ comparaison for Scientific Processing http://www.azstarnet.com/~dmcclain/LanguageStudy.html An empirical comparison of C, C++, Java, Perl, Python, Rexx, and Tcl for a search/string-processing http://citeseer.nj.nec.com/311372.html simple OO features collected http://www.approximity.com/ruby/Comparison_rb_st_m_java.html http://www.smallscript.org/Language%20Comparison%20Chart.asp Why People Aren't Using Haskell http://www.jelovic.com/articles/why_people_arent_using_haskell.htm Haskell v Ada v C++ v Awk v ... http://haskell.org/papers/NSWC/jfp.ps Return values ignoring ignoring - Algol68, C, C++, C#, Java - Perl, Tcl, Python, Ruby, Lisp, Scheme, PHP(?) not ignoring - Pascal, Modula-2, Modula-3, Ada - MLs (SML, Caml, OCaml), Haskell, Mercury not a choice - Prolog (no functional syntax) - Forth, PostScript (stack based, need explicit dropping) **************************************** C: The Case Against C http://www.comp-inspirations.com/docs/casec.pdf **************************************** Java: - no "const"ness for parameters/methods (a la C++) - no parametric polymorphism - no continuations (esp. closure), no local functions - no functional programming - basic library objects are final (eg: String) - integers overflow, and no operator overloading to define your own bignums - you can discard return value of functions without warning - no variants (including enums) - explicit typing - no ``foreach'' or ``each'' operator/keyword - critique http://www.cs.mdx.ac.uk/harold/papers/javaspae.html - critique http://www.jwz.org/doc/java.html - critique: Java Infrequently Asked Questions http://www.norvig.com/java-iaq.html - critique: not typesafe http://www.cis.upenn.edu/~bcpierce/courses/629/papers/Saraswat-javabug.html - critique: Double-Checked Locking is Broken http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html - critique: 10 Reasons We Need Java 3.0 http://www.onjava.com/pub/a/onjava/2002/07/31/java3.html JVM: It is well known (e.g. see the Kawa implementation of Scheme on the JVM) that the Java Virtual Machine is not well suited for functional programming: function closures and tail-recursion calls (which are actually jump with arguments) do not exist in the JVM, and emulating them (e.g. closures as instances of specially generated classes) is quite inefficient. The JVM is not as universal as Sun's marketing hype claim it is... will-be generics http://www.onjava.com/pub/a/onjava/2001/11/14/rmi3.html **************************************** Java 2: + enums **************************************** C#: java-like, but enum available + foreach + no difference between native values (ints...) and objects + "+" operator is symmetric 2.2 + " " is "2.200000 " and " " + 2.2 is " 2.200000" (weird? well this is explained by string operator+(string,object) and string operator+(object,string) being defined) / java has exceptions in prototype, C# doesn't / goto used instead of labeled break's - no closure, no here function (nor "inner" methods) - no default parameters (http://www.gotdotnet.com/team/csharp/Information/faq/faq.aspx) The reason we prefer overloading as the solution to this problem is that it allows you, at a later time, to change the default value of a parameter without having to recompile existing client code. With C++ style default values, the defaults get burned into the client code, and you can therefore never change them once you've published an API. - s1 == s2 is deep comparison, whereas (object) s1 == s2 is shallow comparison! - why is true.ToString() giving "True" instead of "true"? - no parametric polymorphism - "break" mandatory for each case of a "switch", even for "default" - Fergus Henderson http://www.haskell.org/pipermail/haskell-cafe/2000-November/000047.html Mark Shields on C# http://www.cse.ogi.edu/~mbs/pub/csharp/talk.pdf FAQ about C# http://www.gotdotnet.com/team/csharp/Information/faq/faq.aspx http://www.25hoursaday.com/CsharpVsJava.html - buffer overflow and safeness: > Ah, that's the solution! Lets just write -proper- code. > > Chain saw guards - not needed, just use them properly! > Seat belts - not needed, just drive properly! > Languages with checks - not needed - just code properly! > Condoms ..., er, um.... **************************************** C#2: (whidbey) ++ generics **************************************** C#3: ++ concise lambda expressions with type inference + implicitly typed local variables (partial type inference) + list comprehension, sql alike (linq) + "extension methods", ie add functions to existing classes, and call them using method call syntax + anonymous types **************************************** Eiffel: -- no closures (a not-yet-standardized extension for Eiffel implements closures. Joachim Durchholz on c.l.f.) **************************************** Sather: ++ partial type inference http://www.icsi.berkeley.edu/~sather/Documentation/LanguageDescription/webmaker/DescriptionX2Echapter2-1.html#HEADING1-167 http://citeseer.nj.nec.com/stoutamire96analysi.html **************************************** D: http://www.digitalmars.com/d/ -- no boolean type -- templates a la Ada => limited genericity and no container type (except for the builtin "array") - fall through cases in a "switch" + /+ ... +/ comments which can nest anonymous functions and nested functions but no closures interfaces a la Java, no multiple-inheritance 'xxx' strings a la perl some reflexivity **************************************** C++: - not strongly typed - you can discard return value of functions without warning - here is a better syntax for C++ http://www.csse.monash.edu.au/~damian/papers/PS/SPECS.ps - What's wrong with C++ templates? http://www.kuro5hin.org/story/2003/5/26/22429/7674 more precisely STL: - errors messages not readable (see http://www.bdsoft.com/tools/stlfilt.html) - hard to debug - compilation time - missing many features (but very expandable) like join, cout<