[Swift-commit] r3396 - text/internals/trunk

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Fri Jun 18 16:21:54 CDT 2010


Author: aespinosa
Date: 2010-06-18 16:21:53 -0500 (Fri, 18 Jun 2010)
New Revision: 3396

Modified:
   text/internals/trunk/internals.tex
Log:
Karajan 2

Modified: text/internals/trunk/internals.tex
===================================================================
--- text/internals/trunk/internals.tex	2010-06-17 22:22:44 UTC (rev 3395)
+++ text/internals/trunk/internals.tex	2010-06-18 21:21:53 UTC (rev 3396)
@@ -569,4 +569,178 @@
 
 Disabling file transfer/ data staging stuff at runtime.
 
+\section{Karajan 2}
+
+Current karajan is slow.
+
+ident()
+
+if () {
+  // true
+}
+else {
+ // false
+}
+
+if(cond, true, false)
+
+Changes: parser.  Short form a lambda.  An implicit combinator.
+
+f(a) { b } -> f (a, {b} )
+
+f(a) else {b} -> f (a, {b})
+
+f(a) {b} else {c} -> f(a, {b}, {c})
+
+foreach: 
+for(i, range) { }
+
+Unlike C, it is more functional with well defined role.  A semantic instead of a
+syntax.
+
+Pascal syntax:
+
+x := 1.0
+
+x:Real := 1.0
+
+Type inference engine figures out the types
+
+f := function(n) { ... }
+
+Namespaces for overloading (as in v1). Interpreter looks at all namespace if it
+is not found.
+
+f := functin(Integer) {} | function(Real) {}
+
+Can also define operators
+
+a = '+'(1, 2)
+
+Primitive types: Real, Integer, String
+
+---
+Tuple: e.g. (Real, Integer)
+
+---
+Alt
+Real | Integer
+
+ie
+
+a := if(cond) { 1.0 }
+     else { 2 }
+
+a:Real|Integer
+
+---
+Product
+T*
+
+zero or more repetitions of the same type, not bounded and closely related to a
+channel. ie. for()
+
+Type reductor does all the heavly lifting of figuring out the type of variables.
+
+----
+Parametric types
+
+Like generics in Java
+
+List(T).  Types themselves are firstclass values
+
+myInt:=Integer
+
+a:myInt
+
+Creates a structural type inference
+
+intList:=List(Integers)
+
+a:intList = [1, 2, 3]
+
+Karajan does not implement full dependent types (they are turing complete)
+
+example:
+
+a:Matrix(3,4) - Type system can check if they can be multiplied since they are
+dependent types.
+
+Potential for fixing current bugs today.
+
+Type system is a subsemantic of the language that gets figured out at compile
+time.  Potential of catching errors early (at compile time).  Anticipation of
+values being used to create certain optimizations.  Only the components that are
+found to be compute intensive are the ones that only get translated to machine
+code.
+
+Variables are only assigned once and are lexical.
+
+a ;= 0;
+
+f := function() {
+  a
+}
+a := 1
+
+print f => dumps 1
+
+No need for a specific distinction for the type system.
+
+tree := type (value) {
+  value
+  left:tree|Null
+  right:tree|Null
+}
+
+left::value
+
+if(left != null) {
+  left::value
+}
+
+if(typeof(left) != NULL) { ... }
+
+f(a) else g(b) -> f(a, g(b))
+
+Do as much as possible at runtime.
+
+add := function(a) {
+  function(b) {
+    a+b
+  }
+}
+
+add5 := add(5)
+
+print (add5(10)) => 15
+
+*Light weight threaded and compiled to java.
+
+Parallel stuff are the same
+
+parallelFor -> can't use normal java stacks.
+
+Channels are now more optimized because of the above stuff.
+
+print: function(...) {channel(?)} -> signature(stdout)}...
+
+Blocks --
+
+properly typechecked.
+
+ifeven := function(x, t:Block, f:Block) {
+  if(x % 2 == 0) {
+    t()
+  }
+  else { f() }
+ifeven(5) {print("even")}
+else {print("odd")}
+
+\subsection{Syntax}
+
+\subsection{Semantics}
+
+\subsection{Concurrency}
+
 \end{document}




More information about the Swift-commit mailing list