Talk:Generic programming

From Academic Kids

I think what the current article describes is NOT template metaprogramming. see [1] (http://osl.iu.edu/~tveldhui/papers/Template-Metaprograms/meta-art.html). -- ChristianWBrock

No, it is not. I moved that here. While it has a really good point, it is not written in the way of encyclopedia.

The standard example for the desirability of templates is the problem of implementing a type-safe data container, like a stack or a dictionary. The semantics of stack (whatever goes last in goes first out) is defined irrespective of the type of its elements, but the application programmer would normally like to restrict what goes in a particular stack (just as they restrict what can be assigned to a particular variable). That makes a generic implementation (by the library programmer, who cannot know all the applications built on top of their library) problematic. The unwanted dependency from library to application can be broken by abstracting the type of the stack's elements. The library programmer can then write a stack template, which is instantiated by the application programmer for the type they want to use. The concrete implementation of this concept (not just for stacks and dictionaries, but for many other containers, and also for algorithms operating on (abstractions of) those containers) is called STL and is part of the standard C++ library.
The "meta" in template metaprogramming distinguishes between an algorithm specifying a mapping from input to output data (and programming meaning writing down the algorithm) and a meta-algorithm - a mapping from types to algorithms (i.e. the pop() template method of a stack template maps int to a pop() for a stack of ints) in the process of template instantiation. Instantiation is not necessarily trivial - template metaprogramming techniques rely heavily on recursion and the resulting code is generally considered confusing and difficult to read.

-- Taku 04:51 Mar 18, 2003 (UTC)

Adding all the "Generic programming in Haskell" chapter

I've added a whole chapter about generic programming techniques in Haskell, since there is a lot of research in that area and I was surprised not to find anything mentioned here. It's my first contribution to Wikipedia, so I am sorry for any mistakes in the style. I'd appreciate if someone was to check the references, since I am not sure they are in the best way they could.

-- Dreixel 15:02 Dec 9, 2004

Lisp (CLOS)

Can someone competent (that excludes me) say something about generic programming in common lisp? MartinL25

Might do, instead, to merge this C++-centric article with Generic function, Multiple dispatch, and Multimethods, with reference to CLOS. --FOo 21:25, 12 Dec 2004 (UTC)
Personal tools
Navigation

    Information

    • Home Page (http://academickids.com/encyclopedia/index.php)
    • New Articles (http://www.academickids.com/encyclopedia/index.php/Special:Newpages)
    • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)


    Academic Kids Menu

    • Art and Cultures (http://www.academickids.com/encyclopedia/index.php/Art_and_Cultures)
      • Art (http://www.academickids.com/encyclopedia/index.php/Art)
      • Architecture (http://www.academickids.com/encyclopedia/index.php/Architecture)
      • Cultures (http://www.academickids.com/encyclopedia/index.php/Cultures)
      • Music (http://www.academickids.com/encyclopedia/index.php/Music)
      • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
    • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
    • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
    • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
      • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
      • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
      • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
      • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
    • History (http://www.academickids.com/encyclopedia/index.php/History)
      • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
      • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
      • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
      • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
      • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
      • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
      • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
      • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
      • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
    • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
    • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
    • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
    • Science (http://www.academickids.com/encyclopedia/index.php/Science)
      • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
      • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
      • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
      • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
      • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
      • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
      • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
      • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
    • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
      • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
      • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
      • Government (http://www.academickids.com/encyclopedia/index.php/Government)
      • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
      • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
    • Space and Astronomy (http://www.academickids.com/encyclopedia/index.php/Space_and_Astronomy)
      • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
      • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
    • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
    • US States (http://www.academickids.com/encyclopedia/index.php/US_States)
          Advertisement