1. 17

It’s Monday, so it is time for our weekly “What are you working on?” thread. Please share links and tell us about your current project. Do you need feedback, proofreading, collaborators?

  1. 13

    This is my weekly update, I guess.

    My heart really isn’t in things this week though. I pay too much attention to world news and what’s going on in Libya, Syria, Iraq, Gaza, Ukraine and other places has me down. I’m really tired of seeing dead children that don’t look too different from my own young daughter.

    For a change, I’ve been doing something interesting and relatable for my work. My work revolves around emscripten and lately, my client has been having some interesting questions about their memory usage. In response, I’m building (and contributing to emscripten), a heap profiler. It presents a C API so that emscripten users can instrument their C / C++ code. The C API is implemented by a JavaScript library which uses a webworker to submit trace events to a collection server which I’m writing in Python with Flask. This server collects and performs analysis of the trace event data (allocations, frees, timeline events, frame start, frame end, etc).

    For Dylan, I’ve been writing blog posts lately and 2 of them have been submitted here. I’m working on a write up describing some of the design and implementation behind scalaz-stream, but that’s pretty involved. I’m also writing up a document on adding function types to Dylan. Adding function types (and subsequently parametric polymorphism) is going to be a very important step forward.

    I am also getting someone going with taking some of the next steps on our Unicode support.

    I welcome help. I really need help. There are even some easy things to do that just involve talking to me or reading things and giving review. There are some questions that I have about function types and their semantics. It would be nice to have people to talk about that with as I’m somewhat isolated in the world. (I have no local technical community.)

    Until next week.

    1. 9

      Doing a gamecube homebrew game with a friend of mine and moving to a new house.

      As there are no 3d formats or engines (and as we are doing it for the challenge factor) we had to come up with a 3D format and I’m learning all about matrices, We have also found that there is little difference between gears and hovercrafts. Also writing utility functions in ASM is fun!

      I don’t know if I’m liking more the making of the game itself or asking for help and talking in Dolphin community which is full of helpful and interesting people. Also the Gamecube itself is a very lovely machine :).

      1. 2

        That sounds so cool! How do you go about doing it? What kind of software tooling do you have to use?

        1. 1

          We use plain devkitPro (with libogc bundled in). We started on Dreamcast first but the emulator didn’t work well (We spent most of last week trying to clean nullDC), then moved to PS2 but ps2sdk didn’t compile. Gamecube/Wii seems to be the sweet spot between a compiler/library that works and a good emulator to test things on.

          As for other tooling, we use Visual Studio as editor, even though that’s just our personal preference, Dolphin as emulator (latest builds, as we sometime encounter bugs but the Dolphin devs have been super quick at fixing them!) and we have a tool my friend wrote to convert .obj files into a binary format that can be easily loaded into the Gamecube. We also use World Machine for generating the map meshes, even though they aren’t in just yet.

          I think our plan is to release the source code when we get a playable prototype, so I’ll probably post it here if we manage to get that far.

      2. 7

        Continuing work on hython, a Python 3 parser/interpreter written in Haskell: https://github.com/mattgreen/hython

        Last week I implemented the basic flow control keywords (return, break, continue), and added support for floats. This week, I’ll be adding support for basic ops on imaginary numbers, and boolean operators. After that, I’ll need some time in the hammock to think about implementing objects in the runtime. (This is new territory for me).

        I’m also thinking more about changing how the interpreter works. Right now I use a classic-style of evaluation whereby I lean on the host language’s call stack to help with evaluating nested [if/while/def] blocks. However, this model becomes harder to follow when a control-flow construct like break or return is used: I have to unwind these blocks until I hit the first loop or function that I’m in, and then reset the state. (Haskell definitely makes you think when you use mutable state to track things like this.) Adding exception handling to the mix may complicate it further. I’m pondering a design where statements return an enum value indicating the flow control.

        Aside: my Haskell code is getting better, slowly. I never thought I’d be writing it and enjoying it so much.

        1. 3

          Implementing objects as Map Name PythonStuff or similar seems reasonable. For a start at least.

          Also implementing an interpreter like this with continuations can greatly simplify how control flow is implemented.

          1. 2

            Yeah! I was going to suggest that too. Translate to continuation passing form (where you have continuations for break, throw, and return). You can even push this style into a frame oriented style and write a compiler from it.

            1. 2

              Thanks guys, I’ll look at what’s involved in CPS translation.

              1. 1

                There’s actually a talk by Eric Meijer recently talking about “denotational semantics” that’s actually, more or less, CPS translation. I’d recommend it as an hour-investment intro to CPS compilation.

          2. 1

            I think this is really cool.

            My one recommendation is that you design towards a language library for Python written in Haskell and not just an implementation of the Python compiler and runtime.

            It would be awesome to parse and then use high level Haskell tooling to transform existing Python code for refactoring, static analysis, inlining native code, creating specialized interpreters or modifying semantics on the fly.

            Philip Guo created some pretty neat Python VM forks

            Have you looked at Berp ?

            BTW I am not a Haskeller but your code is pretty clean.

            2nd BTW: You should do some blog posts on this.

            1. 2

              Thanks! Berp was an inspiration (it put it in the ‘possible’ category). I haven’t looked at it much; I’m preferring to stumble around a bit to learn harder/faster.

              Due to time, I’m biased towards creating a full-fledged interpreter right now. I would like to model the Python language itself better (AST.hs is basically just a dumping ground of a minimal representation), I’m just triaging my free time as best I can.

              I’ve been thinking of doing a series of blog posts on this, especially as I’m relatively new to Haskell. Glad to see there is some interest there!

              1. 1

                Totally understand. Working is good starting state, ;)

                One thing I would really like is to inline native code into the interpreter mainloop w/o having function call overheads. Another point of reference, https://github.com/rjpower/falcon and http://arxiv.org/abs/1306.6047

          3. 3

            Yeah, I need feedback about the book page of my book about Padrino http://padrinobook.com/

            1. 2

              The “Recent commits” and “Written words” sections seem unnecessary and definitely shouldn’t be so far up the page. It’s the “Contribute” and “Author” sections which are most important. There should also be a link to a sample from the book.

              1. 1

                Thanks for the feedback. I will try to fix this.

                1. 1

                  I reworked the index page, thanks for the feedback so far.

              2. 3

                $work: Packaging up our deployment scripts for our IT department (well, the one guy in our IT department who will be doing deploys). They are disinterested in learning to use them the way the dev team does, so it’s on me to make it IT-user friendly. Practically, that means making use of librarian-ansible and some shell scripts; but getting there is a lot of tedious work.

                !$work: I’m spending most of this week cleaning and organizing my home office, I’ve slowly acquired so much crap that my once seemingly huge office is now a tiny little corner. It’s also my birthday this week (friday), so I’m going to be making some seafood and eating cake.

                1. 3

                  I have been working on a Tower Defence game for iOS using SpriteKit. I started this game using web tech but I decided to go native and get used to Obj-C along the way. A tower defence game has been on my bucket list for a while :) Now that I have graduated I finally have the time.

                  I got the majority of the features implemented and I open sourced everything today.

                  Source: https://github.com/viperfx/AlienDefence-iOS

                  1. 3

                    In particular, Nix pills: http://lethalman.blogspot.it/search/label/nixpills

                    It’s a series of in-depth advanced posts about the Nix deployment system.

                    1. 3

                      At work, all my “free” time (e.g. time not spent on critical support issues) is going towards the Elasticsearch book. Deadline for content in the physical print copy is September 1st…lots of writing to do!

                      Tangentially related: I never want to write/co-author a book ever again.

                      Outside of work: building a humidor (curly maple and purpleheart carcass, spanish cedar interior), building a TV console (quarter-sawn white oak, all mortise/tenon joinery) and fiddling with Turbine some more. Just put Turbine on Rust-CI so it’ll be easier to track rust nightlies.

                      1. 2

                        Last week I finished a framework for making the counters and value fuzzers in my event counting service declarative, so they can be built from a database or config file, instead of with code.

                        This week I’m evangelizing/explaining/helping build the versioned domain model that will tie everything together.

                        1. 2

                          Last week did nothing, was on vacation! Didn’t write a line of code!

                          This week will work on my secret game TCFODS. I am thinking that hopefully by the end of the week it will look good enough to start blogging about it and showing screen shots. I want to blog about its development.

                          Also, I just made (l like 5 minutes ago) a slightly nicer logo for Fire★

                          1. 2

                            Starting work on a compiler for a lazy ML variant I’m calling Hasquito. Hopefully I’ll write about this to talk about how to compiler a lazy functional language.

                            1. 2

                              For work, more internal recording/logging stuff. Lot’s of stuff to keep track of, and it’s an on going process.

                              Semi -related to work, I’m reading the o'reilly book about Zookeeper. It’s a central part of our system, I should probably know a bit more about it…

                              Not much coding outside of work, but I’ve spent some time on photography and post-processing. I’d like to start selling prints, cards, etc. but feel like I need to work on it more first, so…

                              Also finished a book on Common Lisp and started reading “Think Bayes”, which I accidentally bought on amazon, but decided was interesting enough to keep and read anyway.

                              1. 1

                                As an open-source side project, outside of work, I contribute to the Ruby lmdb gem. This weekend, I pushed out a new release with fixes for some concurrency problems introduced by the ruby wrappers around the LMDB C library. Short story: it was all about managing the dance among the ruby VM lock, the LMDB write mutex, and interrupts, and making this work in ruby 1.9 as well as 2.0.

                                If you need a key-value store, take a look at LMDB, it has some nice concurrency properties (concurrent reads and writes, transactions, snapshots/cursors) and impressive benchmarks.

                                1. 1

                                  i’ve been juggling some consulting, and slowly getting my numerical haskell project ready for alpha. The first layer (and the bulk of the alpha) is a very very awesome array library. (though i’m still fine tuning a lot of the api). One really cool thing i’ve realized is that a very well designed array library looks kinda like a very very optimized database library specialized to a read heavy workload.

                                  1. 1

                                    $WORK: Switching jobs, handing over projects.
                                    Fun: Prototyping a safe haven for badly structured/maintained public data sources by scraping/cleaning and providing web services instead.

                                    Also, something as unsexy as a RSS cleaner, weeding out semi-duplicated items across a set of RSS feeds from different sources (e.g. news articles from several news agencies regarding the same subject)

                                    Cleaning up seems to be the theme of this week…

                                    1. 1

                                      Work continues along, piece by piece this test framework comes together and I feel a little more like I get lisp. Except when I try to write macros, that’s the next barrier.

                                      Thinking about some code-as art stuff. Like the idea of making mosaics, but so far haven’t found a sweet spot for image processing in clojure. Quil is cool, but sometimes doesn’t let me get into the guts of images, haven’t played around enough yet to find a suitable level to manipulate images at.

                                      1. 1

                                        I am playing with the idea of using constructs related to functional programming at the C99 preprocessor and C++ templates level, for the sake of generating useful metaprogramming facilities. Trying to make a library out of this idea for some time now, source at https://github.com/irrequietus/clause. Nothing too important, just an innocent hobby so that perhaps I can use some higher abstractions when I have to deal with C++.

                                        edit: Still learning the interface of lobste.rs :)

                                        1. 1

                                          Writing community management docs and finding clients.

                                          1. 1

                                            I’m looking back at Creek trying to get it to talk to the HPS on the SoCKit. The hardware is done and I’m working on a software test now.

                                            1. 1

                                              Just continuing to work on my PureScript book, getting the landing page up, and fixing any issues before trying to put out the first seven chapters this week. Any feedback would be greatly appreciated :)