hacker-school-wednesday-june-11-2014
Wednesday I met my goal of meeting up with people much more! This feels empowering, because it is starting to sink in that I can make choices and then follow through, and that I can have what I want. However, it definitely impacted flow. As it turned out, I did my loner activities before and after hours (blogging and my project), because most of the time during the day I was doing things with other people. That feels like a good way to do it. The other thing was that my nap signal came and went during a tutorial, and when I got around to trying, I slept little. So then I got frazzled in the late afternoon, and I actually went out twice, nominally for food and coffee, but really just to shake off the tiredness.
I hadn't thought about this explicitly until yesterday, but I have a general plan of having a group of projects, one of which is the current priority while the others are gestating. Every day I work on the current project for at least some time, and then optionally I also dabble in other things. When I have satisfied myself with the state of the current project — that is, when the cost of refining it exceeds the value I get from it, I will choose another one to focus one. It is important to me to have something that I am making tangible, if slow progress on. At the same time, I need to explore. So this seems to be working so far.
Here was my plan:
Plan
- Current project Tahoe-LAFS symlinks patch:
- Go through the test_cli.test_ignore_symlinks test line by line and understand it fully.
- integrate Zooko's coverage tool patch, if my time coincides with Zooko's.
- Working with others:
- Meet with the Project Euler folks
- Meet with the Coq folks
- Exploration:
- Light reading: Monads for the Curious Programmer, Part 2
Actual
Tahoe-LAFS symlinks:
I read through the test I'd like to modify: https://github.com/tahoe-lafs/tahoe-lafs/blob/master/src/allmydata/test/test_cli.py#L2805
I noticed a couple of instances of hard-coded constants in the test code. I might like to suggest some patches to those, but I didn't want to depth-first at this point. So I simply made a note of them.
Understanding the test involved understanding Twisted callbacks. I asked for help on the local chat and on #tahoe-lafs to make sure I was reading it right.
I did succeed in fully understanding the test! I started working out how to replace it.
This prompted a discussion on #tahoe-lafs about whether symlinks should be followed in the backup call. The issue is that now if a restore is attempted, multiple copies of the same file, which converge in the Tahoe-LAFS system, will become copies in the restored system. I had already been aware of this problem, but based on the notion that restore is not a solved problem in Tahoe-LAFS (there is no such inverse command, there are only cp and get), I had decided that this could be dealt with later. However, there were some worries about whether supporting symlinks for backup should entail creating metadata to support symlinks on the Tahoe-LAFS side.
I used this opportunity to refresh my understanding of the difference between symbolic links and hard links. Basically, symlinks have an extra layer of indirection, but a hard link is just another reference to the file/directory inode. When you type ls -l the second column is a count of existing references to the file or directory including the one being listed. Hard links add to this count, but symlinks don't. Hard links to directories are considered dangerous. I don't yet know why.
In other words, a hard link is indistinguishable from the original. In fact, once there is a new hard link, there is no longer a meaningful notion of original.
This in turn made me rethink my motivation for the patch in the first place! The tagging program I want to write will work just as well with hard links as with symlinks. The only thing I can think of that would be more work, is if you want to delete a file from your filesystem, you have to find all the references to it and delete them all. (I wonder what the Rust perspective would be on this. Hard links are borrowed references in a sense, and there should be only one copy in use at a time.) Otherwise, I can't think of any reason to use symlinks. Maybe someone could try to persuade me they are useful.
As to the patch, I could still write it. Given that people who use Tahoe-LAFS probably have existing symlinks, it could still be useful.
I plan to chat with the devs more tomorrow.
Working with others
Paired a bit with another person going through the Factor tutorial.
Joined the Project Euler group. We all decided to learn Haskell thereby. The second question requires writing Fibonnaci, and so I had to re-relearn tail recursion. I think that's in the first chapter of SICP. That reminds me that I was considering going though SICP and solving the problems in Haskell. Or Factor. Heh.
-
Alan gave a tutorial on Coq. Here are my notes:
all proofs are on construction by induction: intuitionist, no law of excluded middle!
things that don't prove don't compile
not turing complete?!
-
Curry Howard correspondence makes a analogy:
types <--> propositions
terms <--> proofs
- To prove: construct a term/value whose type is the proposition
- expressions evaluate to types or propositions
- If the compiler says that the term type-checks to the proposition, then the term is a proof of that proposition.
- Presumably, if the implementation of an algorithm in eg. Haskell, is isomorphic to a proof in Coq, then this is a proof of correctness of the implementation.
- tactics is a tool that helps writing proofs.
Although Alan talked about how Coq is a gentle way for programmers to learn math, it also seemed like a great way for a mathematician to understand the power of type systems. I was really blown away.
Reading
Didn't get to the Monads.
Misc
- Two of the people I chatted with today have already written a Lisp interpreter. I asked them each how they got started with that. One of them recommended Write Yourself a Scheme in 48 Hours, and the other (How to Write a (Lisp) Interpreter (in Python)). With the latter, I also talked about how surprising it was that it could be done so quickly. He said: "You just have to start." Words to live by.
Reflections
It is tempting to constantly compare myself to others, especially when I see how much they have achieved. I am working hard to resist this. Back in January, some friends and I made New Year's resolutions. I hadn't done that in a very long time, and I finally settled on:
Focus on creating, not achieving.
So I'm practising that.