Title: Mango
1Mango
- A General Purpose Programming Language
2Have Mercy
- First time talking about Mango
- Not good on my feet
- Not a good public speaker
- Never had any feedback
- Im an idiot savant
- Dont stump the chump
3My Background
- Early experience on Apple II
- University of Illinois Champaign Urbana.
- Bachelor's degree in computer engineering
- Three years at Neoglyphics software
- Three years at Alpha hardware
4How Mango Got Started
- Frustrated with C/C/Java
- There had to be a better way
- Foolishly began designing my own language
- Foolishness can be a virtue
- Its been a seven year voyage
5The Problem
- Common computing infrastructure is written in
C/C - C/C is inadequate
- Lack of higher level abstractions
- Programmers must use low level constructs
- Unsafe/unstable software
- Slower development times
6A lack of alternatives
- Java, Python, Pascal, Ada, Modula, C
- Not viable replacements
- Lack Cs virtues in performance and flexibility
- Dependent on C for core tasks
- Lack of widespread appeal (clumsy, i.e. Ada?)
- Not sufficiently different to switch
7The Solution Core Goals
- Provide higher level abstractions
- Avoid low level constructs when not needed
- Make programming easier, more enjoyable
- Retain performance and flexibility
- Allow unrestricted operations as necessary
- Low overhead
- Overall make a better experience for programmers
8Overview
- High level design goals and decisions
- Feature walk through
- Future directions
9Design Goals
10Design goals
- Syntax
- Static Typing vs. Dynamic Typing
- How Vs. What
- Large Languages Vs. Small Languages
- Object Orientation Yes or No
11Goal 1 A Good Syntax
- Syntax is key
- Its underrated (focus on semantics)
- Makes the language easier to learn
- Makes it accessible to non-programmers
- Makes the language self-documenting
- Marketing versus engineering
- Bad marketing of a good product will fail
- Bad syntax around good semantics will have a
harder time gaining acceptance
12Static versus Dynamic Typing
- Mango is statically typed
- Critical for performance
- Offers compiler hints for optimization
- Types act as documentation
- They catch many errors at compile time
- Types allows overloading of names
13How versus What
- CS fantasy to forget how and focus on what
- How is a hard problem
- Distinguish features that are theoretically
equivalent but practically different - Rich set of primitive and aggregate types
- Everything can be a list, but itll be slow
- Side effects to use memory more effectively
- Reduce copying
- Manual memory management
- GC is not possible for some applications
- Done right beats a garbage collector
14Large Vs. Small Languages
- Small language
- Secondary features are in a standard library
- Advantages easier to learn core features, make a
compiler - Large language
- First class treatment of secondary features
- Allows specialized operations, makes programs
more readable - Advantage a smoother user experience
- Ease of learning is dependent on more than
language size - You still have to learn library APIs
- Intangible quality how the language corresponds
to human cognition - Open source makes compilers easier to write
- Open front end acts as the spec
15Object-Orientation Yes or No?
- Stepanovs criticism
- programming data structures algorithms
- multi-sorted algebras
- Object orientation has shown itself useful in
certain circumstances - Offer OO as an option
- Leave inheritance behind
- Inheritance hierarchies are difficult to follow
- Fragile base class problem requires reanalysis of
class behavior
16Mango walk through
- Influences
- Syntax plus some basic examples
- Module system incremental compilation (Include
requires clause, parameter and options) (platform
and foundation files) - Naming and overloading
- Literals (include string format)
- Primitive Types
- Memory model (include pointer/reference syntax)
- Records and Abstracts
- Procedures, functions, constants (pure
functions?) - Statements Control flow
- Statements I/O
- Abstract Data Type (objects)
- Iterators and iteration operators
- Mutexes
- Exception Handling
- Strings, arrays, buffers
- Collection Types
- Global variables/External symbols/Module
Constructors - Calling convention part of the type system
17- SETL - set operations
- ALGOL - imperative block structure and syntax
- C - low level ops, low overhead
- ML - type inference, type syntax
- ADA - fine grained control over primitives
- PYTHON - indentation based syntax
- JAVA - interfaces
- C - STL, operator overloading, IO syntax
- CLU - iterators
- PASCAL - sets (bit masks)
- PERL - richness of expressibility
- COBOL - readable syntax
- SIMULA - objects
18Syntax
19Mangos Syntax
- Mango looks like pseudo code
- Indentation based syntax
- Reduces clutter and typing
- Allows more code to be shown on the screen
- Blocks can be enclosed with begin/end delimiters
if desired - All directives, definitions, statements begin
with a keyword - Simple style that is easy to remember
- Users symbolic names cannot conflict with
reserved words - This makes the language easy to extend
- There are no exclusively reserved keywords
- Legacy of lex?
20program hello with args of args_string is
print "hello world", eol print " args ",
args size, eol foreach a in args over i do
print "args", i, " '", a, "'", eol
21import std/io program sort is declare list
of integer list repeat read x of
integer from stdin exit when x 0
add x into list repeat begin
declare x of logical/boolean foreach i in
1 to list size - 1 where listi gt listi1 do
swap listi with listi1
set x exit when x false end
foreach x in list do print x, eol
22module primes import std/program, ascii/utils
procedure find_primes n of integer, primes of
(integer list) do exit when n 0 add
2 into primes declare z of integer where z
3 while primes size lt n do while
some x in primes where z x 0 do
incr z add z into primes program
primes with args of args_string is eval
args1 with ascii_to_integer into n when args
size 2 else 1000 declare primes of
integer list call find_primes with n,
primes foreach i in primes do print
i, " " print eol
23module ackermann import ascii/parse
function ack with m of integer, n of integer
yielding integer is n 1
when m 0, ack(m - 1, 1)
when n 0, ack(m - 1, ack(m, n -
1)) otherwise program ackermann with args of
args_string is declare n of integer where n
1 eval args1 with parse into n when args
size gt 0 call ack with 3, n into result
print "Ack(3,", n, ") ", result", eol
24module spell_check import ascii/parse
literal dict_hash_size is 1079 program
spell_check with args of args_string is
declare dict of ltascii stringgt set
dict_hash_size open file of ascii text
where path "dictionary.txt" foreach word
of ascii string in file do add word into
dict close file foreach word of
ascii string in stdin do print word, eol
when word not_in dict
25literal z is 43.234iprogram complex is
declare x of number/32 complex assign
1 z into p 1.0 3.3i into x
print p, , x, eol
26program set_example is declare s1 of ltascii
string, integergt set declare s2 of integer
set declare s3 of setltintegergt add
1 at one into s1 2 at two into
s2 fill s2 with x in 1 to 30 where x 3
0 yielding x extract z from x in s2 where x
9 yielding x print z, eol print
s1, eol
27Modules and Naming
28Modules
- Module is a set of symbols
- Each file is a module
- Module name must correspond to pathname
- A modules symbols can be public or private
- Public symbols are visible to other modules
- Private symbols are invisible to other modules
- Modules may import and include other modules
- Import foreign symbols are localized (private)
- Include foreign symbols are exported (public)
29Incremental Compilation
- Mango supports incremental compilation
- Module has changed
- A dependency has changed
- Major or minor revision?
- Compares syntax trees
- Major revision public change
- Minor revision private change
- Comparing syntax
- Advantage Eases implementation
- Disadvantage Set of major revisions is obviously
larger
30Naming
- Naming is not hierarchical, but geometric
- Symbol names exist within a four-d grid
- Namespace, keyword, extension, auxiliary
- Only namespace and keyword are mandatory
- Each module is part of a namespace
- Public symbols use declared namespace
- Private symbols use special namespace local
- Format
- namespacekeyword_at_extensionauxiliary
31module test in system enum color is red, blue,
green procedure do_it object tst_obj is
state a of integer b of
integer method ppp of integer yielding
integer program test is print
systemcolor_at_red print systemcolor_at_blue
call systemdo_it declare record of
systemtst_objrecord declare method of
ltinteger gt integer, systemtst_objgt method
assign systemtst_obj_at_ppp into method
32Shallow Overloading
- Overloading occurs for every imported or included
module - 4d namespace is collapsed into 1d namespace
- Utilizing keyword or extension
- Other partial namespaces as well
- Symbol can be access using proper name or alias
- Ensures all overloaded symbols have a unique name
- As a result, all overloading is superficial or
shallow - Operator overloading is also supported
33module test in system enum color is blue,
green procedure test -------------------------
--------------------------------------------------
----------------------------------- module io
part of namespace io import test enum
color is red, green, blue procedure test
program doit is call test
this will cause a unresolvable symbol name
conflict call systemtest this will
work just fine print red
this will print the word 'red' print
color_at_red this will print the word
'red' print blue this
will an unresolvable symbol name conflict
print iocolor_at_blue this will work
34 module test in mango Operator
overloading (, add, mangoadd) procedure
add with a of integer, b of integer yielding
integer Prefix overloading (parse,
parseinteger, mangoparse, mangoparseinteger)
procedure parseinteger with ascii string
yielding integer Package
overloading package ops is procedure add
(, add, _at_add, ops_at_add,
mangoops_at_add) procedure div /
(/, div, _at_div, ops_at_div, mangoops_at_div)
procedure mul (, mul, _at_mul,
ops_at_mul, mangoops_at_mul) procedure sub -
(-, sub, _at_sub, ops_at_sub, mangoops_at_sub)
35Memory Model
36Mangos Memory Model
- Value semantics
- Put stuff on the stack, particularly primitives
- Key for performance
- Offers more flexibility
- Three types of memory
- Static
- Compiled data, global variables
- Heap items that are never deleted
- Arbitrary
- Heap items that are eventually deleted
- Local
- Items that live on the stack
37Safe manual memory management
- Static datums
- Always safe to use
- Arbitrary datums
- Need to be guarded to avoid dangling pointer
references - Local datums
- Compiler must enforce restrictions to avoid
dangling pointer references
38Sentries
- Pointer guards are called sentries
- Pointers to arbitrary datums are fat
- One address to the datum on the heap
- One address to the datums sentry
- Sentries live on the heap too
- Have a static lifetime (i.e. never deallocated)
- They are very small 5 bytes
39Sentry Performance
- When sentries is small
- Good performance on modern hardware
- Sentries stay in the cache
- Half of the processors time is spent waiting on
memory - As sentries increases
- cache starts to overflow
- We need to reduce the number of sentries
40Arenas and Recycling
- Method 1 Allocate in pools
- A group of datums share a sentry
- Allocated arbitrarily, but deallocated at once
- Method 2 Recycling
- Use static datums instead
- When static datums are deleted
- Initialized to zero
- Stay on the heap until datum of the same type is
requested - Incorrect results are possible, catastrophic
failures are not - The program cannot break the type system
41variable x of integer g1 of integer
arbitrary g2 of integer static
program test is assign x into g1 legal
assign x into g2 legal assign new
integer into g1 legal declare z
of integer p1 of integer
arbitrary p2 of (integer) local
p3 of integer static assign z
into p1 illegal assign z into p2
legal assign new integer into p2
legal new integer into p3 illegal
get integer into p3 legal
42Literals
43Literals
- Definition
- A value which is known at compile time
- Types
- Immediate values
- Numeric primitives and text
- Literal expressions
- Interpreted during compilation
- Parameters
- Values used to configure the compiler
- Options
- User supplied values to customize a build
- Literals can be named
44Numeric Literals
- Six types
- Integer, Decimal, Hex, Address, Binary, Signal
- Integers and decimals also include complex plane
signifiers - Can be anonymous
- Anonymous literals are stored as untyped strings
- Converted to a real value when type is known
- There are no constraints on range
- Can be typed
- Type is specified with value
- Converted immediately to the desire type value
- There are no constraints on range
45literal int_scalar is 100_000 literal int_real
is 100_000_000_000_000_000_000_000_000_000_000r
Literal int_imag is 100_000i Literal
dec_scalar is 1.00E5 Literal dec_real is
3.14r Literal imag_imag is 123_456.56i Literal
hex is ffff_ef1d Literal addr1 is
ffee.0 Literal addr2 is ffee.7 Literal
binary is 1000_1001_0101 Literal signal is
\10xz_xxzz_0101 Literal crdnl_100 is lt100,
cardinal/32gt Literal intgr_100 is lt-100,
integer/32gt Literal pi is lt3.14, number/32gt
46Text Literals
- Two types
- Characters and Strings
- Stored as untyped strings until desired type is
known - Characters enclosed with the back tick
- Text string enclosed with the double quote
- Literals can be inserted into characters and text
strings - Named literals
- Parameters
- Options
- Character codes
- Character aliases
47literal hello_word is hello world! literal
char_a is a literal newline is \n literal
version is (major_version).(minor_version).(re
vision) literal abc is lt64gtlt65gtlt66gt lite
ral char_b is lt64gt literal path_seperator is
(path_seperator) literal home_path is
(base_path)(path_seperator)home
48Literal Expressions
- Two forms of literal expressions
- Normal literals immediate evaluation
- Macro literals deferred evaluation
- Macros are evaluated over arguments
- Result value is optionally typed
- Expressions can include
- Condition construct
- Conversion construct
- Local aliasing
49literal page_width is 80 literal seperator is
(' ', page_width) creates a string of 80
spaces literal name is "joebob briggs" macro
pick with a, b, c is min(a,b) max(b,c)
literal test is pick(10,30,50) literal
file_seperator is operating_system
such_that "linux_x86" yields '/',
"windows_95 yields '\\', "solaris"
yields '/', "windows_xp" yields
'/', else '?' literal version_string is
major_version "." minor_version "."
program_revision
50literal max_int of integer/32 is 232 -
1 literal seperator is (' ', page_width)
creates a string of 80 spaces literal name of
char/ascii() is "joebob briggs" macro pick
with a, b, c is min(a,b) max(b,c) literal
test is pick(10,30,50) literal file_seperator
is operating_system such_that
"linux_x86" yields '/', "windows_95" yields
'\\', "solaris" yields '/',
"windows_xp" yields '/', else '?' literal
version_string is major "." minor "."
revision where major
major_version, minor minor_version,
revision program_revision
51Parameters and Options
- Changes cause recompilation of module
- Part of the public interface of the module
- Checked when comparing syntax
- Only options that are used included in dependency
analysis - Parameters included in dependency analysis
- Specified by user
- Have a major impact on compilation
52Core Types
53Core Types
- Primitives
- Tuples and Unions
- Addresses, Pointers, References
- Polymorphic Types
- Strings, Arrays and Buffers
- Collections
- Records and Abstracts
54Primitives
- Logicals
- 2 state binary on/off
- 3 state boolean true/false/unknown
- 4 state signals 1/0/x/z)
- Ordinals
- Unsigned base (264-1 max)
- Range from 0 to N
- Characters
- ASCII, UTF8, UTF16, UTF32, etc
- Base 2 registers
- User specified size in bits
- Signal buses
- 4 state logic
- User specified range in bits
- Included for hardware modeling/simulations
55Primitives (contd)
- Cardinal numbers
- 1 bit to 64 bits
- Fractional precision
- Subranges
- Signed base (-262 to 262)
- upper bound, lower bound, and default are user
specified - Integer numbers
- 8 bits to 64 bits unlimited precision
- Fractional precision
- Rational numbers
- ratio of 2 integers
- Fixed point decimals
- Floating point numbers
56Primitives (contd)
- Complex numbers
- Primitives qualified with units
- Enumerations
- Matrices
- Coordinates
57Primitive Modifiers
- Conversion
- Automatic, manual, none, universal
- Evaluation
- None, Fixed, Fluid
- Approximation
- Round, Truncate, Conserve
- Overflow
- Check, Limit, Wrap
- Byte Order
- Big, Little, Host, Network
58type boolean of logical/boolean type addr of
address 1 type index of ordinal 1024
having overflow wrapped type ascii of char/ascii
having overflow checked type reg_16 of
register 150 type upper_32 of signal
6332 type count of cardinal/32 having
overflow checked, endian network type fahrenheit
of subrange -100, 32, 212 having overflow
limited type int32 of integer/32 4 a
fixed point integer with 4 bits of fractional
precision type rat360 of rational 360
rational number with base 360 type float_32 of
number/32 type dollar of decimal 102 type
cmplx32 of number/32 complex type speed of
number/32 units miles per seconds type point of
integer/32 coordinate x,y type matrix_2_2 is
integer matrix 22
59Tuples and Unions
- Anonymous type products
- Fields can be labeled
- Unions
- Each term of product is overlapped
- Unsafe
- Elaborate types decompose into tuples
60Addresses, Pointers, References
- Addresses have bitwise resolution
- Address is 2 product tuple
- Upper value byte count
- Lower value bit count
- Addresses still optimal
- types with byte-wise alignment will drop bit
count - Pointers
- Address of type where address is significant
- References
- Address of type where type is significant
61Polymorphic Types
- Sums
- Superposition of multiple types
- Qualified with type tag to ensure safety
- Handle
- Anonymous pointer (points to anything)
- Anything
- Stores any type value
62type three_integers of integer, integer,
integer type three_names_integers of a
integer, b integer, c integer type the_union
of i integer/32, c cardinal/64, b
logical/boolean union type bit_address of
address 1 type bit_address of address
8 type integer_pointer of integer
equiv to address 8 type bit_pointer of
logical/bit equiv to address1 type
integer_reference of integer program test is
declare the_sum of integer cardinal
logical/boolean rational/32 declare h of
handle declare a of anything declare p
of integer declare i1, i2 of integer
delcare c1 of cardinal assign i1 into
the_sum assign the_sum into i2 assign
p into h the handle absorbs the pointer
assign i1 into a a can hold anything
assign c1 into a
63Strings, Arrays, Buffers
- Arrays
- Dimension type can be customized
- Slices of arrays preserve range information
- Strings
- Array of items from 1 to x
- Dimension type can be customized
- Slices of strings begin at 1
- Buffers
- Fixed length string that wraps around itself
- Varying start and end positions
- Dimension type can be customized
64 type string_fixed of char/ascii(10) type
string_variable of ltchar/ascii,cardinal/64gt
string type array_fixed of ltchar/ascii, integer
coordinate x,ygt0,0 to 30,30 type
array_variable of ltchar/ascii, integer coordinate
x,ygt array type buffer_fixed of (byte,
10) type buffer_variable of ltchar/ascii,
cardinal/8gt buffer
65Collections
- Entry
- a node of a linked list
- Segment
- a combination of string and pointer
- List
- appends new data at the end
- elements allocated in pages
- Stack
- FIFO
- Can be prioritized
- Sequence
- inserts new data
- elements allocated in pages
- Queue
- LIFO
- Can be prioritized
66Collections (contd)
- Mask
- A bit mask
- Range
- A numeric range with upper and lower bounds
- Set
- A hashed set
- Doubles as a one-to-one map
- Table
- A hashed one-to-many mapping
- Group
- A special collected used for comparisons
- Graph
- Used for frequency tables
67type entry of integer entry type segment of
ascii segment 100 type list of user_record
list 256 type stack of ltuser_record,
cardinalgt stack type sequence of user_record
sequence 32 type queue of user_record queue
type mask of ascii mask type range of number
range type set of ascii string set 19 type
table of ltascii string, cardinalgt table 89
type group of integer range group type graph
of ltascii string, numbergt graph
68Type Qualifiers
69Records
- Three visibility states
- Public accessible anywhere
- Protected accessible by modules that declare
access - Private accessible within the module
- Two layout types
- Fixed in order of declaration
- Packed ordered to reduce record size
- Fields can be qualified to remove them from the
build
70Abstracts
- Interface to multiple record types
- Records mapped to abstracts using link directive
- Gives more flexibility in mapping abstracts
- Mappings can occur after declaration
- i.e. library types can still be mapped to
abstracts - Simplifies remapping of fields
- Fields can be qualified to remove them from the
build - Medley combines abstract with a group of records
71record user_data is name, surname of ascii
string address, town of ascii string
zip_code of ordinal 10_000 when
enable_zip record payment_data having
visibility protected is name, last_name of
ascii string code of ascii(3) abstract
named_record is name of ascii string
surname of ascii string link user_data to
named_record link payment_data to named_record
is last_name gt surname record
register_f1having layout fixed is count of
register 30 enable_1 of logical/bit
enable_2 of logical/bit delay of register
50 hold of regsiter 30
72 medley Expression with unary, binary, ternary,
postfix, literal is target of expression
for unary, postfix, ternary left, right of
expression for binary, ternary string of
ascii string for literal value of integer
for postfix, literal procedure print_it with e
of Expression is program test is let
e1 new Expression_at_unary let e2 new
Expression_at_binary call print_it with e1
call print_it with e2
73Abstract Data Types
- Mango can bind any type to a class
- Objects Classes Record
- Properties
- getter/setter methods
- Parameters
- Properties that can only be set at instantiation
- Delegates
- Multiple dispatch for aspects and aggregates
- Normal classes do not support inheritence
74Object Construction
- Constructor (prelude)
- Destructor (finale)
- New style constructor
- Parameters and properties can be set before the
constructor is called - Only one constructor per class no overloading
- Constructor spans entire object.
- Variable initialization at declaration
75class abc of integer is property value
of integer is update
assign operand into target query
assign target into result
method print is print value, target,
eol prelude assign 0 into
target finale call print with
76object user_obj with cnt of integer, nm of ascii
string is state count of integer where
count cnt name of ascii string where
name nm letters of ascii mask
path, type of ascii string request
allocates at initialization request buffer of
ascii buffer upto cnt prelude fill
.letters with x in name yielding x finale
print Destroying object , name, eol
property path automatically does getter and
setter method parameter type of ascii string
is update assign operand
into .type query return
.type
77Object Interfaces
- Interfaces (mixins)
- Separates sub typing concerns from implementation
- Interfaces are purely abstract. No associated
code - Uses link directive like record abstracts
- Bind operator links types to interfaces
automatically
78Interface printable with method write with
s of stream attribute default_format of
io_format attribute type_info of
type class print_integer of integer is
method write with s of stream property
default_format of io_format attribute type
of type link print_integer to printable where
type gt type_info program test is declare x
of integer where x 100 write log with x
, x, eol write (log) takes
printable interface only
79Aggregates
- Composition instead of hierarchical inheritance
- Flattens the hierarchy easier to understand and
maintain - Overriding of methods is explicit
- Compiler can statically check for problems
- All publicly accessible methods must explicitly
exported
80aspect general_motors method ghi method
abc method def aspect truck is method
abc virtual method def aggregate
general_motors_truck is inherit
general_motors inherit truck override
abc in truck with ghi in general_motors
export abc in truck export ghi in
general_motors export def in
general_motors
81aspect general_motors method ghi method
abc method def aspect truck with a of
integer, b of integer is method abc
virtual method def prelude
. aggregate general_motors_truck with a of
integer is inherit general_motors
inherit truck with a, 100 override abc in
truck with ghi in general_motors export abc
in truck export ghi in general_motors
export def in general_motors
82Built in I/O Devices
- Mangos built in I/O devices are typed
- Six types of I/O devices
- file an operating system file
- text a line oriented text file
- stream an I/O stream
- port a connection listener
- database a database
- document a document (XML)
83program test is open tx of ascii text where
path "test.txt" foreach line in tx over
i do print width5 -gt i, "", line
close tx
84Procedures and Functions
85Procedures
- Multiple inputs and output
- Call by localized reference
- Compiler makes a duplicate of a value on the
stack if necessary - Nested procedures
- Can reference variables within parents scope
- Return values are held in a named variable
- Possible to return values with assignment
86Functions and Constants
- Real functions
- Essentially a single expression
- Extended with two case constructs
- Condition and conversion
- Constants
- Similar format to functions
- Evaluated only once, result is cached
- AKA Eiffel once function
- Clean way to instantiate global variables
87Procedures and Functions (contd)
- Mango supports function/procedure pointers
- Both global and local procedures
- Invokation through expressions or statements
- Statement invokations automatically infer return
types - Labeled arguments possible
88procedure test with a of integer, b of integer
yielding c of integer, d of integer is assign
a / b into c assign a b into
d Procedure yo_baby with a of integer, b of
integer yielding integer is procedure assign
of c of integer yielding integer is
assign c into result procedure compute with
d of integer, e of integer yielding integer is
return d / e call assign
with a b into d call compute with a, b
into e call compute with a d, b e into
result Function qvc with a of integer, b of
integer yielding integer is a / b when b
ltgt 0, a when b 0 and a ltgt 0,
b when b ltgt 0, 1 otherwise
89Function fact with integer yielding integer is
1
when operand lt 1, operand fact(operand
1) when operand gt 1 Function qvc with a of
integer, b of integer yielding ascii string is
a / b when b ltgt 0, a when b
0 and a ltgt 0, b when b ltgt 0, 1
otherwise such_that 1
yields one, -1 yields minus
one, 2 to 50 yields fiftey,
51 to 100 yields one hundred,
else unknown constant total of
integer is 1 constant arena of arena is new
general_arena
90function test with ascii string string,
integer/32 yielding logical/boolean is sx
when x gt 0, sy when y gt 0, "x"
otherwise of_type ascii string such_that
"true" yields true, "false yields
false else unknown where s
operand.1, x operand.2, y x
100 constant global_arena of arena is get
arena
91procedure call_back_global with v of integer, p
of integer -gt void is call p with
v procedure call_back_local with v of integer,
p of integer -gtgt void is call p with
v procedure dump_global with v of integer is
print value , v, eol procedure doit with v
of integer is procedure dump_local with v of
integer is print value , v, eol
call call_back_local with v, dump_local
compiles call call_back_local with v,
dump_global compiles call
call_back_global with v, dump_local
fails call call_back_global with v,
dump_global compiles
92Method Pointers
- Method pointers
- combine class state with class method
- When a method is selected from a class
- Result is a method pointer
- Special attribute and receptor pointers
- Automatically evaluated
- Method pointers are a supertype of function
pointers - Will absorb function pointers
93class abc is method test1 with integer
yielding boolean parameter p1 of integer
attribute a1 of integer receptor r1 of
integer procedure p1 with integer yielding
boolean procedure test with a of abc is
declare m1 of integer gt boolean declare m2
of integer gt void declare m3 of void gt
integer assign a.test1 into m1 assign
p1 into m1 assign a.r1 into m2 assign
a.a1 into m3
94Expressions
95Operator Precedence
96 Arithmetic
97Comparison/Logical
98Casting
99Membership
- in, not_in
- is, is_not
- like, not_like
100Array
- , / for string comparisons
101Production
102 Sequence Operators
- Generate sequence pick, every
- Test sequence some, all
- Compute sequence product, sum
103Statements
104Basic Blocks
105Production
106Placement
107Arithmetic
108Invokations
109Control Flow
110Iteration
111Collection
- Add, replace, remove, take, trim, filter
- Find, extract, fill, compute, copy, modify
112Program test is declare s1, s2, s3 of
integer set assign 1,2,3,4,5 into s1
add 9 into s1 add 10 into s1
replace 5 with 6 within s1 remove 1,2,3
from s1 filter s1 with 2, 4, 6 if
3 in s1 then print 3 is in the set
fill s2 with x in 1 to 100 where x
3 0 yielding x assign every x in 1 to
100 where x 3 0 yielding x into s2
find i of integer with x in s2 where x 33
yielding x extract I of integer with x in
s2 where x 66
113I/O
114Development
115Iterators
116Iterators
- Procedures to iterate through through collections
117Exceptions
118Exception Handling
119Global variables
120Variables
121Global Constructors
122Misc
123Mutexes
124Packets
125Devices
126Genericity
127Genericity
128Builds
129Builds
- Assemblies, Platforms, and Prologues
130Module Suffixes
- Runtime type identification
- Requests types that are used
- Therefore not all types need to be instantiated
131Future Directions
132Future Directions
- Finish the compiler
- Mango is the first in a family of languages
- Sharing type system and syntax
- Targeting a virtual machine
133Application Language
- In the spirit of C or Java
- Reference semantics
- i.e. no user defined pointers
- Automated memory management
- With user intervention
- Less complicated type system
- More accessible language
134Functional Language
- Functional/Dataflow semantics
- Strong focus on doing distributed computations
- Gateway to bring functional programming to the
masses - Accessible because of shared syntax and types
-
135Record Processing Language
- Basically a replacement for COBOL
- The use of COBOL cripples the mind
- working within the limitations of the original
COBOL programming model can make for robust and
maintainable code - Overlooked area by language designers
136Command Language
- Cross between TCL and LISP
- Can be used as OS shell
- Eliza MIT LL4 conference
- Classification of Functions into 4 TypesltGgt
GeneratorltCgt ConcentratorltTgt TransformerltFgt
Filter - Connected with pipes (aka unix shells)
137Miscellaneous
- Standard Development Environment
- Text Editor, Debugger, Static Analysis, Etc.
- Programming is about community
- Programmers Organization
- Builds community
- Standards body
- Funds open source projects
- Earns revenue by supplying directory services
138The End