IRC Logs for #io Saturday, 2015-11-21

*** bb010g has joined #io03:15
*** MasterPiece has joined #io04:33
*** MasterPiece has quit IRC05:12
*** aryan_ has joined #io06:27
*** petr has quit IRC07:56
*** bb010g has quit IRC08:50
*** TheMonkey has joined #io09:46
*** petr has joined #io09:48
*** ElMonkey_ has quit IRC09:50
*** petr has quit IRC12:02
*** aryan_ has quit IRC12:04
*** petr has joined #io12:10
*** aryan_ has joined #io12:31
*** aryan_ has quit IRC12:36
*** FilipHanes has joined #io13:04
*** petr has quit IRC13:04
*** petr has joined #io13:08
*** FilipHanes has quit IRC13:13
*** aryan_ has joined #io13:32
*** aryan_ has quit IRC13:36
*** petr has quit IRC14:04
*** petr has joined #io14:06
*** whaletechno has quit IRC15:45
*** whaletechno has joined #io15:54
*** petr has quit IRC16:03
*** petr has joined #io16:09
*** BitPuffin|osx has joined #io17:53
BitPuffin|osxhey ho 18:02
BitPuffin|osxwasn't there a jit implementation of io being worked on?18:03
jeryeah i had one18:03
jernot enough interest to keep it going18:03
BitPuffin|osxah, interest from you or the people?18:05
jerwhich people?18:05
BitPuffin|osxon this planet18:06
jeroh, misunderstood what you meant =]18:06
jeryeah not enough interest from others, and my interest has diverted over the years18:06
jerlanguages i work on these days tend to be significantly different to how io works =]18:06
BitPuffin|osxcool, you rown?18:07
BitPuffin|osxdid you make io?18:07
jermy own yes, and no i didn't make io18:07
jeri have worked on its implementation though18:07
BitPuffin|osxgot any link? 18:07
BitPuffin|osxI think dependent types are fairly cool18:07
jerit's not public yet18:07
BitPuffin|osxah okay18:07
jeri've been figuring out a general eliminator for data types18:07
BitPuffin|osxbut it is nice that io is pretty simple18:08
jerreading some papers, haven't progressed past that point18:08
jersure io is simple; you can write one in as little as 400 lines of code =]18:08
jer(c code)18:08
jer400 + 80 or so lines in a parser18:08
jercompared to my current language project, which is 150 lines of haskell code though =D18:09
BitPuffin|osxyeah I feel like how simple it is lends itself really good to jit compilation18:09
jer(just lacks a parser)18:09
jerbut that's ~30 lines of code18:09
jerio isn't really well suited to JIT18:09
jerits AST is mutable at runtime18:09
BitPuffin|osxyeah I know18:09
jerand unless you can see the hwole program and all its dpeendencies and analyze it all18:09
BitPuffin|osxyou'll have to recompile code :P 18:09
jeryou can't reason about io code at all18:09
jerio's probably the most dangerous (potentially) strongly typed dynamic language out there18:10
jerbut its target market is really embedded extensions to programs anyway where you can have complete visibility 18:11
BitPuffin|osxhm yeah, but it sounds like you should write a jit that can see the whole program :P 18:12
jerbut the way a jit would work in io, is more like in pypy -- but it'd have to tie into the message manipulation routines (in addition to other places)18:12
jerbut compile around loops, not methods18:12
BitPuffin|osxwith trace trees?18:13
jerand throw away / recompile loops if someone manipulates the code (changing a slot, altering the message invocations, etc)18:13
jerit'd make those parts of code really slow18:13
jerinsanely slow in fact18:13
jernot thinking about implementation details18:13
jerjust talking about how the jit would work18:13
jera lot of dynamic language jit's work by compiling code on method/function bounds18:13
jersmalltalk for example works this way18:13
jerself too18:13
BitPuffin|osxpharo maybe18:14
BitPuffin|osxjer: so do you think that a super static language with dependent types is more suitable to jit?18:15
jeri think a strongly normalizing language would have no need to JIT18:15
jeryou can reason about it at compile time, and thus shift it forward to avoid that runtime cost18:16
jereven if it's not strongly normalizing, it would still make sense in an ML-family style language, not to walk the AST and compile as necessary; but rather compile ahead of time18:16
BitPuffin|osxwell aren't there certain things that you simply know better at runtime18:17
BitPuffin|osxvirtual methods perhaps18:18
jeryou don't have those in strongly normalizing languages18:19
BitPuffin|osxdont' you kind of have it with type classes in haskell?18:19
jertype classes are not virtual methods18:19
jertype classes are implemented very differently18:19
jerbut even if it were exactly the same18:20
BitPuffin|osxare they just instantiating the code as if it was templates?18:20
jerit's a small runtime overhead to invoke the right function based on the encoded parameters18:20
BitPuffin|osxeither way it seems to me like not being able to have something like virtual methods could be a tough restriction to have maybe in some cases18:20
jerthat doesn't require jit, just a branch18:20
jerand a table18:20
BitPuffin|osxcould be a costly runtime overhead in a tight loop 18:21
jernot really; if the thing you're iterating over for instance is of type List Int18:21
jerfor instance18:21
jera list of integers in this case18:21
jerthen you already know the type, you know some function will be called based on that type specialization ahead of time18:21
jeryou can reason about it early18:21
jerso my type checker for instance18:22
jeris strongly normalizing18:22
jerit's based on bidirectional type checking mostly because it's easy, but also because it terminates18:22
jertype annotations are required on all functions, but beyond that, it can determine the type of every term18:22
jerbased on those function annotations18:22
BitPuffin|osxerr so it does begome like templates then ?18:24
jertemplates are just term rewriting18:24
BitPuffin|osxwtah I mean is iterating over like a union type18:24
jernot sure that makes sense, you don't iterate over sum types18:25
BitPuffin|osxif you hada jit you could go it turns out most of these elements are this type18:25
BitPuffin|osxno a list of sum types18:25
jeryou can switch on an instance of a sum type, matching it against some type constructor18:25
jerbut you don't have to know that18:25
jerthe type system encodes that information ahead of time18:25
jeryou can use it ahead of time, and not have to defer it to runtime18:26
BitPuffin|osxdoes it?18:26
jerso let's take a program18:26
jerdata List a = None | Cons a18:26
BitPuffin|osxso it would re order the l´bratch to check the most common first18:26
jeri presume you understand that data structure?18:26
jer(the syntax mostly)18:26
jerok cool18:26
jerso let's define a function that squares every item in a list of int's, we'd write it like this:18:26
jersquareElements :: List Int -> List Int18:27
jerso if we try and pass squareElements a list of strings, we know that there's no function that takes that argument, so it's a compile error18:27
jernow squareElements is calling a function inside it in the case where the list isn't empty18:28
jerit's calling \ x -> x * x right... so the type system doesn't need an annotation there, because we've arleady established that squareElements takes a list of Ints' so:18:28
jersquareElements (x :: xs) = ...18:28
jerx is known to be typed Int18:29
jerso when we apply \ x -> x * x with x18:29
jererr let me rename some variables here18:29
jer\ n -> n * n18:29
jerif we do18:29
jer(\n -> n * n) $ x18:29
jerthe type of that lambda is known: Int -> Int18:29
jerso in this case, the lambda is your function being called in a tight loop, yet its type is well known ahead of time18:30
jerbased on the declaration of the outer function18:30
jerno jit is needed to make that code go fast, we can make it go fast ahead of time, by selecting a function specialized for squaring integers18:30
BitPuffin|osxwell that's not what I was talking about really18:31
BitPuffin|osxI meant more like18:31
BitPuffin|osxsay you have Data Num = Int | Float | BigNum 18:31
BitPuffin|osxand then you map over a list of Num18:31
jerok sure, so in that case you need some runtime support18:31
jerbut it's not heavy18:31
jernot a candidate for JIT18:32
BitPuffin|osxit could be heavy though and it could be a candidate for jit18:32
BitPuffin|osxif you have a much larger sum type18:32
jerit's a type comparison based on runtime type information supplied (assuming we implement it like virtual methods in C++)18:32
BitPuffin|osxand a huge collection18:32
BitPuffin|osxand it turns out that 95% of them are like the 5th type in the union18:32
BitPuffin|osxyou could reorder the branching to check that one first18:32
jerwell could be yes, but when it comes down to matching against a bitmask containing the type (thinking in C terms here), that has to be done even before you can JIT anyway18:32
jerthe next step is, if we found the type, call the known function for it18:32
jerthere's not enough work to justify a jit here18:33
*** bb010g has joined #io18:34
BitPuffin|osxjer: nah that's just one small example of where you could jit to win 18:37
BitPuffin|osxIt seems like you could also have like a hybrid18:37
BitPuffin|osxbut yes I do believe that you can have quite fast generated code by designing for static compilation18:38
BitPuffin|osxI think even mlton manages to be faster than C++ for example18:38
BitPuffin|osxI'm just wondering if you are potentially introducing friction for the programmer18:40
BitPuffin|osxdepends I guess18:41
BitPuffin|osxI wonder what a language designed to take advantage of jits entirely would look like18:41
jernot sure18:42
jerin terms of friction for programmers, different programmers have different mindsets when writing code, and expectations about how to write code18:42
jeryou'll never please everyone18:42
BitPuffin|osxno that's true18:43
jermain thing is you're solving some problem for some subset in a way that's useful and friendly.18:43
jerwhere friendly could be defined as "natural" or some other word18:43
BitPuffin|osxyeah I got it :)18:47
BitPuffin|osxI tend to mood swing between both a little18:47
BitPuffin|osxone day I'm like I want ultra type safety with dependent types and crap18:48
BitPuffin|osxand the next day I'm like aww yeee I want lisp and eval and stuff18:48
jerdepends on the problem i guess18:50
jeri'm writing javascript right now =/18:50
jermostly incurring technical debt in fact =D18:50
BitPuffin|osxyeah javascript isn't so great19:02
jeryeah just have a deadline when i want to get this project done19:14
jerand part of my clients system is written in node already19:14
jerthought about using purescript, but it annoys me to have to define foreign interfaces all the bloody time19:14
*** fredreichbier has joined #io23:00
*** bb010g has quit IRC23:20

Generated by 2.11.0 by Marius Gedminas - find it at!