Arc Forumnew | comments | leaders | submitlogin
4 points by shawn 1974 days ago | link | parent

Yes, the hooks exist because there was a lot of custom code that had to be injected somewhere. Much of HN's source code was not suitable for public release, even back in 2008.

Suppose you had to maintain an open source version of a codebase with closed-source elements. The hook functions here are the perfect way to do this.

For example, you'll notice pg does not appear on https://news.ycombinator.com/leaders (and never has). The logic to filter his username must exist somewhere. It likely existed as a hook.



3 points by i4cu 1969 days ago | link

I've found the 'hook' mechanism to be really useful. I use the same thing in an app I'm writing (in cljs) which auto creates web applications via data schematics.

When my app compiles a new app there's a little routine that adds/removes pre-defined function calls from within a table. So then when cljs compiles the client side code (which performs dead code elimination) the functions that are hooked into the table get added, but the others are eliminated. The cljs dead code elimination process couldn't do this alone; it required being able to hook/unhook code depending upon the app schematic.

Anyways, just wanted add to your point on how useful this feature can be.

-----

2 points by shawn 1969 days ago | link

Correction: the reason pg doesn't show up on the leaderboard is that he's an admin, and admins are filtered out here: https://github.com/arclanguage/anarki/blob/f01d3f9c661eed055...

Poor example notwithstanding, the rest of my comment is probably correct. There was custom code that couldn't be shipped in the public release of news.arc.

-----