117
Mango Mango A General Purpose A General Purpose Programming Language Programming Language

Mango facilito

  • Upload
    lucy

  • View
    20

  • Download
    3

Embed Size (px)

DESCRIPTION

123456

Citation preview

MangoMangoA General Purpose Programming A General Purpose Programming LanguageLanguageMy BackgroundMy BackgroundEarly experience on Apple IIEarly experience on Apple IIUniversity of Illinois !ampaign University of Illinois !ampaign Ur"ana# Ur"ana# Bac!elor$s degree in computer Bac!elor$s degree in computer engineeringengineering%!ree years at &eoglyp!ics' soft(are%!ree years at &eoglyp!ics' soft(are%!ree years at Alp!a' !ard(are%!ree years at Alp!a' !ard(are)o( Mango Got *tarted)o( Mango Got *tarted+rustrated (it! ,--,.ava+rustrated (it! ,--,.ava%!ere !ad to "e a "etter (ay%!ere !ad to "e a "etter (ay+oolis!ly "egan designing my o(n +oolis!ly "egan designing my o(n languagelanguage+oolis!ness can "e a virtue+oolis!ness can "e a virtueIt/s "een a seven year voyageIt/s "een a seven year voyage%!e Pro"lem%!e Pro"lemommon computing infrastructure is ommon computing infrastructure is (ritten in ,--(ritten in ,--,-- is inade0uate,-- is inade0uateLack of !ig!er level a"stractionsLack of !ig!er level a"stractionsProgrammers must use lo( level constructsProgrammers must use lo( level constructs1esults of ,-- use1esults of ,-- useUnsafe,unsta"le soft(areUnsafe,unsta"le soft(are*lo(er development times*lo(er development times)ig!er development costs)ig!er development costsA lack of alternativesA lack of alternatives.ava2 Pyt!on2 Perl2 Pascal2 Ada2 Modula2 .ava2 Pyt!on2 Perl2 Pascal2 Ada2 Modula2 33&ot via"le replacements&ot via"le replacementsLack /s virtues in performance and flexi"ilityLack /s virtues in performance and flexi"ility4ependent onfor core tasks 4ependent onfor core tasksLack of (idespread appeal 5clumsy2 i#e# Ada67Lack of (idespread appeal 5clumsy2 i#e# Ada67&ot sufficiently different to s(itc!&ot sufficiently different to s(itc!%!e *olution' ore Goals%!e *olution' ore GoalsProvide !ig!er level a"stractionsProvide !ig!er level a"stractionsAvoid lo( level constructs (!en not neededAvoid lo( level constructs (!en not neededMake programming easier2 more en8oya"leMake programming easier2 more en8oya"le1etain performance and flexi"ility1etain performance and flexi"ilityAllo( unrestricted operations as necessaryAllo( unrestricted operations as necessaryAvoid over!eadAvoid over!eadMatc! mac!ine execution model Matc! mac!ine execution model9verall' make a "etter experience for 9verall' make a "etter experience for programmersprogrammers9vervie(9vervie()ig! level design goals and decisions)ig! level design goals and decisions+eature (alk t!roug!+eature (alk t!roug!+uture directions+uture directions4esign Goals4esign Goals4esign goals4esign goals*yntax*yntax*tatic %yping vs# 4ynamic %yping*tatic %yping vs# 4ynamic %yping)o( :s# ;!at)o( :s# ;!atLarge Languages :s# *mall LanguagesLarge Languages :s# *mall Languages9"8ect 9rientation' programmersMakes it accessi"le to non>programmersMakes t!e language self>documenting Makes t!e language self>documenting Marketing versus engineeringMarketing versus engineeringBad marketing of a good product (ill failBad marketing of a good product (ill failBad syntax around good semantics (ill !ave Bad syntax around good semantics (ill !ave a !arder time gaining acceptancea !arder time gaining acceptance*tatic versus 4ynamic %yping*tatic versus 4ynamic %yping4ynamic languages are very popular4ynamic languages are very popular4ue to poor implementations of static 4ue to poor implementations of static languageslanguagesAdvantages of static typingAdvantages of static typingritical for performanceritical for performance%ypes act as documentation%ypes act as documentation%!ey catc! many errors at compile time%!ey catc! many errors at compile time%ypes allo(s overloading of names%ypes allo(s overloading of names)o( versus ;!at)o( versus ;!at* fantasy to forget !o( and focus on (!at* fantasy to forget !o( and focus on (!at)o( is a !ard pro"lem )o( is a !ard pro"lem4istinguis! features t!at are t!eoretically 4istinguis! features t!at are t!eoretically e0uivalent "ut practically differente0uivalent "ut practically differentEveryt!ing can "e a list2 "ut it/ll "e slo( Everyt!ing can "e a list2 "ut it/ll "e slo(1ic! set of primitive and aggregate types1ic! set of primitive and aggregate types*ide effects to use memory more effectively*ide effects to use memory more effectively1educe copying 1educe copyingManual memory managementManual memory managementG is not possi"le for some applicationsG is not possi"le for some applications 4one rig!t "eats a gar"age collector 4one rig!t "eats a gar"age collectorLarge :s# *mall LanguagesLarge :s# *mall Languages*mall language*mall language *econdary features are in a standard li"rary *econdary features are in a standard li"raryAdvantages' easier to learn core features2 make a compiler Advantages' easier to learn core features2 make a compilerLarge languageLarge language +irst class treatment of secondary features+irst class treatment of secondary features Allo(s speciali?ed operations2 makes programs more reada"le Allo(s speciali?ed operations2 makes programs more reada"leAdvantage' a smoot!er user experience Advantage' a smoot!er user experienceEase of learning is dependent on more t!an languageEase of learning is dependent on more t!an language si?e si?esorted alge"ras9"8ect orientation !as s!o(n itself useful in 9"8ect orientation !as s!o(n itself useful in certain circumstancescertain circumstances9ffer 99 as an option9ffer 99 as an optionLeave in!eritance "e!indLeave in!eritance "e!indIn!eritance !ierarc!ies are difficult to follo( In!eritance !ierarc!ies are difficult to follo(+ragile "ase class pro"lem re0uires reanalysis of+ragile "ase class pro"lem re0uires reanalysis of class "e!avior class "e!aviorMango (alk t!roug!Mango (alk t!roug!Influences Influences*yntax plus some "asic examples *yntax plus some "asic examplesModule system - incremental compilation 5Include re0uires clause2 parameter and options7Module system - incremental compilation 5Include re0uires clause2 parameter and options7 5platform and foundation files7 5platform and foundation files7&aming and overloading &aming and overloadingLiterals 5include string format7 Literals 5include string format7Primitive %ypes Primitive %ypesMemory model 5include pointer,reference syntax7 Memory model 5include pointer,reference syntax71ecords and A"stracts 1ecords and A"stractsProcedures2 functions2 constants5pure functions67 Procedures2 functions2 constants5pure functions67*tatements' ontrol flo( *tatements' ontrol flo(*tatements' I,9 *tatements' I,9A"stract 4ata %ype 5o"8ects7 A"stract 4ata %ype 5o"8ects7Iterators and iteration operators Iterators and iteration operatorsMutexes MutexesException )andling Exception )andling*trings2 arrays2 "uffers *trings2 arrays2 "uffersollection %ypes ollection %ypesGlo"al varia"les,External sym"ols,Module onstructors Glo"al varia"les,External sym"ols,Module onstructorsalling convention part of t!e type system alling convention part of t!e type systemPacket,4evice types Packet,4evice types4evelopment aids 4evelopment aidsGenericity Genericity*E%L > set operations *E%L > set operations ALG9L > imperative "lock structure and syntax ALG9L > imperative "lock structure and syntax > lo( level ops2 lo( over!ead > lo( level ops2 lo( over!eadML > type inference2 type syntax ML > type inference2 type syntax A4A > fine grained control over primitives A4A > fine grained control over primitives P indentation "ased syntax P indentation "ased syntax .A:A > interfaces .A:A > interfaces -- > *%L2 operator overloading2 I9 syntax-- > *%L2 operator overloading2 I9 syntaxLU > iterators LU > iterators PA*AL > sets 5"it masks7 PA*AL > sets 5"it masks7 PE1L > ric!ness of expressi"ility PE1L > ric!ness of expressi"ility 9B9L > reada"le syntax 9B9L > reada"le syntax *IMULA > o"8ects*IMULA > o"8ects*yntax*yntaxMango/s *yntaxMango/s *yntaxMango looks like pseudo code Mango looks like pseudo codeIndentation "ased syntax Indentation "ased syntax1educes clutter and typing 1educes clutter and typingAllo(s more code to "e s!o(n on t!e screen Allo(s more code to "e s!o(n on t!e screenBlocks can "e enclosed (it! "egin,end delimiters if desired Blocks can "e enclosed (it! "egin,end delimiters if desiredAll directives2 definitions2 statements "egin (it! aAll directives2 definitions2 statements "egin (it! a key(ord key(ord*imple style t!at is easy to remem"er *imple style t!at is easy to remem"erUser/s sym"olic names cannot conflict (it! reserved (ords User/s sym"olic names cannot conflict (it! reserved (ords%!is makes t!e language easy to extend %!is makes t!e language easy to extend%!ere are no exclusively reserved key(ords %!ere are no exclusively reserved key(ordsLegacy of lex6 Legacy of lex6Modules and &amingModules and &amingModulesModulesModule is a set of sym"olsModule is a set of sym"olsEac! file is a moduleEac! file is a moduleModule name must correspond to pat!nameModule name must correspond to pat!nameA modules sym"ols can "e pu"lic or privateA modules sym"ols can "e pu"lic or privatePu"lic' sym"ols are visi"le to ot!er modules Pu"lic' sym"ols are visi"le to ot!er modulesPrivate' sym"ols are invisi"le to ot!er modules Private' sym"ols are invisi"le to ot!er modulesModules may import and include ot!er modulesModules may import and include ot!er modulesImport' foreign sym"ols are locali?ed 5private7 Import' foreign sym"ols are locali?ed 5private7Include' foreign sym"ols are exported 5pu"lic7 Include' foreign sym"ols are exported 5pu"lic7Incremental ompilationIncremental ompilationMango supports incremental compilationMango supports incremental compilationModule !as c!anged Module !as c!angedA dependency !as c!anged A dependency !as c!angedMa8or or minor revision6Ma8or or minor revision6ompares syntax trees ompares syntax treesMa8or revision' pu"lic c!ange Ma8or revision' pu"lic c!angeMinor revision' private c!ange Minor revision' private c!angeomparing syntaxomparing syntaxAdvantage' Eases implementation Advantage' Eases implementation4isadvantage' *et of ma8or revisions is o"viously4isadvantage' *et of ma8or revisions is o"viously larger larger&aming&aming&aming is not !ierarc!ical2 "ut geometric&aming is not !ierarc!ical2 "ut geometric*ym"ol names exist (it!in a four>d grid*ym"ol names exist (it!in a four>d grid&amespace2 key(ord2 extension2 auxiliary &amespace2 key(ord2 extension2 auxiliary9nly namespace and key(ord are mandatory 9nly namespace and key(ord are mandatoryEac! module is part of a namespaceEac! module is part of a namespacePu"lic sym"ols use declared namespace Pu"lic sym"ols use declared namespacePrivate sym"ols use special namespace AlocalB Private sym"ols use special namespace AlocalB+ormat'+ormat'namespace''key(ordCextensionDauxiliary namespace''key(ordCextensionDauxiliary*!allo( 9verloading*!allo( 9verloading9verloading occurs for every imported or included9verloading occurs for every imported or included module moduleEd namespace is collapsed into =d namespace Ed namespace is collapsed into =d namespaceUtili?ing key(ord or extension Utili?ing key(ord or extension9t!er partial namespaces as (ell 9t!er partial namespaces as (ell*ym"ol can "e access using proper name or alias*ym"ol can "e access using proper name or alias Ensures all overloaded sym"ols !ave a uni0ue name Ensures all overloaded sym"ols !ave a uni0ue nameAs a result2 all overloading is superficial or s!allo( As a result2 all overloading is superficial or s!allo(9perator overloading is also supported 9perator overloading is also supportedMemory ModelMemory ModelMango/s Memory ModelMango/s Memory Model:alue semantics:alue semanticsPut stuff on t!e stack2 particularly primitives Put stuff on t!e stack2 particularly primitivesFey for performance Fey for performance9ffers more flexi"ility9ffers more flexi"ility %!ree types of memory%!ree types of memory*tatic'*tatic' ompiled data2 glo"al varia"les ompiled data2 glo"al varia"les)eap items t!at are never deleted )eap items t!at are never deletedAr"itrary'Ar"itrary' )eap items t!at are eventually deleted )eap items t!at are eventually deletedLocal' Local'Items t!at live on t!e stack Items t!at live on t!e stack*afe manual memory management*afe manual memory management*tatic datums*tatic datumsAl(ays safe to useAl(ays safe to useAr"itrary datumsAr"itrary datums&eed to "e guarded to avoid dangling pointer &eed to "e guarded to avoid dangling pointer referencesreferencesLocal datumsLocal datumsompiler must enforce restrictions to avoid ompiler must enforce restrictions to avoid dangling pointer referencesdangling pointer references*entries*entriesPointer guards are called sentriesPointer guards are called sentriesPointers to ar"itrary datums are fatPointers to ar"itrary datums are fat9ne address to t!e datum on t!e !eap9ne address to t!e datum on t!e !eap9ne address to t!e datum/s sentry9ne address to t!e datum/s sentry*entries live on t!e !eap too*entries live on t!e !eap too)ave a static lifetime 5i#e# never deallocated7)ave a static lifetime 5i#e# never deallocated7%!ey are very small G@ H "ytes%!ey are very small G@ H "ytes*entry Performance*entry Performance;!en 3 sentries is small;!en 3 sentries is smallGood performance on modern !ard(areGood performance on modern !ard(are*entries stay in t!e cac!e*entries stay in t!e cac!e)alf of t!e processor/s time is spent (aiting )alf of t!e processor/s time is spent (aiting on memoryon memoryAs 3 sentries increasesAs 3 sentries increases cac!e starts to overflo(cac!e starts to overflo(;e need to reduce t!e num"er of sentries;e need to reduce t!e num"er of sentriesArenas and 1ecyclingArenas and 1ecyclingMet!od 3=' Allocate in poolsMet!od 3=' Allocate in poolsA group of datums s!are a sentry A group of datums s!are a sentryAllocated ar"itrarily2 "ut deallocated at once Allocated ar"itrarily2 "ut deallocated at onceMet!od 3I' 1ecyclingMet!od 3I' 1ecyclingUse static datums instead Use static datums instead;!en static datums are deleted ;!en static datums are deletedInitiali?ed to ?ero Initiali?ed to ?ero*tay on t!e !eap until datum of t!e same type is re0uested *tay on t!e !eap until datum of t!e same type is re0uestedIncorrect results are possi"le2 catastrop!ic failuresIncorrect results are possi"le2 catastrop!ic failures are not are not%!e program cannot "reak t!e type system %!e program cannot "reak t!e type systemLiteralsLiteralsLiteralsLiterals4efinition4efinitionA value (!ic! is kno(n at compile time A value (!ic! is kno(n at compile time%ypes%ypesImmediate values Immediate values&umeric primitives and text&umeric primitives and text Literal expressions Literal expressionsInterpreted during compilation Interpreted during compilationParameters Parameters:alues used to configure t!e compiler :alues used to configure t!e compiler9ptions 9ptionsUser supplied values to customi?e a "uild User supplied values to customi?e a "uildLiterals can "e namedLiterals can "e named&umeric Literals&umeric Literals*ix types*ix types Integer2 4ecimal2 )ex2 Address2 Binary2 *ignal Integer2 4ecimal2 )ex2 Address2 Binary2 *ignalIntegers and decimals also include complex plane signifiers Integers and decimals also include complex plane signifiersan "e anonymous an "e anonymousAnonymous literals are stored as untyped strings Anonymous literals are stored as untyped stringsonverted to a real value (!en type is kno(n onverted to a real value (!en type is kno(n%!ere are no constraints on range %!ere are no constraints on rangean "e typed an "e typed%ype is specified (it! value %ype is specified (it! valueonverted immediately to t!e desire type value onverted immediately to t!e desire type value%!ere are no constraints on range %!ere are no constraints on range%ext Literals%ext Literals%(o types %(o types!aracters and *trings !aracters and *trings*tored as untyped strings until desired type is kno(n *tored as untyped strings until desired type is kno(n!aracters enclosed (it! t!e "ack tick !aracters enclosed (it! t!e "ack tick%ext string enclosed (it! t!e dou"le 0uote %ext string enclosed (it! t!e dou"le 0uoteLiterals can "e inserted into c!aracters and text strings Literals can "e inserted into c!aracters and text strings&amed literals &amed literalsParameters Parameters9ptions 9ptions!aracter codes !aracter codes!aracter aliases !aracter aliasesLiteral ExpressionsLiteral Expressions%(o forms of literal expressions%(o forms of literal expressions&ormal literals' immediate evaluation&ormal literals' immediate evaluationMacro literals' deferred evaluationMacro literals' deferred evaluationMacros are evaluated over argumentsMacros are evaluated over arguments1esult value is optionally typed1esult value is optionally typedExpressions can includeExpressions can includeondition constructondition constructonversion constructonversion constructLocal aliasingLocal aliasingParameters and 9ptionsParameters and 9ptions!anges cause recompilation of module!anges cause recompilation of modulePart of t!e pu"lic interface of t!e modulePart of t!e pu"lic interface of t!e module!ecked (!en comparing syntax!ecked (!en comparing syntax9nly options t!at are used included in 9nly options t!at are used included in dependency analysis dependency analysis Parameters included in dependency Parameters included in dependency analysisanalysis*pecified "y user*pecified "y user)ave a ma8or impact on compilation)ave a ma8or impact on compilationore %ypesore %ypesore %ypesore %ypesPrimitivesPrimitives%uples and Unions%uples and UnionsAddresses2 Pointers2 1eferencesAddresses2 Pointers2 1eferencesPolymorp!ic %ypesPolymorp!ic %ypes*trings2 Arrays and Buffers*trings2 Arrays and Buffersollectionsollections1ecords and A"stracts1ecords and A"stracts%ype Jualifiers%ype JualifiersPliancy' Immuta"le2 Muta"lePliancy' Immuta"le2 Muta"le1eactivity' :olatile2 Inert1eactivity' :olatile2 Inert4uration' Local2 *tatic2 Ar"itrary4uration' Local2 *tatic2 Ar"itraryMemory' I92 :irtual2 P!ysical6Memory' I92 :irtual2 P!ysical6Useful for em"edded system (it! multiple Useful for em"edded system (it! multiple memoriesmemoriesUndecided' means to access !ard(are Undecided' means to access !ard(are registers directlyregisters directlyPrimitivesPrimitivesLogicalLogicalBit 5I *tate72 Boolean 5K *tate72 *ignal 5E state7Bit 5I *tate72 Boolean 5K *tate72 *ignal 5E state7 9rdinal9rdinal1ange from L to &2 (!ere & is user specified 1ange from L to &2 (!ere & is user specified!aracter!aracterA*II2 U%+ M2 U%+ =N2 U%+ KI2 M Bit 4ata A*II2 U%+ M2 U%+ =N2 U%+ KI2 M Bit 4ata1egister1egisterBinary register2 user specified dimensions Binary register2 user specified dimensions*ignal*ignal*ignal "us2 user specified dimensions *ignal "us2 user specified dimensionsPrimitives 5cont/d7Primitives 5cont/d7ardinal ardinalUnsigned integer2 =,I,E,M,=N,KI,NE "its Unsigned integer2 =,I,E,M,=N,KI,NE "its*u"range *u"range*igned range2 upper,lo(er "ound2 default value *igned range2 upper,lo(er "ound2 default valueInteger Integer*igned integer2 M,=N,KI,NE "its *igned integer2 M,=N,KI,NE "its1ational 1ational*igned rational2 fixed or floating denominator *igned rational2 fixed or floating denominator4ecimal 4ecimal+ixed point decimal num"er +ixed point decimal num"er;!ole and fractional component;!ole and fractional component &um"er &um"er+loating point num"er2 specified si?e +loating point num"er2 specified si?ePrimitives 5cont/d7Primitives 5cont/d7omplex num"ersomplex num"ersPrimitives 0ualified (it! unitsPrimitives 0ualified (it! unitsEnumerationsEnumerationsMatricesMatricesoordinatesoordinatesPrimitive ModifiersPrimitive ModifiersonversiononversionAutomatic2 manual2 none2 universal Automatic2 manual2 none2 universalEvaluationEvaluation&one2 +ixed2 +luid &one2 +ixed2 +luidApproximationApproximation1ound2 %runcate2 onserve 1ound2 %runcate2 onserve9verflo(9verflo(!eck2 Limit2 ;rap !eck2 Limit2 ;rapByte 9rderByte 9rderBig2 Little2 )ost2 &et(ork Big2 Little2 )ost2 &et(ork%uples and Unions%uples and UnionsAnonymous type productsAnonymous type products+ields can "e la"eled+ields can "e la"eledUnionsUnionsEac! term of product is overlappedEac! term of product is overlappedUnsafeUnsafeEla"orate types decompose into tuplesEla"orate types decompose into tuplesAddresses2 Pointers2 1eferencesAddresses2 Pointers2 1eferencesAddresses !ave "it(ise resolutionAddresses !ave "it(ise resolutionAddress is I product tupleAddress is I product tupleUpper value' "yte count Upper value' "yte countLo(er value' "it count Lo(er value' "it countAddresses still optimalAddresses still optimaltypes (it! "yte>(ise alignment (ill drop "it count types (it! "yte>(ise alignment (ill drop "it countPointersPointersAddress of type (!ere address is significant Address of type (!ere address is significant1eferences1eferencesAddress of type (!ere type is significant Address of type (!ere type is significantPolymorp!ic %ypesPolymorp!ic %ypes*ums*ums*uperposition of multiple types*uperposition of multiple typesJualified (it! type tag to ensure safetyJualified (it! type tag to ensure safety)andle)andleAnonymous pointer 5points to anyt!ing7Anonymous pointer 5points to anyt!ing7Anyt!ingAnyt!ing*tores any type value*tores any type value*trings2 Arrays2 Buffers*trings2 Arrays2 BuffersArraysArrays4imension type can "e customi?ed 4imension type can "e customi?ed*lices of arrays preserve range information *lices of arrays preserve range information*trings*tringsArray of items from = to x Array of items from = to x4imension type can "e customi?ed 4imension type can "e customi?ed*lices of strings "egin at = *lices of strings "egin at =BuffersBuffers+ixed lengt! string t!at (raps around itself +ixed lengt! string t!at (raps around itself:arying start and end positions :arying start and end positions4imension type can "e customi?ed 4imension type can "e customi?edollectionsollectionsEntry Entry a node of a linked lista node of a linked list *egment *egment a com"ination of string and pointera com"ination of string and pointer List Listappends ne( data at t!e end appends ne( data at t!e endelements allocated in pages elements allocated in pages*tack*tack +I+9 +I+9an "e prioriti?ed an "e prioriti?ed*e0uence *e0uence inserts ne( data inserts ne( data elements allocated in pages elements allocated in pagesJueue JueueLI+9 LI+9an "e prioriti?ed an "e prioriti?edollections 5cont/d7ollections 5cont/d7Mask MaskA "it mask A "it mask1ange 1angeA numeric range (it! upper and lo(er "ounds A numeric range (it! upper and lo(er "ounds*et *etA !as!ed set A !as!ed set4ou"les as a one>to>one map 4ou"les as a one>to>one map%a"le %a"leA !as!ed one>to>many mappingA !as!ed one>to>many mapping Group GroupA special collected used for comparisonsA special collected used for comparisons Grap! Grap!Used for fre0uency ta"lesUsed for fre0uency ta"les 1ecords1ecords%!ree visi"ility states%!ree visi"ility statesPu"lic' accessi"le any(!erePu"lic' accessi"le any(!ereProtected' accessi"le "y modules t!at declare Protected' accessi"le "y modules t!at declare accessaccessPrivate' accessi"le (it!in t!e modulePrivate' accessi"le (it!in t!e module%(o layout types%(o layout types+ixed' in order of declaration+ixed' in order of declarationPacked' ordered to reduce record si?e Packed' ordered to reduce record si?e +ields can "e 0ualified to remove t!em +ields can "e 0ualified to remove t!em from t!e "uildfrom t!e "uildA"stractsA"stractsInterface to multiple record typesInterface to multiple record types1ecords mapped to a"stracts using link directive1ecords mapped to a"stracts using link directiveGives more flexi"ility in mapping a"stracts Gives more flexi"ility in mapping a"stractsMappings can occur after declaration Mappings can occur after declarationi#e# li"rary types can still "e mapped to a"stracts i#e# li"rary types can still "e mapped to a"stracts*implifies remapping of fields *implifies remapping of fields+ields can "e 0ualified to remove t!em from t!e +ields can "e 0ualified to remove t!em from t!e "uild"uildMedley' com"ines a"stract (it! a group of Medley' com"ines a"stract (it! a group of recordsrecordsA"stract 4ata %ypesA"stract 4ata %ypesMango can "ind any type to a classMango can "ind any type to a class9"8ects' lasses - 1ecord9"8ects' lasses - 1ecordProperties Properties getter,setter met!ods getter,setter met!odsParameters Parameters Properties t!at can only "e set at instantiation Properties t!at can only "e set at instantiation4elegates4elegatesMultiple dispatc! for aspects and aggregates Multiple dispatc! for aspects and aggregates&ormal classes do not support in!eritence&ormal classes do not support in!eritence9"8ect onstruction9"8ect onstructiononstructor 5prelude7onstructor 5prelude74estructor 5finale74estructor 5finale7&e( style constructor&e( style constructorParameters and properties can "e set "efore Parameters and properties can "e set "efore t!e constructor is calledt!e constructor is called9nly one constructor per class no 9nly one constructor per class no overloadingoverloadingonstructor spans entire o"8ect#onstructor spans entire o"8ect#:aria"le initiali?ation at declaration :aria"le initiali?ation at declaration9"8ect Interfaces9"8ect InterfacesInterfaces 5mixins7Interfaces 5mixins7*eparates su" typing concerns from *eparates su" typing concerns from implementationimplementationInterfaces are purely a"stract#&o Interfaces are purely a"stract#&o associated codeassociated codeUses link directive like record a"stractsUses link directive like record a"stractsBind operator links types to interfaces Bind operator links types to interfaces automaticallyautomaticallyAggregatesAggregatesomposition instead of !ierarc!ical omposition instead of !ierarc!ical in!eritance in!eritance +lattens t!e !ierarc!y' easier to +lattens t!e !ierarc!y' easier to understand and maintainunderstand and maintain9verriding of met!ods is explicit9verriding of met!ods is explicitompiler can statically c!eck for pro"lemsompiler can statically c!eck for pro"lemsAll pu"licly accessi"le met!ods must All pu"licly accessi"le met!ods must explicitly exportedexplicitly exportedBuilt in I,9 4evicesBuilt in I,9 4evicesMango/s "uilt in I,9 devices are typedMango/s "uilt in I,9 devices are typed*ix types of I,9 devices *ix types of I,9 devices file' an operating system file file' an operating system file text' a line oriented text file text' a line oriented text file stream' an I,9 stream stream' an I,9 stream port' a connection listener port' a connection listener data"ase' a data"ase data"ase' a data"ase document' a document 5OML7document' a document 5OML7Procedures and +unctionsProcedures and +unctionsProceduresProceduresMultiple inputs and outputMultiple inputs and outputall "y locali?ed referenceall "y locali?ed referenceompiler makes a duplicate of a value on t!e ompiler makes a duplicate of a value on t!e stack if necessarystack if necessary&ested procedures&ested proceduresan reference varia"les (it!in parents scopean reference varia"les (it!in parents scope1eturn values are !eld in a named 1eturn values are !eld in a named varia"levaria"lePossi"leto return values (it! assignmentPossi"leto return values (it! assignment+unctions and onstants+unctions and onstants1eal functions 1eal functions Essentially a single expressionEssentially a single expressionExtended (it! t(o case constructsExtended (it! t(o case constructsondition and conversion ondition and conversiononstantsonstants*imilar format to functions*imilar format to functionsEvaluated only once2 result is cac!edEvaluated only once2 result is cac!edAFA Eiffel once functionAFA Eiffel once functionlean (ay to instantiate glo"al varia"leslean (ay to instantiate glo"al varia"lesProcedures and +unctions 5cont/d7Procedures and +unctions 5cont/d7Mango supports function,procedure Mango supports function,procedure pointerspointersBot! glo"al and local proceduresBot! glo"al and local proceduresInvokation t!roug! expressions or Invokation t!roug! expressions or statementsstatements*tatement invokations automatically infer *tatement invokations automatically infer return typesreturn typesLa"eled arguments possi"leLa"eled arguments possi"leMet!od PointersMet!od PointersMet!od pointers Met!od pointers com"ine class state (it! class met!odcom"ine class state (it! class met!od;!en a met!od is selected from a class;!en a met!od is selected from a class1esult is a met!od pointer1esult is a met!od pointer*pecial attri"ute and receptor pointers*pecial attri"ute and receptor pointersAutomatically evaluatedAutomatically evaluatedMet!od pointers are a supertype of Met!od pointers are a supertype of function pointersfunction pointers;ill a"sor" function pointers;ill a"sor" function pointersExpressionsExpressions Arit!meticArit!meticAddition2 *u"traction2 &egation2 IdentityAddition2 *u"traction2 &egation2 IdentityMultiplication2 4ivision 5%runcate7Multiplication2 4ivision 5%runcate71emainder2 4ivision 5onserve71emainder2 4ivision 5onserve7Apply 5Exponent72 A"solute :alueApply 5Exponent72 A"solute :alue*!ift Left2 *!ift 1ig!t*!ift Left2 *!ift 1ig!tomparison,Logicalomparison,LogicalE0ual2 &ot E0ualE0ual2 &ot E0ualLess2 Less E0ual2 Greater2 Greater E0ualLess2 Less E0ual2 Greater2 Greater E0ual%est2 &ot2 And2 9r2 Exclusive 9r2 1educe%est2 &ot2 And2 9r2 Exclusive 9r2 1educeastingasting*tatic casting*tatic casting%ype is specified%ype is specified4ynamic casting4ynamic casting%ype is infered%ype is inferedast is specified (it! dynamic cast operatorast is specified (it! dynamic cast operatorImplicit castingImplicit casting+rom su"type to supertype+rom su"type to supertypelass to interface2 +unction to met!od2 etclass to interface2 +unction to met!od2 etcPolymorp!ic typesPolymorp!ic typesMem"ers!ipMem"ers!ipin2 notPinin2 notPin*tring2 array2 "uffer2 entry2 segment *tring2 array2 "uffer2 entry2 segmentList2 stack2 0ueue2 se0uence List2 stack2 0ueue2 se0uenceMask2 range2 set2 ta"le2 grap! Mask2 range2 set2 ta"le2 grap!is2 isPnotis2 isPnotEvaluates left value (it! rig!t function Evaluates left value (it! rig!t function1eturns "oolean 1eturns "ooleanlike2 notPlikelike2 notPlike%ests left value is e0uivalent to rig!t !and type%ests left value is e0uivalent to rig!t !and type *elections*elections*electionof record fields,class met!ods*electionof record fields,class met!odsBy nameBy nameBy num"er 5access to anonymous fields7By num"er 5access to anonymous fields7lass fieldslass fields*pecial attri"ute operator*pecial attri"ute operator4ynamic met!od operator4ynamic met!od operatorLooks for class t!at can operate on target Looks for class t!at can operate on target type2 (it! named met!odtype2 (it! named met!odArrayArrayAQxR to index an arrayAQxR to index an array*lice operator*lice operatorBefore and after some positionBefore and after some position;it!in a range;it!in a rangeG@2 ,@ for string comparisonsG@2 ,@ for string comparisons*i?e operator returns si?e 53 elements7*i?e operator returns si?e 53 elements74omain operator returns dimensions4omain operator returns dimensionsProductionProductionreate and initiali?e data typesreate and initiali?e data typesLocal stack2 static !eap2 dynamic !eap Local stack2 static !eap2 dynamic !eapProduction argumentsProduction arguments;!ere clause ;!ere clauseInitiali?e class properties,record fields Initiali?e class properties,record fields;it! clause ;it! clauselass constructor arguments lass constructor argumentsAggregate mem"ers Aggregate mem"ers;it!in,upto ;it!in,upto4ynamic string,array dimensions 4ynamic string,array dimensions+rom +rom%arget arena %arget arena *e0uence 9perators*e0uence 9peratorsGenerate se0uenceGenerate se0uencePick' select one valuePick' select one valueEvery' select group valuesEvery' select group values%est se0uence%est se0uence*ome' one term in set matc!es*ome' one term in set matc!esAll' all terms in set matc!All' all terms in set matc!omputeompute se0uencese0uenceProduct' product of termsProduct' product of terms*um' sum of terms*um' sum of termsGeneral Iteration +ormGeneral Iteration +ormQa of tR in x at ! using u over p (!ere ?Qa of tR in x at ! using u over p (!ere ?

(!ile 0(!ile 0 a in x at ! using u over p (!ere ? (!ile 0a in x at ! using u over p (!ere ? (!ile 0Sa2"T in x at ! using u over p (!ere ? (!ile 0 Sa2"T in x at ! using u over p (!ere ? (!ile 0 IterationsIterationsIterator targetsIterator targets*tring2 array2 "uffer2 entry2 segment*tring2 array2 "uffer2 entry2 segmentList2 stack2 0ueue2 se0uenceList2 stack2 0ueue2 se0uenceMask2 range2 set2 ta"le2 grap!Mask2 range2 set2 ta"le2 grap!+ile2 text2 stream2 data"ase2 document+ile2 text2 stream2 data"ase2 documentIterator constructIterator construct*tatements*tatements*tatements 9vervie(*tatements 9vervie(*e0uence of statements*e0uence of statements&ested "lock delimitation&ested "lock delimitationBegin,end pairBegin,end pairIndentationIndentationEac! statement "egins (it! key(ordEac! statement "egins (it! key(ordPossi"le to group statements under a single Possi"le to group statements under a single key(ordkey(ord4elimited (it! indentation or "egin,end pair4elimited (it! indentation or "egin,end pair9vervie( 5cont/d79vervie( 5cont/d7:aria"les can "e named any(!ere:aria"les can "e named any(!ere1enaming can occur 1enaming can occur In current "lockIn current "lockIn nested "locksIn nested "locks&o goto/s&o goto/sBlocks can "e la"eledBlocks can "e la"eledBlocks can "e exitedBlocks can "e exitedBlock la"els can "e used to exit multiple levelsBlock la"els can "e used to exit multiple levels9vervie(' ont/d9vervie(' ont/donditional predicationonditional predication+or many statements+or many statements9ften (it! alternate evaluation9ften (it! alternate evaluationBasic BlocksBasic BlocksExecute' nested "lockExecute' nested "lockExit' exit "locksExit' exit "locks1eturn' exit procedure and set results1eturn' exit procedure and set results1epeat' repeating "lock1epeat' repeating "lockontinue' repeat loopontinue' repeat loopProductionProduction4eclare' declare local varia"le4eclare' declare local varia"leAllocate' make temporaryAllocate' make temporary4eallocated (!en leaving "lock4eallocated (!en leaving "lockGet' declare static typeGet' declare static type&e(' declare dynamic type&e(' declare dynamic type4elete' recycle or delete !eap type4elete' recycle or delete !eap type%ras!' delete static !eap type%ras!' delete static !eap typePlacementPlacement9verlay' place a type over anot!er type9verlay' place a type over anot!er typereate' create a type from stringreate' create a type from stringPlace' place a type at an addressPlace' place a type at an addressMap' map a device typeMap' map a device type9pen' open an I,9 type9pen' open an I,9 typelose' close an I,9 typelose' close an I,9 typeAssignmentAssignmentAssign' copy valueAssign' copy value9ptional declared result (it! inferred type9ptional declared result (it! inferred type*(ap' s(ap t(o values*(ap' s(ap t(o valuesLet' reference alias of valueLet' reference alias of value1efine' update multiple fields of a record1efine' update multiple fields of a record%ouc!' Mark varia"le as used%ouc!' Mark varia"le as used&ot!ing' 4o not!ing&ot!ing' 4o not!ingArit!meticArit!metic1eset' reset value to default1eset' reset value to default*et' set value to =*et' set value to =Incr' Increment "y target2 else =Incr' Increment "y target2 else =4ecr' 4ecrement "y target2 else =4ecr' 4ecrement "y target2 else =Magnify' Multiply "y targetMagnify' Multiply "y target1educe' 1educe "y target1educe' 1educe "y targetInvokationsInvokationsall' call function (it! argumentsall' call function (it! arguments9ptional declared result (it! inferred type9ptional declared result (it! inferred typeEval' evaluate arguments (it! functionEval' evaluate arguments (it! function9ptional declared result (it! inferred type9ptional declared result (it! inferred typeInitiali?e' initiali?e o"8ect (it! argumentsInitiali?e' initiali?e o"8ect (it! arguments+inali?e' finali?e o"8ect+inali?e' finali?e o"8ect+unction' local function+unction' local functionProcedure' local procedureProcedure' local procedureonditional Blocksonditional BlocksIf' If>t!en>elseIf' If>t!en>else*elect' Multiple conditions*elect' Multiple conditions;!en' 4efers compilation;!en' 4efers compilation4uring' onditional de"ug "lock4uring' onditional de"ug "lockompiler option removes t!emompiler option removes t!em;!ile' Loop on pre>condition;!ile' Loop on pre>conditionUntil' Loop on post>conditionUntil' Loop on post>conditionase onstructsase onstructs;!ere' case of values;!ere' case of values)andles multiple matc!ed terms)andles multiple matc!ed termsase values can include ranges and groupsase values can include ranges and groups!aracter strings !ave contents compared!aracter strings !ave contents compared;ild cards' ase value can "e ignored;ild cards' ase value can "e ignoredonvert' covert one value into anot!eronvert' covert one value into anot!erase values can include ranges and groupsase values can include ranges and groups!aracter strings !ave contents compared!aracter strings !ave contents compared*peciali?ed Blocks*peciali?ed BlocksGiven' 1educes polymorp!ic typeGiven' 1educes polymorp!ic type)andles multiple matc!ed termsU)andles multiple matc!ed termsU;ild cards' ase value can "e ignored;ild cards' ase value can "e ignoredast' ast value2 Execute Blockast' ast value2 Execute Block+oreac!' Iterate and execute "lock +oreac!' Iterate and execute "lock Ac0uire' Ac0uire mutex and execute "lockAc0uire' Ac0uire mutex and execute "lockollection 9peratorsollection 9peratorsAdd' add item into setAdd' add item into set1eplace' exc!ange item (it! anot!er1eplace' exc!ange item (it! anot!er1emove' remove items from set1emove' remove items from set%ake' take 5ar"itrary7 item from set%ake' take 5ar"itrary7 item from set%rim' reduce set y "y set x%rim' reduce set y "y set x+ilter' intersect set y "y set x+ilter' intersect set y "y set xollection Iteratorsollection Iterators+ind' 1eturn item+ind' 1eturn item9ption to insert and return ne( item9ption to insert and return ne( itemExtract' 1emove and return itemExtract' 1emove and return item+ill' Populate collection (it! iterator+ill' Populate collection (it! iteratorompute' Arit!metic sum over iterationompute' Arit!metic sum over iterationopy' opy from one set to anot!eropy' opy from one set to anot!erModify' Update items (it!in collectionModify' Update items (it!in collectionI,9I,9;rite' (rite terms to I,9 device;rite' (rite terms to I,9 device1ead' read term from I,9 device1ead' read term from I,9 device*trings2 Buffers2 Lists read series of terms*trings2 Buffers2 Lists read series of termsontinue,*top masks for c!aracter devicesontinue,*top masks for c!aracter devicesPrint' (rite to standard outPrint' (rite to standard outLog' Atomic (rite to I,9 deviceLog' Atomic (rite to I,9 deviceAccept' accept stream from listenerAccept' accept stream from listenerMonitor' monitor group of listenersMonitor' monitor group of listenersError )andlingError )andlingActivate' active exception !andlerActivate' active exception !andler%ry' trap exceptions (it! "lock%ry' trap exceptions (it! "lock%!ro(' t!ro( exception%!ro(' t!ro( exception1e0uire' assertion statement1e0uire' assertion statementJuit' 0uit programJuit' 0uit program1aise' ret!ro( exception1aise' ret!ro( exceptionIteratorsIteratorsIteratorsIteratorsProcedures to iterate over typeProcedures to iterate over typeonsists of operand and result typeonsists of operand and result typeIterator activation'Iterator activation'By name By name By type 5operand and,or result7By type 5operand and,or result7Iteration deactivationIteration deactivation1esult is SstopT1esult is SstopT1esult type is tagged1esult type is taggedIterators 5cont/d7Iterators 5cont/d7Iterator sectionsIterator sections*tate' local state (!ile iterator active*tate' local state (!ile iterator activePrelude' initiali?ation segmentPrelude' initiali?ation segmentJuery' compute result or signal stopJuery' compute result or signal stop+inale' finali?ation segment+inale' finali?ation segmentLocal state is pus!ed on stackLocal state is pus!ed on stackExceptionsExceptionsActivated )andler *tyleActivated )andler *tyleException event code contained in glo"al Exception event code contained in glo"al !andler o"8ect!andler o"8ect)andler o"8ect pus!ed onto activation )andler o"8ect pus!ed onto activation stackstack9n exception2 !andlers are processed 9n exception2 !andlers are processed until exception is !andleduntil exception is !andledException !andling is immediate2 "efore Exception !andling is immediate2 "efore stack is un(oundstack is un(oundExceptions 5cont/d7Exceptions 5cont/d7+our exception flavors'+our exception flavors'+atal' Juit program (it!out un(inding stack+atal' Juit program (it!out un(inding stack*evere' Juit program "ut un(ind stack*evere' Juit program "ut un(ind stack&ormal' Un(ind stack to last trap&ormal' Un(ind stack to last trap*oft' Program can continue*oft' Program can continueAdvantagesAdvantagesException is processed "efore un(indingException is processed "efore un(inding&o side effects "efore exception !andling&o side effects "efore exception !andlingException code can "e pus!ed into Exception code can "e pus!ed into li"rariesli"raries*till possi"le to locali?e (it! arguments *till possi"le to locali?e (it! arguments passed during activationpassed during activation1educes clutter1educes clutter&o need for try>catc! "locks&o need for try>catc! "locks&o need for Vt!ro(s/ clauses&o need for Vt!ro(s/ clausesGlo"al varia"lesGlo"al varia"lesGlo"al :aria"lesGlo"al :aria"les:aria"le' glo"al value:aria"le' glo"al value4ataset' string of values4ataset' string of values*ym"ol' external 5linked7 value*ym"ol' external 5linked7 valueExternal' external 5linked7 functionExternal' external 5linked7 functionGlo"al onstructorsGlo"al onstructorsGlo"al Initiali?ation,+inali?ation codeGlo"al Initiali?ation,+inali?ation codeExecuted "efore and after programExecuted "efore and after programontents'ontents'Local stateLocal statePrelude procedurePrelude procedure+inale procedure+inale procedurePriority value sorts contructorsPriority value sorts contructorsMiscMiscMutexesMutexes+ormal means of ac0uiring locks+ormal means of ac0uiring locksMutex o"8ect - Ac0uire statementMutex o"8ect - Ac0uire statement9"8ect selected "y name or "y type9"8ect selected "y name or "y typeMutex omponentsMutex omponents*tate' local state*tate' local statePrelude' initiali?ationPrelude' initiali?ationAc0uire' ac0uire lockAc0uire' ac0uire lock1etry' reac0uire flag1etry' reac0uire flag1elease' release lock1elease' release lock+inale' finali?ation+inale' finali?ationPacketsPackets*peciali?ed record*peciali?ed record)eader)eaderPayload of varia"le si?ePayload of varia"le si?e+ooter+ooterPacket type is polymorp!ic pointerPacket type is polymorp!ic pointerPoint to packet of any si?ePoint to packet of any si?e4evices4evicesUsed to define set of !ard(are registersUsed to define set of !ard(are registers1ecord of records1ecord of records1egister placement'1egister placement'In se0uence In se0uence At specified offsetAt specified offsetPackagePackageUsed to define group of related functionsUsed to define group of related functionsElements of packages pus!ed into Elements of packages pus!ed into extended namespaceextended namespaceParticularly useful for operatorsParticularly useful for operatorsMeans of reducing namespace clutterMeans of reducing namespace clutterMeans of grouping related generic Means of grouping related generic operatorsoperatorsGenericityGenericityGenericityGenericityBuildsBuildsBuildsBuildsAssem"lies2 Platforms2 and ProloguesAssem"lies2 Platforms2 and ProloguesModule *uffixesModule *uffixes1untime type identification1untime type identification1e0uests types t!at are used1e0uests types t!at are used%!erefore not all types need to "e instantiated%!erefore not all types need to "e instantiated+uture 4irections+uture 4irections+uture 4irections+uture 4irections+inis! t!e compiler+inis! t!e compilerMango is t!e first in a family of languagesMango is t!e first in a family of languages*!aring type system and syntax*!aring type system and syntax%argeting a virtual mac!ine%argeting a virtual mac!ineApplication LanguageApplication LanguageIn t!e spirit of 3 or .avaIn t!e spirit of 3 or .ava1eference semantics1eference semanticsi#e# no user defined pointersi#e# no user defined pointersAutomated memory managementAutomated memory management;it! user intervention;it! user interventionLess complicated type systemLess complicated type systemMore accessi"le languageMore accessi"le language+unctional Language+unctional Language+unctional,4ataflo( semantics+unctional,4ataflo( semantics*trong focus on doing distri"uted *trong focus on doing distri"uted computationscomputationsGate(ay to "ring functional programming Gate(ay to "ring functional programming to t!e massesto t!e massesAccessi"le "ecause of s!ared syntax and Accessi"le "ecause of s!ared syntax and typestypes1ecord Processing Language1ecord Processing LanguageBasically a replacement for 9B9LBasically a replacement for 9B9LAA%!e use of 9B9L cripples t!e mindB%!e use of 9B9L cripples t!e mindBAA(orking (it!in t!e limitations of t!e original (orking (it!in t!e limitations of t!e original 9B9L programming model can make for 9B9L programming model can make for ro"ust and maintaina"le codeBro"ust and maintaina"le codeB9verlooked area "y language designers9verlooked area "y language designersommand Languageommand Languageross "et(een %L and LI*Pross "et(een %L and LI*Pan "e used as 9* s!ellan "e used as 9* s!ellEli?a MI% LLE conferenceEli?a MI% LLE conferencelassification of +unctions into E %ypes'lassification of +unctions into E %ypes'SSGGT GeneratorT GeneratorSSCCT oncentratorT oncentratorSSTTT %ransformerT %ransformerSSFFT +ilterT +ilteronnected (it! pipes 5aka unix s!ells7onnected (it! pipes 5aka unix s!ells7MiscellaneousMiscellaneous*tandard 4evelopment Environment*tandard 4evelopment Environment%ext Editor2 4e"ugger2 *tatic Analysis2 Etc#%ext Editor2 4e"ugger2 *tatic Analysis2 Etc#Programming is a"out communityProgramming is a"out communityProgrammers 9rgani?ationProgrammers 9rgani?ationBuilds communityBuilds community*tandards "ody*tandards "ody+unds open source pro8ects+unds open source pro8ectsEarns revenue "y supplying directory servicesEarns revenue "y supplying directory services%!e End%!e End%!anks for listening%!anks for listening