online People sometimes want a programming language offering a familiar and comfortable way of solving a problem and sometimes a language with a new and intellectually stimulating approach to the problem.
new Regex("cat"); https://en.wikipedia.org/wiki/Van_cat#/media/File:Turkish_Van_Cat.jpg But sometimes we need to write more complicated programs. For that, it’s helpful to have a good computational model of what you’re trying to do. This slide shows two ways to model the same problem, namely if a string is equal (click) to the value “cat”. Depending on the subtleties of your problem, one approach may be more useful than the other. Because when we write software we’re not just typing and lighting up pixels on the screen, we’re automating computation.
new Regex("cat"); https://en.wikipedia.org/wiki/Van_cat#/media/File:Turkish_Van_Cat.jpg But sometimes we need to write more complicated programs. For that, it’s helpful to have a good computational model of what you’re trying to do. This slide shows two ways to model the same problem, namely if a string is equal (click) to the value “cat”. Depending on the subtleties of your problem, one approach may be more useful than the other. Because when we write software we’re not just typing and lighting up pixels on the screen, we’re automating computation.
the National Advisory Committee for Aeronautics (NACA) High Speed Flight Station "Computer Room", Dryden Flight Research Center Facilities, 1949. Some early programming languages like Lisp and APL were designed to model and better understand this kind of computation. The programming languages we use today lean more towards being understandable by a machine. That’s kind of a shame, but it’s changing.
“Mainstream” languages will change • There are specific reasons why they change • Just learning about certain languages can help you learn how to write interesting code I’m going to give you a whirlwind tour of 9 different languages. You probably won’t walk out of here productive in all of them. That’s not my goal. Learning interesting languages give you insight into the code you may be writing in 5-10 years. Also, I’d like to suggest that learning languages for their own sake can help you learn new ways of solving problems in any language
to choose at least one of the languages you see here which happens to tickle your fancy, and Google it. (Unless it’s P#, which is totally un-Googleable, but I’ll give you the link for that.) Picking one really odd PL you’ve never heard of and diving into it for an evening will help you understand computation in a new light.
to choose at least one of the languages you see here which happens to tickle your fancy, and Google it. (Unless it’s P#, which is totally un-Googleable, but I’ll give you the link for that.) Picking one really odd PL you’ve never heard of and diving into it for an evening will help you understand computation in a new light.
Today, you can call yourself a “full stack” developer if you know only JavaScript. Why bother looking at any other language? Didn’t Turing tell us they’re all equivalent anyway?
and a hammer, but if you want to make it from dried chick peas in under an hour, (click) you need a pressure cooker. Using the right tools does matter!
and a hammer, but if you want to make it from dried chick peas in under an hour, (click) you need a pressure cooker. Using the right tools does matter!
0) ? string.Format("{0} bottles of beer on the wall\n{0} bottles of beer\nTake one down, pass it around", total) : string.Format("{0} bottles left", total); foreach (var item in query) { Console.WriteLine(item); } http://rosettacode.org/wiki/99_Bottles_of_Beer If I want to print the lyrics to “99 bottles of beer on the wall,” I could write a program in C#
beer on the wall," puts "#{i} bottle#{plural} of beer" puts "Take one down, pass it around!" plural = '' if i - 1 == 1 if i > 1 puts "#{i-1} bottle#{plural} of beer on the wall!" puts else puts "No more bottles of beer on the wall!" end end http://rosettacode.org/wiki/99_Bottles_of_Beer Ruby
verse = [ beer + " bottles of beer on the wall,", beer + " bottles of beer!", "Take one down, pass it around", (beer - 1) + " bottles of beer on the wall!" ].join("\n"); console.log(verse); beer--; } http://rosettacode.org/wiki/99_Bottles_of_Beer JavaScript
for( int b=-1; b<99; cout $% '\n') for ( int w=0; w<3; cout $% ".\n"){ if (w==2) cout $% (( b--) ?"Take one dow" "n and pass it arou" "nd":"Go to the sto" "re and buy some mo" "re"); if (b<0) b=99 ; do{ if (w) cout $% ", "; if (b) cout $% b; else cout $% ( (w) ? 'n' : 'N') $% "o more"; cout $% " bottle" ; if (b&'1) cout $% 's' ; cout $% " of beer"; if (w&'1) cout $% " on th" "e wall" ;} while (!w++);} return 0 ; } "# "# by barrym 2011-05-01 "# no bottles were harmed in the "# making of this program!!! http://rosettacode.org/wiki/99_Bottles_of_Beer C++
''), end) for i in range(99, 0, -1): sing(i, 'of beer on the wall,') sing(i, 'of beer,') print('Take one down, pass it around,') sing(i-1, 'of beer on the wall.\n') http://rosettacode.org/wiki/99_Bottles_of_Beer Python And they kinda all look the same. Why do so many programming languages all look so similar?
about trying to see the details here; just take my word there are lots. (click) Point is, mainstream development today uses a super-limited branch of this big chart.
about trying to see the details here; just take my word there are lots. (click) Point is, mainstream development today uses a super-limited branch of this big chart.
BCPL C C++ 1990 2000 C# Java JavaScript Ruby ML OCaml F# 2010 Swift LISP Scheme Clojure APL J SASL SASL Miranda Haskell Prolog Erlang Elixir PHP Here is a simpler, some would say vastly oversimplified, representation. What does this tell us? (click) ALGOL-based languages really common. You can consider yourself a polyglot knowing only ALGOL family languages, even if you’ve never used ALGOL! For many of us, our day jobs are 100% in this pool. (click) 1972 was a very interesting year for PLs! C, ML, Prolog, and SASL (click) 1995 brought us Java, JavaScript, PHP, Ruby, and OCaml (click) Recently, we’ve seen a resurgence of ML languages: F#, Swift, Elm Why is that? Why do these waves exist? Will there be another fundamental change in how we’ll program in the future?
BCPL C C++ 1990 2000 C# Java JavaScript Ruby ML OCaml F# 2010 Swift LISP Scheme Clojure APL J SASL SASL Miranda Haskell Prolog Erlang Elixir PHP Here is a simpler, some would say vastly oversimplified, representation. What does this tell us? (click) ALGOL-based languages really common. You can consider yourself a polyglot knowing only ALGOL family languages, even if you’ve never used ALGOL! For many of us, our day jobs are 100% in this pool. (click) 1972 was a very interesting year for PLs! C, ML, Prolog, and SASL (click) 1995 brought us Java, JavaScript, PHP, Ruby, and OCaml (click) Recently, we’ve seen a resurgence of ML languages: F#, Swift, Elm Why is that? Why do these waves exist? Will there be another fundamental change in how we’ll program in the future?
BCPL C C++ 1990 2000 C# Java JavaScript Ruby ML OCaml F# 2010 Swift LISP Scheme Clojure APL J SASL SASL Miranda Haskell Prolog Erlang Elixir PHP Here is a simpler, some would say vastly oversimplified, representation. What does this tell us? (click) ALGOL-based languages really common. You can consider yourself a polyglot knowing only ALGOL family languages, even if you’ve never used ALGOL! For many of us, our day jobs are 100% in this pool. (click) 1972 was a very interesting year for PLs! C, ML, Prolog, and SASL (click) 1995 brought us Java, JavaScript, PHP, Ruby, and OCaml (click) Recently, we’ve seen a resurgence of ML languages: F#, Swift, Elm Why is that? Why do these waves exist? Will there be another fundamental change in how we’ll program in the future?
BCPL C C++ 1990 2000 C# Java JavaScript Ruby ML OCaml F# 2010 Swift LISP Scheme Clojure APL J SASL SASL Miranda Haskell Prolog Erlang Elixir PHP Here is a simpler, some would say vastly oversimplified, representation. What does this tell us? (click) ALGOL-based languages really common. You can consider yourself a polyglot knowing only ALGOL family languages, even if you’ve never used ALGOL! For many of us, our day jobs are 100% in this pool. (click) 1972 was a very interesting year for PLs! C, ML, Prolog, and SASL (click) 1995 brought us Java, JavaScript, PHP, Ruby, and OCaml (click) Recently, we’ve seen a resurgence of ML languages: F#, Swift, Elm Why is that? Why do these waves exist? Will there be another fundamental change in how we’ll program in the future?
BCPL C C++ 1990 2000 C# Java JavaScript Ruby ML OCaml F# 2010 Swift LISP Scheme Clojure APL J SASL SASL Miranda Haskell Prolog Erlang Elixir PHP Here is a simpler, some would say vastly oversimplified, representation. What does this tell us? (click) ALGOL-based languages really common. You can consider yourself a polyglot knowing only ALGOL family languages, even if you’ve never used ALGOL! For many of us, our day jobs are 100% in this pool. (click) 1972 was a very interesting year for PLs! C, ML, Prolog, and SASL (click) 1995 brought us Java, JavaScript, PHP, Ruby, and OCaml (click) Recently, we’ve seen a resurgence of ML languages: F#, Swift, Elm Why is that? Why do these waves exist? Will there be another fundamental change in how we’ll program in the future?
- mid-1970s “Beats assembler” (FORTRAN, COBOL) mid-1970s - mid-1990s “The Great Leap Backwards” (C, C++) mid-1990s - today? “Safer, Web” (Java, JavaScript) Mainstream programmers don't change languages very often, but it does happen, and it is instructive to consider the reasons why. This chart is a vast overgeneralization, but it's a starting point for discussion. 1950s used ASM because compilers not invented. 60s-70s growth of real applications + maintenance. In the late 70s we moved towards smaller computers with less processing power and storage than your WiFi light bulbs today. Language capabilities similarly downscaled during this era. 1990s moved to safer languages for wrong reasons (worried about leaks; should have worried about security, but OK….)
computing • Distributed systems • End of Moore’s Law - Storage faster than CPU • Safety and privacy We will change again. JavaScript is not the perfect language which we will use until the end of time. I’m not sure what the mainstream language of 2025 will be, but I’m going to show you some features JS will probably never have, and speculate on what we might see in the future.
STDIO? VISIBLE "HAI WORLD!!!1!" KTHXBYE http://lolcode.org/ When you heard the title,"Incredibly Strange Programming Languages," you might have thought about joke languages. Some of them are pretty funny! The example on the side is a real programming language called LOLCode. I got a good laugh out of this, but it didn't really make me think about programming any differently.
Structure and Interpretation of Computer Programs “Establishing new languages is a powerful strategy for controlling complexity in engineering design; we can often enhance our ability to deal with a complex problem by adopting a new language that enables us to describe (and hence to think about) the problem in a different way…” I'm after something different. I want to find languages which teach me new approaches to common problems which I can use in my day-to-day work, even if I am not implementing my code in that language. So let’s ask some deeper questions.
your language? Does it matter what the reserved words are? If Ruby were instead called “Yukihiro”, would that change anything? Maybe! You see, the answer possibly depends on the character set used.
that we program based on assumptions which are simply false, like the notion that characters and Unicode code units and code points are the same thing. But we can get away with that, right, because our software is mostly used by English speakers, or, well, at least not Klingons, right?
going to have to live with the realities of Unicode. It is not safe to presume code points are characters. It is not safe to presume encoding or text direction. It would be helpful to consider what happens when you abandon these assumptions.
REGIONAL INDICATOR SYMBOL LETTER A Sorry. Emoji are ruining everything. (click) So we’re just going to have to live with the realities of Unicode. It is not safe to presume code points are characters. It is not safe to presume encoding or text direction. It would be helpful to consider what happens when you abandon these assumptions.
called ‘alb. If you speak Arabic, please come up to the podium after the presentation and accept my apologies for my mispronunciations. بلق means Heart, but is actually an Arabic recursive acronym for ةجمرب ةغل :بلق ‘alb: lughat barmajeh meaning Heart: A Programming Language. Designed by Ramsey Nasser Roughly half a billion people speak Arabic. Not quite as many as English, but still pretty common. So why not have a programming language in Arabic? What could possibly go wrong?
poetry attached to the text of their language. Computer scientists have a strangely similar relationship with the text that they write as well, and that overlap was something I became fascinated with.” -Ramsey Nasser Ramsey said at this point it became an art project to try to continue, so he ran with it! This is a Kufic-style tile mosaic of بلق implementation of Fibonacci sequence
Arabic. Curly braces, semicolons, commas, and the like would have to go. But () are OK, so he used LISP syntax. I’ve added the translations. Ramsey’s REPL is strictly Arabic. Note the ligatures in the name. Also the Arabic numerals. (click) here’s Hello world (click) Program to compute Fibonacci numbers print Fibonacci 10 => 55 The language itself is less surprising than the fact that he got it to work at all given such adversarial tooling.
Arabic. Curly braces, semicolons, commas, and the like would have to go. But () are OK, so he used LISP syntax. I’ve added the translations. Ramsey’s REPL is strictly Arabic. Note the ligatures in the name. Also the Arabic numerals. (click) here’s Hello world (click) Program to compute Fibonacci numbers print Fibonacci 10 => 55 The language itself is less surprising than the fact that he got it to work at all given such adversarial tooling.
Arabic. Curly braces, semicolons, commas, and the like would have to go. But () are OK, so he used LISP syntax. I’ve added the translations. Ramsey’s REPL is strictly Arabic. Note the ligatures in the name. Also the Arabic numerals. (click) here’s Hello world (click) Program to compute Fibonacci numbers print Fibonacci 10 => 55 The language itself is less surprising than the fact that he got it to work at all given such adversarial tooling.
a lot is that languages are all equivalent due to Turing completeness. Turing completeness is widely misunderstood. A Turing complete language can implement any function whose values can be computed by an algorithm, a series of steps. Nearly all programming languages are Turing complete, but some language designers have experimented with more limited languages. Why would you ever want that?
didn’t just do one thing; it did everything.” (fictional) Joan Clarke to (fictional) Alan Turing The Imitation Game (2014) http://theimitationgamemovie.com/#blog/104786411214 A Misunderstanding Here’s a quote from a Hollywood movie. It is fiction. The real Joan Clarke had a double first degree in maths from Cambridge and would never say this. Turing never claimed his machines could solve any problem. To the contrary, his purpose was to prove that problems existed which they could not solve!
languages, BlooP, FlooP, and GlooP. BlooP is not Turing complete. It is less powerful than the languages you use every day. The other two add some additional features for more power. All three come from Douglas Hofstadter’s book Gödel Escher Bach
= 0 THEN: QUIT BLOCK O; CELL(0) (() 2; LOOP AT MOST MINUS [N,2] TIMES: BLOCK 1: BEGIN IF REMAINDER [N,CELL(0)] = 0, THEN: QUIT BLOCK 0; CELL(0) (() CELL(0) + 1; BLOCK 1: END; OUTPUT (() YES; BLOCK 0: END. BlooP looks like a standard 1970s PL until you look closely at its loops. This function is a predicate which determines if the argument is prime. The interesting thing about the looping construct in BlooP is you can’t have a loop without a bound. This turns out to be the only meaningful restriction on the language. There are really no other surprises. Important point is we were able to find an algorithm which works with a bounded loop. There exist algorithms which can’t be expressed with bounded loops. Notably, we should be able to write a universal mahcine, a program which evaluates BlooP source code, and we can, but not in BlooP!
END. FlooP adds exactly one additional feature: an unbounded loop. Hence, it’s a more powerful language. This power comes at a high price. Not all FlooP programs terminate with a sensible result. Some loop forever. But! You can implement a program which evaluates all BlooP code. That’s really useful! But you cannot write a program in FlooP which determines if an arbitrary FlooP program will terminate; Turing and Alonzo Church proved that. So we’ve solved one problem and created another!
if FlooP programs terminate. GlooP is a language which is more powerful than FlooP. This slide is blank because it doesn’t — and can’t — exist. Hofstadter points out that a language like this would be magical. You could prove a number of open problems in mathematics by implementing them in FlooP and then using GlooP to see if they terminate for all inputs. So GlooP is impossible.
With such a language, you can implement any algorithm. Why would you want a Turing complete language? In some domains, decidability is a feature. For example, the C# type system is not Turing complete, which means that the C# compiler can always give you an answer as to whether or not your code typechecks. There should never be a time when the compiler runs forever and never returns an answer. This is not true of all programming languages! Turing complete features in PLs include the Scala type system and C++ templates.
unsuccessful decryption to take precisely the same amount of time to avoid insecurity via timing oracles. This is hard and there are entire books on the subject, but one of the keys is choosing a subset of your language which leads to deterministic execution paths.
Plaintext Another example is homomorphic encryption, which allows doing computations on encrypted data. You give your encrypted financial data to a cloud service, and it computes your encrypted tax return — without ever decrypting your cyphertext! Of course there are restrictions, because you can’t branch based on a value in data, since it’s encrypted. The limitations end up looking a lot like BlooP, so it’s really helpful to know how to do useful work in that world.
code, we can generally figure out in which order things happen. Async features of some languages make this a bit harder, but at least within a method it should be clear what’s going on, right? Maybe.
2, 3 } select i * i; !" Line A DoStuff(); !" Line B DoStuffWithStuff(stuff); !" Line C We see a similar effect with enumerables; in which order do the labeled statements execute? (BCA, probably) But for the most part, you can generally look at code in C# and it will be obvious in which order stuff executes.
work quite hard in order to avoid work.” Martin Fowler Refactoring https://www.flickr.com/photos/adewale_oshineye/2933030620/ Haskell, by contrast, is lazy by default. As the programmer, however, you may have to work a little harder. What does this mean?
argument. (click) Line 5 traces when it’s called. (click) Line 6 adds 1 to the argument to the function and returns that value. (click) In the main function, we call the increment function 3 times and store the results in local variables. Then (click) we print two of those results. (click) Look at the order of execution! The first call to increment never appears, and the second two are out of order! That’s laziness at work. None of the calls to increment are invoked until the time at which the result value is needed, in the putStrLn. In practice, you can’t look at nontrivial Haskell code and guess the order of operations, so you write programs where it doesn’t matter.
argument. (click) Line 5 traces when it’s called. (click) Line 6 adds 1 to the argument to the function and returns that value. (click) In the main function, we call the increment function 3 times and store the results in local variables. Then (click) we print two of those results. (click) Look at the order of execution! The first call to increment never appears, and the second two are out of order! That’s laziness at work. None of the calls to increment are invoked until the time at which the result value is needed, in the putStrLn. In practice, you can’t look at nontrivial Haskell code and guess the order of operations, so you write programs where it doesn’t matter.
argument. (click) Line 5 traces when it’s called. (click) Line 6 adds 1 to the argument to the function and returns that value. (click) In the main function, we call the increment function 3 times and store the results in local variables. Then (click) we print two of those results. (click) Look at the order of execution! The first call to increment never appears, and the second two are out of order! That’s laziness at work. None of the calls to increment are invoked until the time at which the result value is needed, in the putStrLn. In practice, you can’t look at nontrivial Haskell code and guess the order of operations, so you write programs where it doesn’t matter.
argument. (click) Line 5 traces when it’s called. (click) Line 6 adds 1 to the argument to the function and returns that value. (click) In the main function, we call the increment function 3 times and store the results in local variables. Then (click) we print two of those results. (click) Look at the order of execution! The first call to increment never appears, and the second two are out of order! That’s laziness at work. None of the calls to increment are invoked until the time at which the result value is needed, in the putStrLn. In practice, you can’t look at nontrivial Haskell code and guess the order of operations, so you write programs where it doesn’t matter.
argument. (click) Line 5 traces when it’s called. (click) Line 6 adds 1 to the argument to the function and returns that value. (click) In the main function, we call the increment function 3 times and store the results in local variables. Then (click) we print two of those results. (click) Look at the order of execution! The first call to increment never appears, and the second two are out of order! That’s laziness at work. None of the calls to increment are invoked until the time at which the result value is needed, in the putStrLn. In practice, you can’t look at nontrivial Haskell code and guess the order of operations, so you write programs where it doesn’t matter.
argument. (click) Line 5 traces when it’s called. (click) Line 6 adds 1 to the argument to the function and returns that value. (click) In the main function, we call the increment function 3 times and store the results in local variables. Then (click) we print two of those results. (click) Look at the order of execution! The first call to increment never appears, and the second two are out of order! That’s laziness at work. None of the calls to increment are invoked until the time at which the result value is needed, in the putStrLn. In practice, you can’t look at nontrivial Haskell code and guess the order of operations, so you write programs where it doesn’t matter.
argument. (click) Line 5 traces when it’s called. (click) Line 6 adds 1 to the argument to the function and returns that value. (click) In the main function, we call the increment function 3 times and store the results in local variables. Then (click) we print two of those results. (click) Look at the order of execution! The first call to increment never appears, and the second two are out of order! That’s laziness at work. None of the calls to increment are invoked until the time at which the result value is needed, in the putStrLn. In practice, you can’t look at nontrivial Haskell code and guess the order of operations, so you write programs where it doesn’t matter.
+ 3 composed = f . g OK, so what’s the point? Doesn’t that just make everything harder? One of the principal benefits of laziness is that it enables easier composition of functions. I’ll start by defining composition, since the syntax may be unfamiliar. Composition simply combines two functions. Haskell uses the period operator, reminiscent of the circle used in math for function composition. (click) First we define two functions, f and g, then we (click) define a third which is their composition. (click) It’s equivalent to calling g and then calling f on its result. All three take one argument and return a value of the same type. Does the code on the slide make sense? Again, I just want to make it clear what that dot operator does.
+ 3 composed = f . g OK, so what’s the point? Doesn’t that just make everything harder? One of the principal benefits of laziness is that it enables easier composition of functions. I’ll start by defining composition, since the syntax may be unfamiliar. Composition simply combines two functions. Haskell uses the period operator, reminiscent of the circle used in math for function composition. (click) First we define two functions, f and g, then we (click) define a third which is their composition. (click) It’s equivalent to calling g and then calling f on its result. All three take one argument and return a value of the same type. Does the code on the slide make sense? Again, I just want to make it clear what that dot operator does.
+ 3 composed = f . g OK, so what’s the point? Doesn’t that just make everything harder? One of the principal benefits of laziness is that it enables easier composition of functions. I’ll start by defining composition, since the syntax may be unfamiliar. Composition simply combines two functions. Haskell uses the period operator, reminiscent of the circle used in math for function composition. (click) First we define two functions, f and g, then we (click) define a third which is their composition. (click) It’s equivalent to calling g and then calling f on its result. All three take one argument and return a value of the same type. Does the code on the slide make sense? Again, I just want to make it clear what that dot operator does.
+ 3 composed = f . g OK, so what’s the point? Doesn’t that just make everything harder? One of the principal benefits of laziness is that it enables easier composition of functions. I’ll start by defining composition, since the syntax may be unfamiliar. Composition simply combines two functions. Haskell uses the period operator, reminiscent of the circle used in math for function composition. (click) First we define two functions, f and g, then we (click) define a third which is their composition. (click) It’s equivalent to calling g and then calling f on its result. All three take one argument and return a value of the same type. Does the code on the slide make sense? Again, I just want to make it clear what that dot operator does.
which are simple and correct. I want to write a function to find the minimum value in a list. If you sort a list and take the first, you’ll get the minimum, right? But there’s a problem here, and it’s not correctness. What is it? (Performance)
head . sort The Haskell sort, by contrast, is so lazy that it only finds the smallest element when we use “head” to ask for the first result from the sort, and its performance is on the same order as other efficient methods of finding the minimum. This code will never sort the entire list (click) Calling the minimum function is the same as taking the head of the sorted list, and performance is similar to other methods of taking the minimum. Downside of lazy eval: Difficult to reason about performance. Haskell programmers know that taking the head of the sort is efficient, but it’s not obvious from looking at the code. However, performance is often non-obvious in many environments! So lazy evaluation helps produce obviously correct and efficient code.
head . sort minimum [3, 2, 1] = head . sort $ [3, 2, 1] The Haskell sort, by contrast, is so lazy that it only finds the smallest element when we use “head” to ask for the first result from the sort, and its performance is on the same order as other efficient methods of finding the minimum. This code will never sort the entire list (click) Calling the minimum function is the same as taking the head of the sorted list, and performance is similar to other methods of taking the minimum. Downside of lazy eval: Difficult to reason about performance. Haskell programmers know that taking the head of the sort is efficient, but it’s not obvious from looking at the code. However, performance is often non-obvious in many environments! So lazy evaluation helps produce obviously correct and efficient code.
of operation” is even harder in a distributed system. Because our CPUs aren't getting much faster these days, many programs behave as distributed systems, even if they happen to be running on a single computer.
realize that this is simply a distributed consensus problem. (click) the two sides of the river, naturally, represent two networked systems. (click) the river itself is a potential network partition, (click) and our goal is to prove that given the specification of the problem, there exists an invariant that no one gets eaten. We’re using this example because it’s easier to explain than Paxos. The real problem is that, like many client requests, this might turn out to be impossible. Perhaps you have seen this problem before and knows that a solution exists, but (click) what if I threw them a cobra and a honey badger? Is there a solution then, and what is it? Many real-world distributed systems problems turn out to be quite complicated!
of you will immediately realize that this is simply a distributed consensus problem. (click) the two sides of the river, naturally, represent two networked systems. (click) the river itself is a potential network partition, (click) and our goal is to prove that given the specification of the problem, there exists an invariant that no one gets eaten. We’re using this example because it’s easier to explain than Paxos. The real problem is that, like many client requests, this might turn out to be impossible. Perhaps you have seen this problem before and knows that a solution exists, but (click) what if I threw them a cobra and a honey badger? Is there a solution then, and what is it? Many real-world distributed systems problems turn out to be quite complicated!
Of course, Most of you will immediately realize that this is simply a distributed consensus problem. (click) the two sides of the river, naturally, represent two networked systems. (click) the river itself is a potential network partition, (click) and our goal is to prove that given the specification of the problem, there exists an invariant that no one gets eaten. We’re using this example because it’s easier to explain than Paxos. The real problem is that, like many client requests, this might turn out to be impossible. Perhaps you have seen this problem before and knows that a solution exists, but (click) what if I threw them a cobra and a honey badger? Is there a solution then, and what is it? Many real-world distributed systems problems turn out to be quite complicated!
☐NobodyGetsEaten Explain farmer puzzle. Of course, Most of you will immediately realize that this is simply a distributed consensus problem. (click) the two sides of the river, naturally, represent two networked systems. (click) the river itself is a potential network partition, (click) and our goal is to prove that given the specification of the problem, there exists an invariant that no one gets eaten. We’re using this example because it’s easier to explain than Paxos. The real problem is that, like many client requests, this might turn out to be impossible. Perhaps you have seen this problem before and knows that a solution exists, but (click) what if I threw them a cobra and a honey badger? Is there a solution then, and what is it? Many real-world distributed systems problems turn out to be quite complicated!
☐NobodyGetsEaten Explain farmer puzzle. Of course, Most of you will immediately realize that this is simply a distributed consensus problem. (click) the two sides of the river, naturally, represent two networked systems. (click) the river itself is a potential network partition, (click) and our goal is to prove that given the specification of the problem, there exists an invariant that no one gets eaten. We’re using this example because it’s easier to explain than Paxos. The real problem is that, like many client requests, this might turn out to be impossible. Perhaps you have seen this problem before and knows that a solution exists, but (click) what if I threw them a cobra and a honey badger? Is there a solution then, and what is it? Many real-world distributed systems problems turn out to be quite complicated!
river problem in TLA+, a language created by Leslie Lamport of MSR. TLA+ lets you formally define properties of systems which change over time and space using temporal logic. One thing you may notice is it’s beautiful, meant to be easier to read than to write. Distributed consensus problems are often the most error-prone pieces of a system, especially if implemented ad hoc. TLA+ doesn’t implement this code, rather, it just makes sure that the algorithm you want to implement is even correct and complete.
TLA+ model checker will find a counterexample showing that it can be solved. However, a limitation of TLA+ is that it can only verify the soundness of your model. It cannot verify that you have implemented your model in executable code correctly.
extraordinarily useful. Amazon now uses TLA+ for all of its AWS internal protocols, and they have found a number of bugs in the protocols themselves with it, as summarized by the chart on the side.
implementation as well as your model. So I’m going to tell you about another language out of MSR. You’ve heard of Microsoft C# and maybe F#. What about P#? Like TLA+, P# formally models a distributed system. But it compiles to C#, so the models are executable. Model on the screen is a server. There are a couple events, (click) ping and pong. When the server (click) receives ping, it sends pong. Pretty simple system. But it fits on a slide
implementation as well as your model. So I’m going to tell you about another language out of MSR. You’ve heard of Microsoft C# and maybe F#. What about P#? Like TLA+, P# formally models a distributed system. But it compiles to C#, so the models are executable. Model on the screen is a server. There are a couple events, (click) ping and pong. When the server (click) receives ping, it sends pong. Pretty simple system. But it fits on a slide
implementation as well as your model. So I’m going to tell you about another language out of MSR. You’ve heard of Microsoft C# and maybe F#. What about P#? Like TLA+, P# formally models a distributed system. But it compiles to C#, so the models are executable. Model on the screen is a server. There are a couple events, (click) ping and pong. When the server (click) receives ping, it sends pong. Pretty simple system. But it fits on a slide
find errors in the conceptual model. Unlike TLA+ P# can directly translate to executable code, and it finds the model errors by running exhaustive tests on the real-world system instead of the model. P# does this by augmenting the model with liveness and safety monitors which track execution of the system.
errors in the design of production Microsoft Azure Storage tools which are mostly written in C#. The team wrote a test driver which injected “fake” node failures into the system, chaos monkey style, and the test harness watched how or if the system recovered. P# then exhaustively explores the entire state space of the model. The P# team became involved in this project when the Azure Storage team was unable to reproduce an intermittent error over the course of many months; (click) the P# model found dozens of them in mere minutes.
errors in the design of production Microsoft Azure Storage tools which are mostly written in C#. The team wrote a test driver which injected “fake” node failures into the system, chaos monkey style, and the test harness watched how or if the system recovered. P# then exhaustively explores the entire state space of the model. The P# team became involved in this project when the Azure Storage team was unable to reproduce an intermittent error over the course of many months; (click) the P# model found dozens of them in mere minutes.
level. Django app for Calendar / Events. Alice is holding a surprise party for Eve. So there’s a unit test to insure this is displayed correctly Real privacy is more complicated.
(click) Special method to identify private events. This code notes the event should be visible to the host and guests, but not to the public (click) Special values for properties of private events. The Jeeves runtime will ensure that even if we compute derived values from this data, anonymity will be preserved in all contexts.
(click) Special method to identify private events. This code notes the event should be visible to the host and guests, but not to the public (click) Special values for properties of private events. The Jeeves runtime will ensure that even if we compute derived values from this data, anonymity will be preserved in all contexts.
(click) Special method to identify private events. This code notes the event should be visible to the host and guests, but not to the public (click) Special values for properties of private events. The Jeeves runtime will ensure that even if we compute derived values from this data, anonymity will be preserved in all contexts.
a small and easily understood segment of the application. “allows programmers to factor out information flow policies from the rest of web programs and rely on a web framework to dynamically enforce the policies.”
Value types Lisp Atom List Haskell Algebraic data types Julia, MATLAB Vector, Matrix APL, J Array Idris Theorem The data types provided in languages like C and C# are so under specified that it is difficult to think of them as having a fundamental datatype at all. So we have these boring arguments about whether enforcing them at compile time or runtime is a good idea at all. But many other languages are built around a more specific datatype which permits making functions which work on broad array of values. More importantly, a more powerful type theory allows the compiler to assist the programmer in producing correct and expressive code.
I'm trying to make it recognizable to developers who typically work in other languages. It’s also written to demonstrate a very specific point, as you’ll see in a second. (click) I want to write a function to compute the average of a list of integers. Have to do some casting since Idris is strict about conversion of numeric types, but it’s just the sum divided by the number of items in the list as you’d expect. (click) If I call it with []… (click) I get a less than ideal result How can I fix that?
I'm trying to make it recognizable to developers who typically work in other languages. It’s also written to demonstrate a very specific point, as you’ll see in a second. (click) I want to write a function to compute the average of a list of integers. Have to do some casting since Idris is strict about conversion of numeric types, but it’s just the sum divided by the number of items in the list as you’d expect. (click) If I call it with []… (click) I get a less than ideal result How can I fix that?
I'm trying to make it recognizable to developers who typically work in other languages. It’s also written to demonstrate a very specific point, as you’ll see in a second. (click) I want to write a function to compute the average of a list of integers. Have to do some casting since Idris is strict about conversion of numeric types, but it’s just the sum divided by the number of items in the list as you’d expect. (click) If I call it with []… (click) I get a less than ideal result How can I fix that?
I'm trying to make it recognizable to developers who typically work in other languages. It’s also written to demonstrate a very specific point, as you’ll see in a second. (click) I want to write a function to compute the average of a list of integers. Have to do some casting since Idris is strict about conversion of numeric types, but it’s just the sum divided by the number of items in the list as you’d expect. (click) If I call it with []… (click) I get a less than ideal result How can I fix that?
argument ({}) stating there must be a proof that the list is non-empty. Tells us something interesting about the types in Idris. We often think of types as constraining the sorts of values an argument might contain. But in Idris types also constrain the behavior of the code. Here, the type signature says, “All code which calls this function must first test the list to make sure it is non-empty.” (click) So when I compile, even though I’m (click) passing a hard-coded, non-empty list, the compiler tells me I haven’t proven it’s non-empty, because (click) I could potentially call formatAverage with any old list. How can we check the non-emptiness of a variable at compile time?
argument ({}) stating there must be a proof that the list is non-empty. Tells us something interesting about the types in Idris. We often think of types as constraining the sorts of values an argument might contain. But in Idris types also constrain the behavior of the code. Here, the type signature says, “All code which calls this function must first test the list to make sure it is non-empty.” (click) So when I compile, even though I’m (click) passing a hard-coded, non-empty list, the compiler tells me I haven’t proven it’s non-empty, because (click) I could potentially call formatAverage with any old list. How can we check the non-emptiness of a variable at compile time?
argument ({}) stating there must be a proof that the list is non-empty. Tells us something interesting about the types in Idris. We often think of types as constraining the sorts of values an argument might contain. But in Idris types also constrain the behavior of the code. Here, the type signature says, “All code which calls this function must first test the list to make sure it is non-empty.” (click) So when I compile, even though I’m (click) passing a hard-coded, non-empty list, the compiler tells me I haven’t proven it’s non-empty, because (click) I could potentially call formatAverage with any old list. How can we check the non-emptiness of a variable at compile time?
argument ({}) stating there must be a proof that the list is non-empty. Tells us something interesting about the types in Idris. We often think of types as constraining the sorts of values an argument might contain. But in Idris types also constrain the behavior of the code. Here, the type signature says, “All code which calls this function must first test the list to make sure it is non-empty.” (click) So when I compile, even though I’m (click) passing a hard-coded, non-empty list, the compiler tells me I haven’t proven it’s non-empty, because (click) I could potentially call formatAverage with any old list. How can we check the non-emptiness of a variable at compile time?
it for emptiness, and only call average if it’s non-empty. This allows the compiler to synthesize a proof of non- emptiness which it can pass to the implicit argument in the first method. (click) And now the compiler is satisfied with my code
it for emptiness, and only call average if it’s non-empty. This allows the compiler to synthesize a proof of non- emptiness which it can pass to the implicit argument in the first method. (click) And now the compiler is satisfied with my code
1 Shor step let count = circUa.GateCount() ∗ n∗2 let hits, misses = "# Get total gate count Gate.CacheStats() "# Get gate caching stats let gp = GrowPars(30, 2, false) "# Params for growing let circUa = circUa.GrowGates(k, gp ) "# Grow the circuit circUa.Dump() "# Dump circuit to file ShorRun circUa rslt n a qs "# Run Shor let m = Array.m api "# Accumulate all the ( fun i bit "→ bit <<< i ) rslt "# ..phase estim ation bits |> Array.sum "# ..m = quantum result let permG, permS, permN = k.Perms "# Get permutation stats http://stationq.github.io/Liquid/ You’ve heard of Language Integrated Query, now there’s Language Integrated Quantum operations! LIQUi|> is a Domain Specific Language and runtime for simulation of quantum computing on classical hardware. There is good reason to believe that quantum computing hardware is possible, but we don’t know how to build it.
Quantum Biological, Failsafe Language in Arabic? (pause) Who amongst us has not wondered this? We could call it… I dunno, Perl 6? Many languages go down the road of “a little of this, a little of that.” Sometimes it works out, at least partially. Elixir borrowed syntax from Ruby and F#, process and error handling model from Erlang, macros from LISP, works pretty well. But it doesn’t do everything! Sometimes the features fight each other.
any of this interesting, you’re my kind of developer, and I’d really enjoy sitting down and talking with you. Here are lots of different ways of reaching out. I’ll pay for lunch. Also, if you want to work for a company which encourages this kind of research… (click)