×
Eventil - Find Tech Events
Official mobile app
FREE - In Google Play
View
×
Eventil
Official mobile app
FREE - In App Store
View

The Age of Reason(ML)

0 0

so the rule for presentations is to keep it simple as few things as possible just focus on one thing so of course I'm gonna talk about about a hundred different things about a language so we're gonna fly through this first of all I'll have her talk reason oh this is beautiful alright how people have heard of Oh Chemosh Lee alright people raise their hands how many people have built on the vocabulary so reason is a language it's actually more of a developer experience based around okay okay I'll give you a bunch of very very cool features and the reason is basically a polishing and less drama so some of the goals behind it it's built by the same people that built reacts it's also smart to have a very friendly syntax a very very powerful tool very conscientious belief in the form of a very very deep editor integration and very carefully thought-out build so first off how do you guys have heard a pacman complete language so I like this this metric events so we are touring public languages but that's on a very interesting metric right there are lots of pretty boring languages that are very complete it's only a cool language if you can actually do normal background in it so just show you real quick I'm going to actually compile this this is a live nativity L or native OpenGL application built in reason it's real witness for those of you who are familiar with the game lemon actually go through here I mean that was really awesome right actually solve that maze in front of everyone under pressure but this is a reason can actually build native applications it's very cool so whenever we think about programming like I inherently think it's kind of a fun thing it's something I enjoy doing and I think most of us would say that if we were asked I will actually inherently enjoy programming but there are times where I find myself fostering programming and I try to separate those times and it kind of focus on what is it about programming that's I dislike at times sometimes it's kind of if the computer's not helping me out very much if there are bugs on down and recent goes out of its way to address a lot of the issues that you might have whenever you're frustrated with whatever your programming so it's happened the goldilocks of languages where it actually helps it rise very very hard to help you whenever you're programming oftentimes so if you're another lot of different type systems feel like tech systems are like haters in the rap game right so the compiler is always there like looking for you to fail trying to send you like what you're doing wrong but actually reason does a really good job of kind of helping you along the way and saying actually suggesting how you can improve your code or how you can fix it and for those of you like it's a very subtle here but so you can see how hold it really very fun there it's very subtle you guys won't realize that but it's kind of subconscious because our thinking is already very fun so one of the things that makes it really fun is the tooling so recent it just focuses crazy part on tooling to the point where it's kind of like having a robotic pair buddy with you whenever you're first learning and one of the actually developing production applications a reason give you example what this looks like that we want to write function call it a Sode and what we're gonna do is actually enumerates we're gonna swig match on the integer and we need to write all those cases and so if we're writing a function we're saying if it's zero it's not all one it is - it is not and as soon as we hit save it's actually going to tell us by the way I checked your code you miss the case in fact here's an example of a value that you're going to have a run so know that as soon as you hit save your buddy is watching your back it's making sure that's like your code is safe but that's like more realistic example might be something like this we have a type of animal I know maybe a cat dog or a bird and we're gonna switch over it's inside our function and if we only return so say we only handle captain dog accentuated save it's going to tell us that we forgot heard and actually this is really important to take and imagine that there are lots of cases where you built some application kind of expecting a data structure someone has come in and happen a type two that somewhere else inside your code base it's very common but now all of your code like a human has to kind of think about at which the functions might be affected by this time right where are we actually missing code in here what is it and you got this certainly makes the point to production more exciting in a way but not very much fun I think it's way to kind of find make sure that all the tags match so let's say that we have some animals and some sounds and we want to make a function that gives us the sound for an animal if we mapped over here the third time or in case we have a string and it'll actually based off of how you've written this it looks like you probably one that is sound not a string so again it's just like having that root product pair buddy there's just watching you help you every time you hit save I know one of the things I'm really worried about with code is they catch all there are cases you think you want to be able to rule some code and you're pretty sure that it's not used but you have another person sure and so what happens is by your code develops these growths all over the codebase because everyone is a little bit afraid to remove it just in case you get an artery but actually your mother everybody in this case we're handling true and false over a boolean and notice how you look it's cool you got it like you don't need that very case you can go ahead and remove it it's a very safe it actually watches to make sure that you can remove as much code as possible and all that but reason goes pretty far and how much it wants to help you so if you think about let's say that we were telling the true or false we move on to a boolean comparison or conditional in this case we're actually to match over the true and the false but we could write if this then that's this or we can write a ternary but reason is super it's like it's iron-fisted hipster conformism it requires as soon as you hit save it says another no I looked at ast this is how we write it and it will easily rewrite it for you in the browser or start in your editor there is you know discussion about how you write this part if I represent this particular part of the and I tell you sometimes I feel frustrated with say another tool or developer tools and that it will tell me what is wrong and it sounds like here's what you should be doing but it doesn't do it for you right and so reasonable part of its way to actually rewrite it for you after working with it they also have crazy good errors right now has kind of inspired the I think develop the world to try much much harder for the developer experience make sure that errors are really reasonable so this is an example of what they error looked like before where you pass the string and it was expected to be boolean the way reason does it is very similar to L what we actually want to show you your code make sure that you understand exactly where there is happening and give you a suggestion about how to fix it and it was a bit further to the point where even when there are warnings with their parts of the language that are kind of hard to understand it's going to make sure that it explains to you why the suggestion is here and actually a few alternatives about why you might write this so it's kind of like you have or what if you start with a new language oftentimes it feels like you with you the process is banging your head against the wall for about two or three days for something very very simple but you know if someone was very experienced sitting next to you they'd be like autumn just through this it would be five minutes and you being you you would know it's only be done and that's what like having a robotic everybody reason is like they actually helps you learn after go alone but you know as fun as that is like it's not a very useful language unless you can actually deploy keep it in fun people and okay one has some pretty crazy reach how do you guys have heard of you know kernels a few all right so you know kernels are kind of a new way of building applications whereas right now we will develop an application we're very very careful right we loved elite code make the surface area of our code as small as possible we kind of are seasonally craft is a beautiful application right and then what we do is we pull in 15 million lines of memory on safe and type on safe code called the Linux kernel and we just deployed what could go wrong right I know if I'm not using all 50 million lines of the code over the it doesn't really happen right but actually there are cases where for example have just happened a code is enough for a security for building a 50 million lines of code is no human being can keep that in their head there was a case in is an hypervisor for example where with venom where because of a legacy floppy disk driver that the hypervisor was presenting there was actually an escalation that allow you go through and break through the hypervisor how many of you guys are using floppy disks in the cloud these days not so many right but just the fact that was there was enough work there are going to be a very serious escalation so if we don't have this code it's much much better so you know kernels I know camel kind of leave the way here that is what we're gonna do is that compile-time we're actually going to reach out and pull in just the libraries we need so we need like pure or camel implementations of TCP and IP of TLS SSH all these kinds of libraries and usually this is a way that would be a crazy idea to try to build out but luckily a team out of Cambridge has been working for seven years to build it out and saw print on so that means whenever you compile your application there is no operating system we're literally going to pull in all the code and we're gonna produce a VM which is just your application there's no other services running and it is tiny you get some very very cool from this so instead of millions of lines of memory not safe our memory is constant icon safe code when tens of thousands of lines of memory and types a pro and this actually has huge security implications because they the attack surface of our application is vastly reduced and not only that but we can actually hold the entire stack all the way from the hypervisor up to our application in our heads a single human being can hold about 10,000 lines and follow the the lines of execution through that whereas with the late colonel even have a much more challenging time build from there end up being very very small so how small can you get a Linux VM pretty small maybe tens of megabytes hundreds of megabytes and you can boot it's in couple of seconds it's pretty good we're pretty happy with that you're the kernels actually are in hundreds of kilobytes there's gonna be the entire p.m. and they boot within say 50 milliseconds and this is crazy because it is so small literally every time you do a deploy you can push that kernel and she'll get repo you have an entire block everything that has ever been deployed when your server and if you ever ever gets an arrow for example you can check out that exact version of the server and repo it locally it's amazing because if it's up so quickly it enables totally new kinds of deployment scenarios and that's before example that we have no servers running we have just a load a request comes in for our server with you literally the reply window for TCP is such that we can literally make shout boot up an entire p.m. just for this one connection connected and then as soon as that this connection is done she'll let me enter so you can kind of imagine it like the hug of death from hacker news or reddit or something like that as people are coming in we're literally going to boot new VMs for them and return them in the period of time that takes for the TCP connection to complete so if you guys have used AWS lambda like you can get it pretty fast you have like maybe a forty milliseconds overhead for a function we can put our entire server written reason in 50 milliseconds and in fact it's currently closer to 20 or 50 milliseconds but if you do it's right you can get down to five or ten milliseconds it's crazy you can also for a traditional say with those applications or des of our latex applications just kind of a standard thing there and it has an amazing JavaScript story so this is one of the few languages where you can actually program you can make TCP stacks that are performance and secure but it's also an expressive language it allows you to write amazing you eyes and in this case PostScript is the compiler and it focuses on two things very smooth integration with existing JavaScript libraries so things like real motion etc and very clean generated code and it's not talking about that so just give you a quick tests this is some JavaScript this is some JavaScript which of these two is written by a human in the ideas first one second one second all right well they're by a compiler but you guys have to think about it so this is actually the old camel that's writes it but the compiler is actually super for performance and it generates just it the exact JavaScript that you might write by hand I this looks like it's written by a human you know then like a little comment there but all like this is the nice thing about the reason and kind of Facebook technologies just like reacts Facebook knows that you have to have this clear upgrade path where you can start with a small piece and in that's the name kind of have it grow and just like with that with a reason you need to you can pop down to JavaScript and introduce into your team in a way that is not going to radically require you to throw everything out and for your entire team to learn reason they need to be able to read the JavaScript and still understand what's going on so we won't have all the benefits of the type checking in that robotic care buddy but we still want to be able to work with the existing kind of JavaScript world all right not only that's but we can go down to our 64 it have some great compiler council native iOS for example or Android where we can or in SFI and so we're actually able to use the native iOS and Android libraries and we don't actually have a JIT that we're running so we have a very very predictable performance on platforms where we really care about every little bit or every single CPU cycle and this is for example of me taking that the same exact code that around earlier I put it up a docker image that had the compiler on coltrane that's all I compiled it out to forearm 64 and then running it on the Raspberry Pi so we can actually run Oh camel on the browser on desktop we can build you the kernels we can go to native mobile and time to sort of embedded devices in a Raspberry Pi as they get faster and faster every year but it's still any platform we really care about having a very particular performance envelope and kind of eating out every bit of the phones that we can so we have both great reach with reason and great semantics so it's like I said it's one these few languages that it's actually very well-suited for both systems language versus systems level programming but also for application development Oh Campbell itself which reason it's based long has a sometime worryingly or the querying obsession with performance they do crazy things to make it as fast as possible but unfortunately I'm on say in the browser and mobile platforms it has a very very predictable so we can always reason about our code if we see it being fast once we know it's going to be fast in the future so overall reason has great semantics it has crazy reach and this is not a like what was common denominator reach this is we can optimize for every platform individually with that same language we can share that code across all the different platforms if we change something and there's an error say for example in the back end and we're sharing code with the front end as soon as we had saved we're gonna know we broke the front end right we don't have to wait for tests not right for integrations we did say we know everything so kind of my pitch to say if you're coming from it or to this from a JavaScript point of view I would say to imagine that the flow and Babel scripts were there from the beginning any language that was very very carefully thought out that's an amazing engineers working on the from the beginning that had great tooling and could go basically anywhere that's reason so there is this question Oh cam was actually more than 20 years old like if it is so good where it hasn't been and it can't be decremented right and actually I would argue that there's this kind of chasm and the innovators here that's the saintly academics they've been working on ocal doing crazy cool things that's make the language very interesting and it's just early adopter stage where you have financial services continuing Jane Street facing all of their applications on it and they're actually trading with their actual money and so they like they care about the practice and performance in quite a bit so they're willing to pay a lot of the costs that come for the doctors and one mission that actually works but they're gonna kind of deal with any issues that come up the problem is there is this chasm there early maturity the practice they just want to get stuff done right most of us don't actually care about him it's cool to play with the language or not going to use it in production unless it actually works and so okay well that's basically this cathode is where cool tech goes to die it's very sad there's a lot of old secretary but kind of with the amount of resources and energy that Facebook has been investing in and recently we can kind of see it start to genre from the early adopter stage over to where it's actually pragmatic we can use reason today to actually build very very interesting applications so there are some very very cool projects and some Jared here actually is the author of some of them what'm is regions so you can kind of imagine also that whenever you're trying to integrate with JavaScript compiles everyone it gets into reasons you can get all those benefits of reasons by the robotic pair buddy the performance the reach etc there's a very kind of mechanical translation process that happens and it's not particularly fun where it's kind of like a monkey see a line of JavaScript code and monkey lot write a line of recent code so what Reach is does is actually the parse your JavaScript for you and we'll put reason joke it's not gonna run that's gonna take care of all of mechanical stuff so now you can go through and actually very very quickly translate your code over and then annotations so that you can get his work on reason and relay off is actually an example I think of a application for a project that uses it or use this initially which if you're familiar with the JavaScript implementation of flexbox Jordan actually implemented real layout which is a recent port where we took that JavaScript implementation wrote it in reason and now this runs in WebGL it runs on a while it runs in the browser and you can even learn it on not sure what you would pay out there but it's pretty cool there is a danger reason and is that every project seems to have to start with read to the funder we even have a really reactive now hopefully that changes so actually I would encourage you guys to ask some questions about the trade-offs between JavaScript loader script and L enclosure day today we did we built some products at L and compared with say for example JavaScript and flow and how they're different so actually there's a bunch of other stuff like ok well he's a crazy language like I said there's so much in here so reason actually allows you to separate your syntax and your semantics so they have they're able to say we all serialize to the same as T but that means that we can write a function that will take that ast and print it into different syntaxes in our editor so if for example you're like me and you like closure syntax you can read your recent code in closures in terms you're gonna save it out to this ast and whoever else opens it I was gonna see it in their printer but now we can actually start to move the language into our own vision and the problem with fast this is a bit like food like everyone feels entitled to an opinion all rights very very but it's the epitome of bike shelling topics and so this nice thing is now instead of bike shedding you can say if you want the difference in tax just right your printer for it and you'll have it you can see it however you like so kind of like a but if thousands index moonface so right now our reason actually has a built-in JSX support is just native the right thing on graphically well syntax there are super pulls off of it they're down to the bottom there but okay well has a new PR right now I gave up yeah super aggressive dead code elimination and this works across all the different targets but actually with this dead code elimination it works with our unit kernels where they were 100 kilobytes before we can actually get the num2 kilobytes so you can imagine your entire server infrastructure is kilobytes boots in milliseconds and you can put up as many as you want as soon as a connector comes in so I think a couple of people for stock I think I'm getting close to the end or whatever anyway I might add new slides but we're actually on to enough real quick right before the talk is that for those of you who are familiar with closure cover which is a distributed kind of online programming binge foreclosure we're doing the equivalent for recently so if you've got a recent capital column and you want to kind of get into reason you want to try it out go there sign up and we'll actually come to the discord we want to get set up it's a super dense community definitely recommend kind of joining and hacking on reason it'll be a lot of fun happy to take the questions and I'm just getting down to be with you for the question senator okay so the top one here is the recent reason about reason so this is actually the other big danger with reason is there are so many bad puns this terrible everyone loves to make that jokes about reason but hopefully we get some way before that kind of thing the big thing with Ocampo keval relies on having a garbage garbage collector and that's about yes you need to have like you can't really interact with the host GC as of yet now they're talking about opening that up in the future but right now not really but the thing is that the semantics of reason poor really really well to the existing JavaScript engines so you can make sure that can you don't really need that's enough just as it is right now because it is super amenable to the optimizations that are applied in the JavaScript world does a unicorn make doctor obsolete they're very very different approaches right so docker containers are this very nice kind of incremental change right where they we can't just throw out our JVM you can't just throw it over existing infrastructure so darker allows you to container eyes and make these nice improvements camel can and reason can compile down to a native UNIX binary and run on there and you can run that inside of a docker container you get those nice benefits and then once you're you're comfortable mature ready you can then switch that over to running any unit so there's always this nice upgrade path everything about the reason is about they having a smooth clear easy upgrade path OS reason compared to L the job so has never actually there are a couple of different and important changes are differences one is reason has fantastic reach reason can go to all these different platforms and it has this braids kind of crazy academic team that has been investing in it for twenty years but one of the things that you're going to see is that L has is guaranteed that it will you will not have one time exceptions it is safer than reason in that regard at least right now there is a new feature kind of coming out hopefully within say the next year or so for for reason called effect hangers and the fact handlers totally changed it again kind of tooling you're gonna see that isn't possible and reason is never before ball so it's gonna be crazy but for the time being it offers some great safety and other than that they're very very similar so that one format imagine if novel format was required by everyone that's kind of how reason is so it looks amazing as a front-end engineer where would I use it probably on the front end how does it compare to a compliment with buckles rivet so buckle script is actually the compiler that will take reason and compile JavaScript and so there are findings it is super easy to write bindings for using Puckle script and reason for existing JavaScript so the recent couple column is actually built in reason using react and react emotion but it really was a pleasure to build others reason compared to elixir Erlang a very very difference in the sense you know early the fundamental process long is just very unique to the beam VM for the Turin rolling and they have very very kind of different domains unless if you are not going to get very very fast performance down the number of Russian reason is actually very very good their reason however is not going to have kind of beautiful supervisor treat approach where to just easily restore sure from your services it means never piss you off or knock leg actually love it I don't know if I can get them this is regardless can give an example okay I tracked my screen actually want to show a quick example what since someone asked if it's upsetting so basically the question is whenever a recent fix is your coat for you does that upset you and in the beginning right yeah you kind of like a hipster in like you want easily basic I want that character there and I want that character there but you get used to it very very quickly so the here's the example because a little bit bigger so this is an example of I'll say we have a cat here we're gonna peek inside of the box if the cat survives then we're going to just return it and if it doesn't survive then we are going to decrement one of its lives and as soon as we hit save it's gonna tell us hey this variable is unused so I'm going to remove that and then says by the way I noticed I checked your code the type Shorty's are kept only has a field called lives and you're using the JavaScript spread here and then you're also adding in lives you don't need to do that you've already exhaustively numerated all of the fields so you can kind of imagine we did some refactoring and we change the tightness we remove some fields and now robot but it's gonna tell us hey you don't need this anymore you can literally just write that and now it's happening so it's like this prepare money that kind of helps us go along and learn the language and this is really important for example let's say I wanted to do always dangers to a live demo to see how it goes alright so I'm gonna switch over William and I'm gonna say that if it's true I'm gonna do 0 and if it's false I'll do one and as soon as I get saved it's gonna tell me there the problem here it says that hey by the way at this point was expecting a closing bracket once again let's see everyone all right as soon as I hit save fingers crossed it actually automatically rewrites it's like this so it's amazing that you don't actually have to worry about how your course format it's like someone's saying instead of encoding your style guide in a text file and telling people hey follow this style guide it's all Roenick lis built into your editor you never have to worry about it so no it doesn't upset me is amazing I don't have to worry about this stuff anymore I think about the program and the editor and the tooling takes care of everything else by I don't want to go back to a world where I have to carry her about how the mood is formatted so I think that this time is about thank you very much check out recent opcom we love to talk with you guys [Applause]