Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
My 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
The Problem
Common computing infrastructure is
written in C/C++
C/C++ is inadequate
Unsafe/unstable software
Slower development times
Higher development costs
A lack of alternatives
Java, Python, Perl, Pascal, Ada, Modula,
C#
Overview
High level design goals and decisions
Feature walk through
Future directions
Design Goals
Design goals
Syntax
Static Typing vs. Dynamic Typing
How Vs. What
Large Languages Vs. Small Languages
Object Orientation: Yes or No
Large language
First class treatment of secondary features
Allows specialized operations, makes programs more readable
Advantage: a smoother user experience
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
Packet/Device types
Development aids
Genericity
Syntax
Mangos Syntax
Mango looks like pseudo code
Indentation based syntax
Modules
Incremental Compilation
Mango supports incremental compilation
Module has changed
A dependency has changed
Comparing syntax
Naming
Naming is not hierarchical, but geometric
Symbol names exist within a four-d grid
Namespace, keyword, extension, auxiliary
Only namespace and keyword are mandatory
Format:
namespace::keyword@extension$auxiliary
Shallow 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
Memory Model
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
Arbitrary datums
Need to be guarded to avoid dangling pointer
references
Local datums
Compiler must enforce restrictions to avoid
dangling pointer references
Sentries
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
Sentry Performance
When # sentries is small
As # sentries increases
cache starts to overflow
Literals
Literals
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
Numeric 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
Text Literals
Two types
Characters and Strings
Stored as untyped strings until desired type is known
Named literals
Parameters
Options
Character codes
Character aliases
Literal Expressions
Two forms of literal expressions
Normal literals: immediate evaluation
Macro literals: deferred evaluation
Core Types
Core Types
Primitives
Tuples and Unions
Addresses, Pointers, References
Polymorphic Types
Strings, Arrays and Buffers
Collections
Records and Abstracts
Type Qualifiers
Pliancy: Immutable, Mutable
Reactivity: Volatile, Inert
Duration: Local, Static, Arbitrary
Memory: IO, Virtual, Physical?
Useful for embedded system with multiple
memories
Undecided: means to access hardware
registers directly
Primitives
Logical
Bit (2 State), Boolean (3 State), Signal (4 state)
Ordinal
Range from 0 to N, where N is user specified
Character
ASCII, UTF 8, UTF 16, UTF 32, 8 Bit Data
Register
Binary register, user specified dimensions
Signal
Signal bus, user specified dimensions
Primitives (contd)
Cardinal
Unsigned integer, 1/2/4/8/16/32/64 bits
Subrange
Integer
Rational
Decimal
Number
Primitives (contd)
Complex numbers
Primitives qualified with units
Enumerations
Matrices
Coordinates
Primitive Modifiers
Conversion
Automatic, manual, none, universal
Evaluation
None, Fixed, Fluid
Approximation
Round, Truncate, Conserve
Overflow
Check, Limit, Wrap
Byte Order
Big, Little, Host, Network
Pointers
Address of type where address is significant
References
Address of type where type is significant
Polymorphic Types
Sums
Handle
Anonymous pointer (points to anything)
Anything
Stores any type value
Strings
Buffers
Fixed length string that wraps around itself
Varying start and end positions
Dimension type can be customized
Collections
Entry
Segment
List
Stack
FIFO
Can be prioritized
Sequence
Queue
LIFO
Can be prioritized
Collections (contd)
Mask
A bit mask
Range
Set
A hashed set
Doubles as a one-to-one map
Table
Group
Graph
Records
Three visibility states
Public: accessible anywhere
Protected: accessible by modules that declare
access
Private: accessible within the module
Abstracts
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
Parameters
Properties that can only be set at instantiation
Delegates
Multiple dispatch for aspects and aggregates
Object 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
Object Interfaces
Interfaces (mixins)
Separates sub typing concerns from
implementation
Aggregates
Composition instead of hierarchical
inheritance
Flattens the hierarchy: easier to
understand and maintain
Overriding of methods is explicit
Compiler can statically check for problems
Procedures
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
Constants
Method Pointers
Method pointers
combine class state with class method
Expressions
Arithmetic
Addition, Subtraction, Negation, Identity
Multiplication, Division (Truncate)
Remainder, Division (Conserve)
Apply (Exponent), Absolute Value
Shift Left, Shift Right
Comparison/Logical
Equal, Not Equal
Less, Less Equal, Greater, Greater Equal
Test, Not, And, Or, Exclusive Or, Reduce
Casting
Static casting
Type is specified
Dynamic casting
Type is infered
Cast is specified with dynamic cast operator
Implicit casting
Membership
in, not_in
is, is_not
Evaluates left value with right function
Returns boolean
like, not_like
Tests left value is equivalent to right hand type
Selections
Selection of record fields/class methods
By name
By number (access to anonymous fields)
Class fields
Special attribute operator
Array
A[x] to index an array
Slice operator
Before and after some position
Within a range
Production
Create and initialize data types
Local stack, static heap, dynamic heap
Production arguments
Where clause
Initialize class properties/record fields
With clause
Class constructor arguments
Aggregate members
Within/upto
Dynamic string/array dimensions
From
Target arena
Sequence Operators
Generate sequence
Test sequence
Some: one term in set matches
All: all terms in set match
Compute sequence
Product: product of terms
Sum: sum of terms
Iterations
Iterator targets
Statements
Statements Overview
Sequence of statements
Nested block delimitation
Begin/end pair
Indentation
Overview (contd)
Variables can be named anywhere
Renaming can occur
In current block
In nested blocks
No gotos
Blocks can be labeled
Blocks can be exited
Block labels can be used to exit multiple levels
Overview: Contd
Conditional predication
Basic Blocks
Execute: nested block
Exit: exit blocks
Return: exit procedure and set results
Repeat: repeating block
Continue: repeat loop
Production
Declare: declare local variable
Allocate: make temporary
Deallocated when leaving block
Placement
Overlay: place a type over another type
Create: create a type from string
Place: place a type at an address
Map: map a device type
Open: open an I/O type
Close: close an I/O type
Assignment
Assign: copy value
Optional declared result with inferred type
Arithmetic
Reset: reset value to default
Set: set value to 1
Incr: Increment by target, else 1
Decr: Decrement by target, else 1
Magnify: Multiply by target
Reduce: Reduce by target
Invokations
Call: call function with arguments
Optional declared result with inferred type
Conditional Blocks
If: If-then-else
Select: Multiple conditions
When: Defers compilation
During: Conditional debug block
Compiler option removes them
Case Constructs
Where: case of values
Specialized Blocks
Given: Reduces polymorphic type
Collection Operators
Add: add item into set
Replace: exchange item with another
Remove: remove items from set
Take: take (arbitrary) item from set
Trim: reduce set y by set x
Filter: intersect set y by set x
Collection Iterators
Find: Return item
Option to insert and return new item
I/O
Write: write terms to I/O device
Read: read term from I/O device
Strings, Buffers, Lists read series of terms
Continue/Stop masks for character devices
Error Handling
Activate: active exception handler
Try: trap exceptions with block
Throw: throw exception
Require: assertion statement
Quit: quit program
Raise: rethrow exception
Iterators
Iterators
Procedures to iterate over type
Consists of operand and result type
Iterator activation:
By name
By type (operand and/or result)
Iteration deactivation
Result is <stop>
Result type is tagged
Iterators (contd)
Iterator sections
Exceptions
Exceptions (contd)
Four exception flavors:
Advantages
Exception is processed before unwinding
No side effects before exception handling
Reduces clutter
No need for try-catch blocks
Global variables
Global Variables
Variable: global value
Dataset: string of values
Symbol: external (linked) value
External: external (linked) function
Global Constructors
Global Initialization/Finalization code
Executed before and after program
Contents:
Local state
Prelude procedure
Finale procedure
Misc
Mutexes
Formal means of acquiring locks
Mutex object + Acquire statement
Object selected by name or by type
Mutex Components
State: local state
Prelude: initialization
Acquire: acquire lock
Retry: reacquire flag
Release: release lock
Finale: finalization
Packets
Specialized record
Header
Payload of variable size
Footer
Devices
Used to define set of hardware registers
Record of records
Register placement:
In sequence
At specified offset
Package
Used to define group of related functions
Elements of packages pushed into
extended namespace
Particularly useful for operators
Means of reducing namespace clutter
Means of grouping related generic
operators
Genericity
Genericity
Builds
Builds
Assemblies, Platforms, and Prologues
Module Suffixes
Runtime type identification
Future Directions
Future Directions
Finish the compiler
Mango is the first in a family of languages
Sharing type system and syntax
Targeting a virtual machine
Application Language
In the spirit of C# or Java
Reference semantics
i.e. no user defined pointers
Functional 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
Command Language
Cross between TCL and LISP
Can be used as OS shell
Eliza MIT LL4 conference
Classification of Functions into 4 Types:
<G> Generator
<C> Concentrator
<T> Transformer
<F> Filter
Connected with pipes (aka unix shells)
Miscellaneous
Standard Development Environment
Text Editor, Debugger, Static Analysis, Etc.
Builds community
Standards body
Funds open source projects
Earns revenue by supplying directory services
The End
Thanks for listening