HNHacker News
TopNewBestAskShowJobs

peter-fogg

128 karma · joined February 7, 2013

submissionscomments
peter-fogg··on Programmer Tooling Beyond Plain Text
OK, let's talk about parsing.

The article claims that parsing isn't necessary with structured editing. We're working on some abstract data structure representing our language's syntax. This might be an AST, like any programming language in common use today, or maybe in the future we've thought up some better way to represent programming languages within the compiler/interpreter. Since we're working directly with the AST or whatever, we don't need to parse! We just do whatever actions the programmer wants do over on our data structure.

Now, let's talk about how parsing works in your language of choice in 2015. We're going to take a string, and we'll turn it into a representation of our program. If we're lucky, our language implementation isn't awful, and our parser will be a function from some sort of Unicode-encoded text into an AST. OK, maybe our input is ASCII or some other text encoding, but the point is the same. Either way, we're taking some keypresses from the programmer, and turning them into a data structure representing the program.

Let's abstract a bit. Maybe in the future we don't use keyboards. Instead, we have whatever peripheral you like. This peripheral is capable of sensing some sort of action from the user, and turning it into actions within the computer. So now, our parser is a function from some user action to a data structure representing the program.

This sounds an awful lot like "we just do whatever actions the programmer wants do over on our data structure". The question is, how do we figure out what the user wants? The answer is, we parse it! It doesn't matter if we're parsing text or not. We will always need some way of determining the programmer's intention from the signals we get through their peripheral device. Viewed through this lens, the camera requires a parser just as much as the keyboard does, just as much as the mousepad does, just as much as the microphone does. We will always need a way to convert the unstructured thoughts of a human programmer into the formal language of a compiler's internals. Regardless of what representation we choose for any part of this process, it's going to be subject to the article's quote:

> This situation is a recipe for disaster. The parser often has bugs: it fails to handle some inputs according to the documented interface. The quoter often has bugs: it produces outputs that do not have the right meaning. Only on rare joyous occasions does it happen that the parser and the quoter both misinterpret the interface in the same way.

peter-fogg··on Why OCaml, why now? (2014)
> 2. benign effects: in Haskell "proper", you do not have effects; rather you have "codes" for effects, which get interpreted into effects by the RTS; this rules out the possibility of, e.g., using effects to implement a semantically pure interface. On the other hand, OCaml has actual effects, which can be used in an open-ended way to implement all sorts of functional interfaces.

So, to be all pedantic and stuff... You've always got unsafePerformIO, first off. This is used in Debug.Trace (https://hackage.haskell.org/package/base-4.7.0.2/docs/src/De...) to allow printf debugging in pure code. This is also used in some Haskell libraries to provide restricted effects in monads other than IO. But if you don't want to use unsafe* functions, you can always use ST to get direct access to mutable memory in a safe way. If you can runST within that interface, then you can present a pure interface to users.

peter-fogg··on Pitfalls of Callback-Based APIs
In this case, the dragon is slain without much trouble. In LVish (https://github.com/iu-parfunc/lvars) we've got an effect-tracking system that allows us to ensure determinism (read more here: http://www.cs.indiana.edu/~lkuper/papers/dissertation-draft-...). This would be pretty easily extended to only allow computations that are safe to log. And this is all in GHC Haskell! No external static analysis is necessary; the compiler can do it for us.
peter-fogg··on Opal: Ruby to JavaScript Compiler
Ruby and JS are both Turing-complete languages (as with just about any other programming language you'll ever use), which means that one can simulate the other. The simulation might be messy, complicated, or slow, but it will still work. In this case, Ruby and JS are close enough that it can be done without too much trouble (see the compiled JS).
peter-fogg··on Having a Servant Is Not a Right
It's worth remembering that a large portion of blue-collar criminals are arrested for possession of, say, a small amount of marijuana. There's a big difference between mugging someone and lighting a joint.
peter-fogg··on Guido van Rossum, John Resig, DHH, and Pamela Fox are Judges on CreateHS
I believe only one of the listed people are the creators of languages (Rails is a framework, jQuery is a library).
peter-fogg··on Guido van Rossum, John Resig, DHH, and Pamela Fox are Judges on CreateHS
Not to be contrarian or anything, but why isn't Pamela Fox mentioned in the title? Seems odd that she's the only omission from the photos on the front page.
peter-fogg··on Signet: Sign your work in the development console
Doesn't seem to be working in Firefox 25 on OS X.

    [00:06:34.535] SyntaxError: Using //@ to indicate source map URL pragmas is deprecated. Use //# instead @ http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js:1

    [00:06:35.468] Use of Mutation Events is deprecated. Use MutationObserver instead. @ chrome://divxhtml5/content/script.js:109
Chrome is good, though.
peter-fogg··on Poll: What are your liked and disliked programming languages?
But in a situation like that, you could just annotate the type. In Haskell:

    add :: Int -> Int -> Int
    add a b = a + b
peter-fogg··on How to teach your girlfriend programming
That 90% can have boyfriends, too, you know.
peter-fogg··on My Startup Job Interview
It's underspecified anyway -- we need to know about the motion of rabbits, the troll, the density of black holes, etc.
peter-fogg··on Google is joining the Open edX platform
edX's Github repo, for those interested: https://github.com/edx/
peter-fogg··on To my daughter's high school programming teacher
Thank you. If we accept discrimination of minorities as inevitable, then it will be.
peter-fogg··on To my daughter's high school programming teacher
Yes, none of the teams you've worked on have needed any explicit bans on behavior that's considered unacceptable in society. That's because you've worked on teams with adult humans (maybe assuming here), who don't need to be told the rules. High school kids still need some reminders that there is a normal way of interacting with others, like not suggesting that the only girl in the class be relegated to the kitchen. A bit of extra regulation is absolutely called for among teenagers.

That being said, your general point is good -- absolutist policies like zero-tolerance rarely work well, simply because human behavior is complicated and difficult for the policy maker to predict in advance.

peter-fogg··on Hacker Scouts is served Cease and Desist letter from Boy Scouts of America
What's that? The BSA is acting in a decidedly unfriendly way? No!

I say this as an Eagle Scout, and someone who had a great time as a Boy Scout from around age ten to eighteen. The Scouts are a great organization on a local level, where there's little bureaucracy, and most decisions are made by or with the boys. You gain a good sense of responsibility when you're the one in charge of overseeing all the camping gear for your trip, or planning an outing over a weekend. There's also a lot to be said for the personal growth that comes from starting as a ten-year-old, learning from the older boys, and then realizing at age eighteen that you're one of those older boys who is looked up to by the young ones.

However, the BSA at a national level is a pretty awful organization. They routinely discriminate against atheists and homosexuals. I'm an atheist myself, as were many in my troop. Again, at the local level this was fine -- nobody cares, provided the other members of the troop are sensible people (which, in my case, they were). But at the national level, any atheist is treated as a Godless Communist.

The same goes for gay boys and leaders. The BSA takes the delightfully antiquated stance of equating homosexuality with pedophilia, with no shortage of moral indignation at the idea that people could feel affection for those of the same gender. Until they do a bit of soul-searching and come into the 21st century, I'll have nothing to do with the national level of the BSA.

peter-fogg··on New Features of Firefox Developer Tools: Episode 25
I'm currently using Firefox for browsing and Chrome for debugging, just for this feature. Now I can go back to one browser, a more sensible workflow.
peter-fogg··on Synthetic Biology and 3D Printing
This is certainly an interesting thing to think about, but the article is not well written. The author makes a vast leap of logic from "We are researching organ printing, and we have 3D printers" to "We will soon be able to code DNA and print cells".

There's a few problems here. One is that "organ printing" in its current state is not at all the same as printing a cell. What would printing a cell even mean? We know how do things like create a cell's membrane and inject DNA into it, but as far as I'm aware nobody can print a ribosome (one of the pieces that converts DNA's "code" into proteins).

Secondly, it's important to know that DNA isn't even the assembly language of the cell, it's the ones and zeros. The idea of hand-coding DNA is simply absurd -- not because we can't synthesize the molecule, but because chromosomes are huge and we don't even fully understand what everything does yet. Imagine trying to read a program's binary, except some sections of the code are repeated, some are complete garbage, and some look a lot like garbage but are actually totally necessary. Now imagine writing that.

There's been some work done on genetic computation, using the the expression of fluorescent proteins as "output", but it's a long way from general computation. The idea of a "DNA compiler" isn't even possible yet -- noone has figured out how to represent XOR, which makes performing arbitrary computations tricky at best. And, as you might imagine, using cells as computers is slooooooow.

peter-fogg··on Why Should I Care What Color the Bikeshed Is? (1999)
I'm decidedly with you on this. I don't have a smartphone, and I rarely answer my phone when it rings -- it's rare that an out-of-the-blue call is urgent. Text messages always wait a few minutes, and often a few hours after I forget about them. As a member of the younger generation, I'm probably somewhat of a rarity here.
peter-fogg··on Show HN: A New Category of Web Forms
I've got a bit of a gripe with the "Job Application" form. Asynchronous saves aren't really intuitive to a lot of users -- if you're a web developer who understands AJAX (and the fact that there's a server with a database actually storing the data somewhere), then it makes sense. But if you're an average person who doesn't immediately know the mechanism it can be confusing. At work I recently converted a portion of our UI from this style of saving to an explicit model specifically to avoid this problem.
peter-fogg··on Create a font from your own handwriting
This is really neat, but the main reason I type as much as possible is because my handwriting is awful. I'd gladly use a service that made my scrawl a bit more legible.
peter-fogg··on Marelle: logic-based devops with Prolog
https://github.com/benhoskings/babushka

Looks like the repo has moved to a new Github account.

peter-fogg··on Unsupervised joke generation from big data
Chances are any genetic algorithm would be impractical due to the necessity of using a human as a fitness function. Unless you could create a neural network to classify jokes as funny or not... which immediately suggests to me an AI version of that standup comedy competition. Hm; maybe I have a new side project.
peter-fogg··on Ask PG: Why is everybody hellbanned?
Nope. Am I?
peter-fogg··on How YouPorn Uses Redis: SFW Edition
I find that I dismiss pretty nearly anyone who refers to a programming language in all caps. Outside of FORTRAN, COBOL, and C.*, it just looks ridiculous -- SCHEME, ERLANG, LISP, JAVA...
peter-fogg··on Ask HN: I'm a young developer. What should I do next?
Well, to each their own.
peter-fogg··on Drone Blimps Hovering Over D.C. to Stop Cruise Missiles
Call me crazy, but when was the last time we were worried about cruise missiles over DC? I realize that the US has less-than-perfect relations with some countries, but the Cold War has been over for quite some time now.
peter-fogg··on Ask HN: I'm a young developer. What should I do next?
I was going to recommend FP as well.

The Little Schemer is (in my opinion) the single best book on programming out there. It won't directly improve your MVC webapps or teach you enough of Scheme to write real software; be warned. What it will do is give you a fantastic introduction to recursive computation and all the mind-expanding ideas that go along with it. It's also great fun to read -- how many books do you have with space reserved for jelly stains?

Also worth looking into is Learn You a Haskell, which is available for free online. Haskell teaches you to have some discipline in code organization, in a way enforced by the compiler, and will also help you to find more abstract patterns in your code.

Finally, Clojure is a functional language that has somewhat more of an emphasis on practical programming than the above books. There are some good libraries for web development such as Ring and Enlive; I'd recommend rewriting an app you've already completed in another language as a good way to learn. That way, you can concentrate on the language and the way you express concepts, rather than the particulars of the problem you're solving.

peter-fogg··on The Humble Programmer (1972)
> I suspect, very few people will read it on the spot, which is why even interesting submissions like this doesn't get a lot of discussions.

Unfortunate, but true. I prefer to batch up my online reading time so that I can get through the denser articles and still have time to read the five minute blog posts.

peter-fogg··on The Art of Lisp and Writing (2003)
Out of curiosity, what do you see as the difference between Common Lisp debugging and Clojure debugging? I'm mostly experienced with Clojure (my CL code consists of a few trivial programs), but it seems like Lisp in the right environment (Emacs, paredit, SLIME/nrepl) is a joy regardless of which Lisp.
peter-fogg··on When male CEOs have daughters, relative pay for women at their firms goes up
Many forms of discrimination are much more subtle than "this candidate is a woman, so I'll offer her $10,000 less than a man". That's why the authors chose Denmark as an area of study; since the country is (apparently) a fairly egalitarian place, any explicit biases should have a small effect, and anything left over is unconscious discrimination.
Page 1 of 2Next →