What can you do in 2k LOC of C? - <AUTHOR> http://www.h4ck3r.net/2011/02/02/what-can-you-do-in-2k-of-c/ <comment><USER4>
      $ git show e83c5163316f89bfbde7d9ab23ca2e25604af290 --stat
      commit e83c5163316f89bfbde7d9ab23ca2e25604af290
      Author: Linus Torvalds <email@example.com>
      Date:   Thu Apr 7 15:13:13 2005 -0700

        Initial revision of "git", the information manager from hell

       Makefile       |   40 +++++++++
       README         |  168 ++++++++++++++++++++++++++++++++++++
       cache.h        |   93 ++++++++++++++++++++
       cat-file.c     |   23 +++++
       commit-tree.c  |  172 +++++++++++++++++++++++++++++++++++++
       init-db.c      |   51 +++++++++++
       read-cache.c   |  259 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       read-tree.c    |   43 +++++++++
       show-diff.c    |   81 ++++++++++++++++++
       update-cache.c |  248 +++++++++++++++++++++++++++++++++++++++++++++++++++++
       write-tree.c   |   66 ++++++++++++++
       11 files changed, 1244 insertions(+), 0 deletions(-)

:-)

<comment><USER5> To be fair, that's 1244 _lines_, not bytes :)

<comment><USER6> So is what the OP is talking about :o (lines vs. bytes)

</comment></comment></comment><comment><USER7> _If you think about it for a second, you realize that TrueType rasterization can't be that hard because printers were doing it long ago on crappy little embedded processors, but the default is just to fall back on the big ugly library, and then wrap it and pretend it's not there. How about instead, just write some good code?_

This is why 'modern' software can still manage to bring a 3GHz quad-core to it's knees, IMHO

<comment><USER8> This is also why we have many more softwares available now.

The improvement in hardware specs are so useful not only because it is faster, but also because we can do much more without having to care about the details. Writing tiny, efficient libraries is cool, but it takes a lot of time, everything else being equal, so if you can afford not doing it, you don't.

<comment><USER9> > This is also why we have many more softwares available now.

Assuming English isn't your first language, that would be phrased "much more software"; software is always singular.

<comment><USER10> <http://www.ar.media.kyoto-u.ac.jp/members/david/>

"David Cournapeau

a French PhD student in signal processing at Kyoto University"

France and Japan...he hasn't exactly been living in places where English is prominently spoken with grammatical accuracy...cut him some slack. In fact, he made the exact same error of pluralizing "software" as "softwares" on his website.

<comment><USER9> > cut him some slack

You act as if I'm giving him a hard time, I'm not. I've generally found multi- lingual people want to be corrected when they do it wrong because they find it helpful; I was doing him a favor.

</comment></comment></comment></comment></comment><comment><USER11> Roberto Ierusalimschy's lpeg is around 2.4k loc of ansi C without any dependency beside libC and lua.h (needed to interface with Lua, since it's a Lua library).

It implements an efficient pattern matching system based on Parsing Expression Grammars (akin to CFGs, but without ambiguities). It consists of a Pattern/Grammar to bytecode compiler and a custom VM to interpret the result of the compiling phase.

Nice and clean.

<http://www.inf.puc-rio.br/~roberto/lpeg/lpeg.html>

<http://en.wikipedia.org/wiki/Parsing_expression_grammar>

<comment><USER12> The Lua code itself (while not <2 kloc) is also clean, well designed C, and definitely worth study. It gets quite a bit of functionality out of 12.6 kloc, and if you work with C, Lua is an ally (it's like Tcl, but good). :)

Also, in my experience, LPEG is a great fit for middle-ground parsing - <USER2> complex than Perlish regexps (which it handles well), and including those a bit more complex still, but it's awkward for really complex parsing (since it inherently combines lexing and parsing).

But I dissed Perl and Tcl, so -1. Screw useful information. ;)

<comment><USER13> > but it's awkward for really complex parsing (since it inherently combines > lexing and parsing).

I'm kind of surprised by that statement - grammars for programming languages expressed in PEG always seem much cleaner to me than the lex/parse separation. Can you give an example of a grammar that you find is complicated by PEG?

<comment><USER12> I initially wrote the parser for a (proprietary) query language compiler using LPEG, and keeping track of lexical issues (whitespace, etc.) along with the grammatical structure complicated things. When I broke it apart and wrote a quick FSM-based lexer and a recursive descent parser, it became much simpler. Perhaps I could have factored the PEG grammar better, but with every PEG grammar I've had grow beyond a certain point, I've wished I could separate the lexing and parsing stages.

I much prefer working with LPEG to regular expressions for small to midsized stuff, though.

</comment></comment></comment></comment><comment><USER14> Shocked that silentbicycle hasn't mentioned it already, but Arthur Whitney whipped up the first prototype/inspiration for the J language in a short bit of macro heavy C over the course of an afternoon.

42 lines?

<http://pastebin.com/s2usuqDq>

If this interests you at all, absolutely worth reading Roger Hui's retrospective on the subject (more about J + Ken Iverson, but definitely fascinating) <http://keiapl.org/rhui/>

<comment><USER15> That's interesting, but damn is that some ugly code. Slightly obfuscated on purpose? Though of course it wouldn't win the IOCCC.

On the other hand, it's notable that many IOCCC submissions happen to pack a lot of functionality in often less than 2k. I remember reading a few descriptions of some the winning entries, but I can't find that now. Here's a glimpse though: [http://cboard.cprogramming.com/brief-history-cprogramming- co...](http://cboard.cprogramming.com/brief-history-cprogramming- com/123-ioccc.html)

<comment><USER12> Having spent a lot of time meditating on it (as sofuture mentioned), it isn't "slightly obfuscated" so much as "stubbornly written like APL rather than C".

If you become inexplicably fascinated by that code and want help unraveling it, my contact info is in my profile.

I don't consider it noteworthy as a _useful_ program under 2kloc (on modern hardware it usually just crashes, it's quite cavalier with pointer casting, and clearly a quick prototype either way), but it's like a pink space laser beam of insight about the APL mindset. Real APLs take more than a page, but not _that much_ more. Eliding loops does that.

A lot of the IOCCC code is also delightfully perverse, too. Highly recommended.

<comment><USER15> Yeah, I realized that fact a little late. Relevant snippet from the link about that initial bit of code for J:

 _I showed this fragment to others in the hope of interesting someone competent in both C and APL to take up the work, and soon recruited Roger Hui, who was attracted in part by the unusual style of C programming used by Arthur, a style that made heavy use of preprocessing facilities to permit writing further C in a distinctly APL style._

<comment><USER12> Arthur's C is stubbornly unconventional, but often, he's got a point.

Also, the APL community seems to be pretty disjoint from the rest of CS (though Arthur is also a Lisper). I think it'd be mutually beneficial if the APLers and the MLers got together, in particular.

</comment></comment></comment></comment></comment><comment><USER16> The core of my protobuf-decoding library upb (<https://github.com/haberman/upb/wiki>) is 3k SLOC of C. That includes

      * a hash table implementation
      * a reference-counted string type
      * a generic interface for doing tree traversals of protobuf data
      * the protobuf decoder itself (which implements the previous interface)
      * all the code to load proto descriptors (including bootstrapping the first one,
        which is necessary to load others)

<comment><USER12> It really says something about C that so many useful-but-small systems have a good chunk of code devoted to hash table implementations, atoms ("a reference- counted string type"), etc.

When working with C, it sometimes makes sense to have bespoke data structures, but it always makes me think of Hanson's _C Interfaces and Implementations_, Greenspun's tenth rule, etc.

My 1500loc C project also has a hash table implementation (and, soon, dynamic arrays (gasp!)). That and serializing custom data structures to disk accounts for more than half of its code. It's fast as hell, but I originally prototyped it in like 100 lines of Lua.

<comment><USER13> > It really says something about C that so many useful-but-small systems have > a good chunk of code devoted to hash table implementations, atoms ("a > reference-counted string type"), etc.

Well, the only reason for that is that C never had a hash table in its standard library. The same assertion is true about any other programming language I've seen that doesn't.

Python's and Lua's dicts are really hard to top (at least in the general case, and definitely inside the language), so there aren't even any attempts. Java's is slow and horrible, so there are hundreds of replacements, but they're all interface compatible.

> That and serializing custom data structures to disk accounts for more than > half of its code.

That's one of the the things K gets unbelievably right - there is one routine (which with Arthur's style is probably 10 lines of C) for serialize, and another for deserialize. They work for any K structure, and they do that with blinding speed thanks to being totally memory mapped. My C code has switched to that approach as well - and it works really, really well.

<comment><USER12> My text indexer is using a mmap'd hash table too, and that's exactly why. :)

</comment></comment></comment></comment><comment><USER12> I'm working on a text indexing/retrieval program, like locate (<http://www.openbsd.org/cgi-bin/man.cgi?query=locate>) but for content and not just filenames, and with an index <=2% the size of the indexed data.

It's very nearly together (integrating individually working parts now), and is currently ~1,500 lines (according to sloccount).

Adding support for indexing Unicode text, more configuration, composite search queries (A and B near C and not D), etc. will no doubt make the source expand a bit, but it's still pretty small.

If you're interested in trying it out once it's ready, contact info is in my profile. I'm shooting for within a week or two for a _beta vulgaris_. (Requires Unix. ANSI C, strung together with sh and/or awk to avoid dependencies.)

<comment><USER17> Does the index include the dictionary too, in your calculation? I'd be interested in seeing this indexing/retrieval program of yours, I hope you release it soon!

<comment><USER12> Yes.

</comment></comment></comment><comment><USER18> I wrote EasyEXIF: <http://code.google.com/p/easyexif/>

About 120 lines of C++ [see 1] that parses basic EXIF information out of a JPEG image. I found all the other EXIF parsing tools and libraries a little too heavyweight for something as simple as getting the date and time a picture was taken, or the f/stop or exposure time. It only uses string.h for memcpy and memset, and no other headers.

[1] [http://code.google.com/p/easyexif/source/browse/trunk/exif.c...](http://code.google.com/p/easyexif/source/browse/trunk/exif.cpp) (note: Google's source view screws up my whitespace)

</comment><comment><USER19> I was tempted to show off some toys I feel fatherly pride for, like my 500-line spreadsheet, but the only C program in this size range that I still use much is <http://wry.me/~darius/software/req.tar.gz> \-- a rewrite-rule- based programmable calculator. Since it's >20 years old it's not at all what I'd write now.

(Toy spreadsheet at <https://github.com/darius/vicissicalc>)

</comment><comment><USER20> Getting a standards-compliant XML parser into 2K lines is going to be a challenge, if you're not going to cheat on what a "line" is. You must be able to deal with both UTF-8 and UTF-16 [1] (and remember UTF-16 can be in either endian order), you have several tables of things like what chars are valid where, you've got data structures to declare, and there's a lot of edge cases that may not leap to mind but if you don't cover them you don't really have an _XML_ parser, like CDATA handling, entity loading from a DTD, parsing DTDs at least well enough to get those entities, processor commands, etc. A useful subset certainly, something I'd actually call a real _XML parser_ , I'm skeptical. Not quite ready to write the idea off, but skeptical. (It's saved from me writing if off entirely because if I read the spec correctly a parser is not required to resolve external DTD references, if it was it would be stick-a-fork-in-it done, you'd eat hundreds of lines just using raw sockets to do HTTP requests and manage them even halfway properly.)

A JSON parser? Heck yes, even with the UTF-8 handling. It wouldn't even necessarily suck.

[1]: <http://www.w3.org/TR/REC-xml/#charsets>

<comment><USER21> > Getting a standards-compliant XML parser into 2K lines is going to be a > challenge

This is a pretty good argument against XML.

<comment><USER20> Yes, that point may have had some influence on the way I phrased my post.

</comment></comment></comment><comment><USER22> How about micro_httpd, an inetd-style HTTP/1.0 server in 200 lines of C. (<http://acme.com/software/micro_httpd/>)

</comment><comment><USER23> In 2000 lines of C, you can encode the HTML5 "named character character entity" table.

[http://dev.w3.org/html5/spec/Overview.html#named- character-r...](http://dev.w3.org/html5/spec/Overview.html#named-character- references)

I hate HTML.

<comment><USER24> O.. M.. F.. G.. I had no idea they did this. I mean, what is the point? Talk about "not invented here" mentality: "I've got a fantastic idea! Unicode already has an official name for every Unicode character, so let's throw all of that out and come up with our own names that have no relation to what those Unicode guys did! And while we're at it, HTML4, HTML5? Version numbers are for pu$$7$s, so lets drop that too, and then randomly throw in a few hundred extra character entities every two to eighteen months for a fresh 'What's new' bullet point!"

<comment><USER23> It's for backwards compatibility, like most of the HTML5 spec. If browsers suddenly start becoming HTML5-compliant and as a result most of the web stops working, then they've failed.

I agree with the reasoning. But damn, it makes things suck going forwards. This is why we can't have nice things. :-(

</comment></comment></comment><comment><USER25> I wrote an cooperative multitasking RTOS for an ATMega processor in 1200 or so lines.

<comment><USER26> If you're willing to share the code, I'm sure many of us would love to see it.

<comment><USER25> Here you go!

<https://bitbucket.org/pnathan/uirtos>

Turned out it was a preemptive RTOS. I had forgotten that.

</comment></comment></comment><comment><USER27> _An JSON / XML / YAML parser?_

The fastest JSON parser that I know of is implemented in ~1800 lines of Objective-C: <https://github.com/johnezang/JSONKit>. Its about 2-3x faster than the yajl bindings for Objective-C are, in my testing.

</comment><comment><USER28> Fabrice Bellard's IOCCC entry of 2002 was a C-subset compiler in 617 wc-lines (ELF version).

<http://bellard.org/otcc/>

<comment><USER13> It's an amazing piece of work: Those 617 lines are in its own C subset, so it can compile itself into a native code ELF version.

This evolved into bellard's "tcc" compiler, which is the fastest (compile-time wise) available on linux, the only one I'm aware of that can be used as a library to run code in memory (without having to generate an .so and load that). And it's output performance, while lacking compared to -O3 gcc or clang - is not too shabby!

</comment></comment><comment><USER29> The next question is:

 _How many of these 2K sections can you string together to make something of further use?_ (using another 2k section, of course)

</comment><comment> just-a-c-hacker How about an X11 tiling window manager? <http://dwm.suckless.org/>

</comment><comment><USER30> Write a basic Lisp interpreter/compiler and write everything else in Lisp? :)

Would compiling Lisp code count against the challenge's LOC limit?

<comment><USER19> I did once write a 2k-line bytecode interpreter and runtime for R4RS Scheme -- the compiler, library, and debugger were another 2-3kloc of Scheme. I even used it as my main hacking platform for years. But I didn't post it here because:

* It depends on the Boehm garbage collector.

* (This is embarrassing.) It stopped working after some version bump of GCC, and the cause is not at all obvious to me. Since I don't Scheme much anymore I gave up.

<http://wry.me/~darius/software/uts.tar.gz> if anyone cares.

<comment><USER12> No blame, but I'm curious "why you don't Scheme much anymore". Was it due to Python, Common Lisp, etc?

I switched from (Chicken) Scheme to Common Lisp (and, in parallel, from Python to Lua), and, having read a lot of old code of yours, I'm curious about your choices - you seem consistently sensible and pragmatic. (Sorry to put you on the spot.)

<comment><USER19> Thanks! Partly Python's gotten more tolerable as a language, partly I'm doing more things needing libraries, partly I mostly code inside <https://github.com/darius/halp> these days and it doesn't have a Scheme mode so far. I do have a couple of recent Scheme projects up on github though -- optilamb and selfcentered.

Very impressed with LuaJIT2, btw -- I'd like to do more with it.

<comment><USER28> Halp is fun. Thanks. Installed it already.

<comment><USER19> Glad you liked it!

</comment></comment></comment></comment></comment></comment><comment><USER31> Back in The Day (tm) I wrote a full Gnutella client in about 1600 lines of code.

</comment><comment><USER32> Anyone know how big nginx is? I wouldnt at all be surprised if its under 2k LOC.

<comment><USER12> You're probably joking, but sloccount says:

        ansic:        82714 (99.68%)
        perl:           124 (0.15%)
        sh:              78 (0.09%)
        asm:             48 (0.06%)
        cpp:             17 (0.02%)

(for nginx-0.8.53)

<comment><USER12> Why have I gotten _13_ upvotes for this? Serious question.

<comment><USER33> It's a show of thanks for taking the trouble to give a solid answer backed by facts. Just as bad memes are publicly swatted down, good work (even small) should be praised to set an example for others.

<comment><USER12> If actual facts are that rare in software engineering, then that's one hell of a "code smell". It really wasn't hard to get.

<comment><USER23> Facts are pretty common in (good) software engineering, but they're rare in Internet discussion. Hence, solid facts in Internet discussion tend to rack up points.

</comment></comment></comment></comment></comment></comment><comment><USER34> How much memory does the code the blog poster described leak? How does it respond to edge cases and invalid input? Finally, is it portable beyond one specific OS? Beyond POSIX or Windows-based systems?

Those questions are especially pertinent in C.

<comment><USER35> Right! Coming up with standalone C means coming up with your own versions of hard-to-write simple "system calls" like memove.

I debugged a memcopy (taken from Linux! 10 years ago) on a RISC processor - <USER3> had 12 bugs in a dozen lines of code. Not designed to run on RISC but shows how hard it can be to get this stuff right.

<comment><USER22> > simple "system calls" like memove

Minor, pet-peevy point: memmove(3) and memcpy(3) are not system calls. (<http://en.wikipedia.org/wiki/System_call>)

<comment><USER35> Right; runtime library.

Often they are not even that; they appear to be but compilers can replace them bodily with super-optimized code so they get better benchmarks.</comment></comment></comment></comment>


Ask HN: What is your server-side/back-end monitoring checklist? - <AUTHOR> Sample Monitoring Checklist:<p>* Load Balancer [How do you check for its health status?]<p>* Web-Server<p>* App-Server [CPU utilization, Memory utilization, Disk Utilization, App Status to take requests]<p>* DB-Server [CPU utilization, Memory utilization, Disk Utilization, App Status to take requests]<p>Note: Possibly share at what level you check for these, at what frequency and what tools you use. <comment><USER2> Bit of shameless self-promotion here, but I'm the author of Practical Monitoring. Among other things, I set out to answer exactly this question. Check out Part 2 (Chapters 7, 8, and 9 answer your question specifically). [https://www.practicalmonitoring.com/](https://www.practicalmonitoring.com/)</comment>


Rocket UI Launches - Create Complex Navigation Widgets Without Coding - <AUTHOR> http://www.dainbinder.com/2012/01/rocket-ui-launches-as-web-application.html

<comment><USER2> Looks very cool so far. The landing page is clean and crisp. I look forward to signing up.

Before I do however, will you be using https for the signup process?

<comment><AUTHOR> Hi, I am not the creator, but I do see it is using https for signup (and everything else).

<comment><USER2> Awesome. Was viewing this in iOS and for some reason it wasn't showing...

</comment></comment></comment><comment><AUTHOR> Rocket UI is a startup that allows you to create widgets without any coding knowledge.

Check it out and share what you created!</comment>


Ask HN: Why doesn't Gmail/Instagram/etc webpages directly go to log-in page? - <AUTHOR> As a user, every time I want to log in to my Gmail or Instagram account, I have to wait till the page is fully loaded, then "click" on a button that directs to the log-in page. Why don't they let us log-in in the first page? <comment><USER2> Actually, Gmail starts with the login page, if you load it first time. Instagram starts with registration, which also makes sense to me considering you are not likely to log in too often.</comment>


Ask HN: What do you to get into flow state - <AUTHOR> <comment><USER2> At work we do promiscuous pairing, [https://engineering.itpro.tv/2018/12/07/our-first- experiment...](https://engineering.itpro.tv/2018/12/07/our-first-experiment- with-promiscuous-pairing-is-a-success/), which encourages getting into beginner's mind (which is much easier to achieve, maintain, and recover when lost) instead of flow (which can often be difficult to achieve, maintain, and recover when lost).

It doesn't answer your question, but hopefully it's a helpful alternative for you. It has been incredibly helpful for us.

</comment><comment><USER3> My trick is very simple and very low-tech. Take a piece of paper and a pen and draw a diagram that sums up the big picture of what you are trying to achieve (architecture of the software you're writing for instance). Take as long as you need to, and when things start to fall naturally into place and you are eager to start, pick one part of the drawing and start working. Avoid distraction at all cost (music does help, especially in an open space).

I developed this when I was in academia and it transposed very well (better?) in the software industry. If you do that regularly it also helps course- correct when needed.

</comment><comment><USER4> Worth noting that I find the flow state far easier to enter at different times in the day. Between around 2:30 to 4:30, I find it very easy to immerse in a task, to the point where even if I _should_ switch to a higher priority task, I will most likely stay on the track I'm on.

Who knows if that is circadian rhythm, conditioning, a combination of both...

</comment><comment><USER5> Previous comment: [https://news.ycombinator.com/item?id=14528393](https://news.ycombinator.com/item?id=14528393)

</comment><comment><USER6> Force myself to work on the task or do nothing.

This usually means either opening an editor and staring at a blank page (doing nothing), or working on the task.

<comment><USER7> I can spend a tremendous tremendous amount of time staring at a blank page.

</comment></comment><comment><USER8> Remove attractive distractions. Which is mostly the internet.</comment>


Addio Redis, I'm leaving Redis Labs - <AUTHOR> https://kristoff.it/blog/addio-redis/ <comment><USER2> It's my pleasure to welcome Loris to the Zig Software Foundation. He has already demonstrated talent, dedication, and cunning, and I'm excited to see what he can accomplish in the non-profit sector.

<comment><AUTHOR> Thank you Andrew, very happy to contribute to the one project that will finally make systems programming worth learning even for a lazy programmer like me.

</comment></comment><comment><USER3> Zig showtime got me to jump into the zig community which is the first online/distributed community I've decided to join. Excited to see what he accomplishes now that zig is his actual day job!

<comment><AUTHOR> Thanks! I'm looking forward to it as well.

I have very high hopes for the Zig community, and in the end my role will essentially be that of a catalyst for the potential energy that's already there.

</comment></comment><comment><USER4> I solemnly welcome my Zig Software Foundation Community VP overlord.</comment>


MoonScript, a programmer friendly language that compiles to Lua - <AUTHOR> http://moonscript.org/ <comment><USER4> Hey all, I made MoonScript about 6 years ago.

I used it to build a ton of opensource stuff in addition to the company I founded. I use it every day and I'm very happy with how it's turned out. I regret not updating the language more frequently, but I've been busy building a bunch of stuff in it.

The biggest open source project is a web framework for Open Resty: [https://github.com/leafo/lapis](https://github.com/leafo/lapis)

It's used for the following open source websites: [https://github.com/luarocks/luarocks- site](https://github.com/luarocks/luarocks-site) [https://github.com/leafo/streak.club](https://github.com/leafo/streak.club)

The company I made, [https://itch.io](https://itch.io) also runs on it. There are a a ton of extra Lua modules I've made in MoonScript to facilitate it. Here's a list of my published modules: [https://luarocks.org/modules/leafo](https://luarocks.org/modules/leafo)

I've also completed Ludum Dare 11 times now, making a game each time in MoonScript. I've used [https://love2d.org/](https://love2d.org/) as the game engine. You can find the games on my GitHub: [https://github.com/leafo?tab=repositories](https://github.com/leafo?tab=repositories)

Feel free to ask any questions

<comment><USER5> I was just looking at love2d, I don't know much about it. My son is 8 and is very bored with Scratch. A once over the documentation makes me think love2d might be a good fit for a next step from Scratch. How is the love2d community and is it active?

<comment><USER6> The love2d community is definitely still active, especially on IRC. Some of the nicest folks I've ever spoken to over the internet.

I can't recommend the language or its community highly enough.

<comment><USER7> A couple of friends just successfully launched a commercial game on android/ios/steam using love2d, and they're really happy with the results.

I couldn't believe it was made with lua, it runs really smooth.

[http://midipixel.com/warlockstower/](http://midipixel.com/warlockstower/)

<comment><USER8> The love2d source code is in C++. I believe Lua interpreter was embedded as a scripting mechanism

[https://bitbucket.org/rude/love/src](https://bitbucket.org/rude/love/src)

<comment><USER9> AFAIK, LÖVE integrates LuaJIT.

</comment></comment></comment></comment></comment></comment><comment><USER10> This is one of @leafo's excellent projects. He has developed a web framework for MoonScript called Lapis. One of the cool things about Lapis is that it runs on top of OpenResty, which is a high performance web server for Lua applications. Lapis is production-ready: it runs his amazing game marketplace, itch.io.

<comment><USER11> +1 for Lapis - it's fairly barebones, but it's also nice and simple. You can also code it in Lua, if you feel more comfortable with that.

I was looking into using it to make a site for hosting Love2D games which would optionally run right in the browser, because lua rocks, but I got distracted with other things.

</comment></comment><comment><USER12> On a related topic, Haxe now compiles to Lua as well : [https://haxe.org/blog/hello-lua/](https://haxe.org/blog/hello-lua/) (disclosure : I'm the author of the lua target)

Back to moonscript/Lua, I've been super impressed with the YAGNI principals of the language. I was originally drawn to LuaJIT and its raw speed, but there's a lot of great things to say about the language and its community.

My goal is to write more Lua for smaller scripting purposes, and use Haxe/Lua for more complex projects, taking advantage of LuaJIT speed in both cases.

<comment><USER13> Thank you. The more I use Haxe the more I love it and I have compiled to Luna and it worked flawlessly. Thank you

<comment><USER12> It makes my day to hear this. Glad it is useful!

</comment></comment></comment><comment><USER14> Lapis + MoonScript + OpenResty looks like a lot of fun, so I was just starting to get a local environment running for it and immediately ran into the Lua 5.1 and 5.2+ divergence. For someone who has just been a casual observer of the Lua ecosystem over the years, can someone talk about the community's feelings towards that divergence? The OpenResty docs basically state it's not worth the effort to support anything but Lua 5.1, which at this point is 5 years old and no longer updated.

From someone on the outside that makes me hesitant to spend much effort investing in the ecosystem. Are the libraries fragmented across different versions too? Are there really no plans for an upgrade path, or does everyone just expect to use 5.1 forever?

<comment><USER15> The reason is that the _ENV feature added in 5.2 would significantly slow down LuaJIT if it were supported. It's possible that Luac and LuaJIT will re- converge when Lua 6.0 is released, but arguments about this between Mike Pall amd Roberto Ierusalimschy have been unproductive so far. Until then, LuaJIT compiles Lua 5.1 with support for a few 5.2 and 5.3 features, particularly goto.

<comment><USER16> You have any references to these arguments between the two gods?

<comment><USER17> Totally not a concrete link, sorry, but - in a video from one of Lua conferences, I've seen Roberto mention in some polite yet clear way that talks with Mike which they had had always come to a standstill on something - <USER2> least that's how I recall it. On the other hand, since 2015, Mike was looking to pass luajit development on to someone else - so with this, situation could possibly change in the end. But I'm not sure what's the current status of this search; I seem to recall CloudFlare was reported to be in talks, but I don't know how it all ended - or if it's still unresolved.

</comment></comment></comment></comment><comment><USER18> I understand that people love programming in classes, but I really want something like a stripped-down ES6. In particular, I want:

1\. Lists and objects/dicts only; objects have no prototypes at all; objects have no first-class methods, but they can have functions as member variables, and those functions can close over other data in the object

2\. All function and variable declaration is anonymous (as a consequence of 1); if you want to define a schema for an object, build a function that takes certain arguments and returns an object with the corresponding structure.

3\. Coroutines/fibers/etc for async things; no promise/callback hell

4\. Type annotations a la Python (not sure how this fits with 2 just yet)

EDIT: I did a bad job of emphasizing this, but syntax is important to me--I want something that looks like:

        var foo = {
            x: [1, 2, 3],
            y: (a, b, c) => {
                var sum = a + b + c;
                sum * sum
            },
        }

Whether or not you agree that syntax should be a relevant criteria is a different matter. :)

<comment><USER19> This is basically Lua, excluding type annotations. Lua's form of OOP is very strange in that methods aren't bound to a parent context, but instead take the object as a value. For example, `object:method()` is the same as `object.method(object)`, and `function object:method()` is the same as `function object.method(self)` - the only difference being calling the function via `object:method()` is a bit more optimized. There is also a framework with networking, signals, and other cool features called `cqueues` which works based off of coroutines.s You might want to check that out too :)

<comment><USER10> And the size of the Lua runtime is nothing short of beautiful. I have yet to find a use for Lua though, so I'm still waiting for an opportunity to work on something with it.

<comment><USER19> I find it's used a lot in places you wouldn't expect. I found it used in a car radio, the modem used in my house, and a few other places. It's lightweight if you want to use it on embedded systems (for example, NodeMCU) if you're into that kind of thing.

<comment><USER20> Iirc its used on some digital cameras as well.

</comment></comment></comment></comment></comment><comment><USER21> I love the syntax that Coffeescript-like languages are converging to, like Moonscript, tj's luna ([https://github.com/tj/luna](https://github.com/tj/luna)) and Pogoscript ([http://pogoscript.org/](http://pogoscript.org/)). They fall way on the right of the "computer code vs. human code" spectrum, which is handy when writing applications as quickly as possible rather than focusing on fine details like implementation and performance. It's a shame I don't see it often in the wild, except for Atom and a few others.

<comment><USER22> Thankfully, GitHub starting gutting Coffee from Atom a long time ago. There's still too much in there though.

<comment><USER23> While I understand the move to es6 or whatever we're calling it now, a part of me really misses coffeescript. I found it to be very elegant

<comment><USER24> Agreed. Coffeescript was excellent lipstick for the pig that is javascript.

<comment><USER25> Not particularly a fan, that analogy is solid. To me, a pig in lipstick seems somewhat more disturbing than one without.

<comment><USER24> I was riffing on an old expression of putting lipstick on a pig.

[https://en.wikipedia.org/wiki/Lipstick_on_a_pig](https://en.wikipedia.org/wiki/Lipstick_on_a_pig)

<comment><USER25> I realize that, but the point of the saying is typically that a pig with lipstick is little or no better than without. My point is that Coffeescript makes JS _worse_. It just adds an additional layer of complexity when you end up debugging the same old JS traps. The saying still holds up, because a pig wearing lipstick could actually be worse than a plain pig.

<comment><USER24> Ah, well in that case we are in disagreement. I think Coffeescript is a big improvement. It produces JS code that conforms to The Good Parts™ without having to remember to always add that third equals sign or the var keyword to avoid making a global and other such ridiculous bull-ka-ka.

So you end up not debugging the same old JS traps as much because it is a lot harder to write them. (You get to debug shiny new JS traps instead, but there's only so much a good lipstick can do.)

But it's fine if you prefer javascript to coffeescript. Tastes differ. Some people like bull-ka-ka. _runs away_

</comment></comment></comment></comment></comment></comment></comment></comment><comment><USER26> moonscript powers the itch.io indie marketplace - the original announcement has a quick write-up: [http://leafo.net/posts/introducing_itchio.html](http://leafo.net/posts/introducing_itchio.html)

After spending years working with Ruby or Java, it was a very nice change of pace. Lapis (leaf's web framework) is crazy good as well: it's easy to write fast code, see this article on coroutines: [http://leafo.net/posts/itchio-and- coroutines.html](http://leafo.net/posts/itchio-and-coroutines.html)

(disclaimer: I work there with Leaf!)

<comment><USER27> Had there been any scaling problems for Lapis-powered apps that you have worked on?

</comment></comment><comment><USER28> Some of the stuff in Moonscript feels a little overdone and magical, like parens-less function calls and the syntactically significant whitespace - <USER3> others really feel like they're fixing the gaps in Lua. Moonscript's nice lambda syntax, ternary operator, default local, implicit return, etc.

But I don't think I really needed the ! operator, for example.

<comment><USER29> _fixing the gaps in Lua. Moonscript 's [...] default local_

Roberto Ierusalimschy, the creator of Lua, believes that "Local by default is wrong." [1].

I don't necessarily agree that local-by-default is _inherently_ wrong, but every implementation of local-by-default that I've seen has had flaws.

It looks like MoonScript is no different - its scoping rules seem to suffer from the same "madness" as CoffeeScript [2].

[1] [http://lua-users.org/wiki/LocalByDefault](http://lua- users.org/wiki/LocalByDefault)

[2] [https://donatstudios.com/CoffeeScript- Madness](https://donatstudios.com/CoffeeScript-Madness)

<comment><USER28> Honestly, it seems like implicit variable declaration is a bad idea. Some minimal keyword to indicate "this is a new variable in this scope" seems necessary for sane scoping. It nicely prevents a class of bugs of "oops I made a typo in that assignment and created a new variable" gets caught.

<comment><USER30> Indeed. Is "let x = y+y" so bad? I wonder how much of the resistance owes to longer words like "local"/"define", or ugly abbrevs like "mut"/"var".

<comment><USER28> So what would you use for declaring a variable that won't be assigned to until lower scope? Like a variable that will be assigned inside a try/catch block but needs to outlive it so it's declared before the try?

Just

        let x

? That looks weird. Or we're back to "var". Or throwing another keyword at x?

        let x exist

Also weird. I've often dreamed of a nice lua-like math with syntax aimed at being familiar to a first year college math student, and "let" is an obvious keyword for variable declaration, but unless you go pure functional you need to be able to pre-declare variables.

<comment><USER30> I'd make try/catch an expression, not a statement, like in Lisp -- it'd still be "let x = try {...}...". I agree that 'var' for mutable bindings is a reasonable design. In E it's 'def' for immutable and 'var' for mutable, for instance; and you can also write just 'def x' and then 'bind x := 42' further down (with single-assignment semantics). But though that's nice to have, you can do all right without it; if there was just a single form of definition, with lexical scope, I'd still prefer it to Lua or Python's designs -- clearer and less error-prone and still concise.

<comment><USER28> I'd use "set" instead of "bind" and be consistent that assignment leverages the vanilla equality operator (since we're already talking about that for "let") but yeah, it sounds like you've been thinking about the same stuff I have.

It sounds like you've been pondering the same problems I have.

In my case it's because I've been working on a rules-engine for scientists and currently we're using SQL for the rule language and some of the syntactic warts of SQL are tripping us up.

I keep meaning to learn enough Racket Scheme to experiment with implementing such a language in macros.

<comment><USER30> FWIW, Common Lisp's macro system is relatively simple. I've been meaning to check out [http://beautifulracket.com/](http://beautifulracket.com/) sometime to learn about the Racket way.

Maybe Datalog could make a cleaner base for your project? Just a random thought; bound to be lots more considerations.

Yeah, I have a project right now too where these questions come up -- [https://github.com/darius/squeam](https://github.com/darius/squeam) \-- though it's not really ready for anyone.

</comment></comment></comment></comment></comment></comment></comment></comment><comment><USER31> I was on a team that used Lua in production on tens of thousands of machines running 24/7\. The Lua interpreter was the weak link in the system, requiring at least daily restarts. Squashed so many bugs over the years, and still found more and more all the time. What I'm saying is, the Lua interpreter itself is flawed and I can't imagine using it as a runtime if I had the chance to avoid it. That said, the language was fun and fast and got the job done. The interpreter could use some work.

<comment><USER32> This page lists every known bug in the Lua interpreter for the last 14 years, along with its fix: [https://www.lua.org/bugs.html](https://www.lua.org/bugs.html)

The average is 8 bugs per year, most fairly obscure. Every Lua release fixes all known bugs.

Roberto, the chief architect, is kind of fanatical about quality: [https://www.youtube.com/watch?v=yU5QNKpATxk](https://www.youtube.com/watch?v=yU5QNKpATxk)

I do not believe the interpreter is as flawed as you claim.

<comment><USER33> Agreed. In my experience it is extremely solid code. I haven't come across anything that I could imagine leading to a need for daily restarts.

And I speak as someone who reported one of the bugs on their bugs page.

</comment></comment></comment><comment><USER34> I find Lua itself very programmer friendly.

<comment><USER35> Agreed, but it looks like it adds a layer of syntax to give you things like classes without the user having to leverage metatables.

<comment><USER19> That is correct. It's also done dynamically so you don't have any external dependencies required when transpiling to Lua code.

EDIT: I am not saying this is better - it could certainly be improved or, as is the case with a project of mine, injected into the runtime as a global value. It's just good for running MoonScript alongside Lua.

</comment></comment></comment><comment><USER36> Adding superlatives to your stuff is, to me, just noise. e.g: "fast", "simple", "friendly", "lightweight".

I would rather provide conclusive proof, like some side to side comparison of features to illustrate how idiomatic MoonScript is supposedly friendlier than Lua.

Personally I think the changes are not necessarily in the right direction:

For example, what if you have a typo in a variable identifier when assigning a value to a variable? Now you have a new variable. Where to look for the definition of a variable? It depends on what runs first now. That's not friendlier. CoffeeScript made the same mistake in the name of simplicity and it quite frankly doesn't add any value. The time you saved typing "local" will be now consumed several times debugging and code reviewing... and you will have to pay more attention during your code reviews.

Then, removing braces and other delimiters. That's not necessarily better either. Let's remove lane delimiters from streets, traffic signals, stop and yield signs, and let's make it all implicit based on rules you can follow in your head. See? doesn't work.

<comment><USER16> I see it as a toy language. The only person I think would find it useful is leafo himself since he can edit it however he wants. But everyone else should stay away from it. Plain Lua is so much better.

<comment><USER37> Can't agree with that. Having used both Lua and Moonscript quite a bit I think Moonscript is what most dynamic scripting languages should be. Simple, succinct and does what you need for a scripting language.

I really enjoy using it.

<comment><USER16> Care to give an example?

<comment><USER38> The list comprehensions are really great. Most of the time when I'm writing Lua I can't be bothered to write exactly what Moonscript outputs for a list comprehension because it's noisy, but it's what I really would write if I cared about tiny amounts of performance.

<comment><USER16> Idk. Still not sold. You can do list comprehensions in regular Lua with something like this:

        function listcomp(t, f)
            local r = {}
            for k,v in pairs(t) do
                r[k] = v
            end
            return r
        end

And then, your Lua code would be like:

        listcomp({1, 2, 3, 4}, function(k, v)
            return v*2
        end)

Which would be the equivalent to this in MoonScript:

        [v*2 for k,v in pairs({1, 2, 3 ,4})]

I dunno. Just seems like a wash to me. And then you think about the extra compile step to run MoonScript, and the potential performance hits, and I'm just turned off completely from it.

<comment><USER39> There are no potential performance hits. In particular the code generated for list comprehensions would be faster than your example because there is no extra function call per item.

</comment></comment></comment></comment></comment></comment></comment><comment><USER40> "Moonscript is like CoffeeScript for Lua"

That's a very succinct description and from skimming the examples, quite apt.

But what I want is Typescript for Lua, specifically to use with Redis. That way I can define interfaces for my keys/values and have static checks on their usage.

<comment><USER41> Check out Haxe: [https://haxe.org/blog/hello- lua/](https://haxe.org/blog/hello-lua/)

</comment></comment><comment><USER39> Another Moonscript project is [https://howl.io](https://howl.io) \- an editor written almost entirely in Moonscript that runs on LuaJIT.

</comment><comment><USER18> How does MoonScript compare to Wren? [https://github.com/munificent/wren](https://github.com/munificent/wren)

<comment><USER42> System.print("Hello world")

It kind a looks like someone wanted to make actual Java-script. To me these are way too different to even compare, unless you are talking about performance, but then you are just comparing Lua with wren and there seems to already be some benchmarking of these on wren.io

</comment></comment><comment><USER43> Can this be used instead of Lua with Redis? Is there an example somewhere of that?

<comment><USER44> Check out [https://github.com/jondeandres/moon- redis](https://github.com/jondeandres/moon-redis)

<comment><USER45> Pretty sure he means redis scripting [https://redis.io/commands/eval](https://redis.io/commands/eval)

<comment><USER43> Yes, that's what I meant. Thanks!

</comment></comment></comment></comment><comment><USER46> Nice!

We need more programming languages with sane syntax.

</comment><comment><USER47> I wonder if this would work with NodeMCU development for esp8266 boards.

</comment><comment><USER48> Lua is a great language and MoonScript improves on it even further. I used MoonScript to write a load balancer with OpenResty recently, and World of Warcraft interface code six years ago. :)</comment>


Ask HN: Is this 62-year-old Hoover sized project California's drought solution? - <AUTHOR> http://en.wikipedia.org/wiki/North_American_Water_and_Power_Alliance I learned about this a while back, so I figured I'd ask the analytical hive mind of HN, with it's teardowns of "Hyperloops" etc, to share their opinions on it's viability. <comment><USER2> Are my taxes going to support more yuppies in California? How about they live somewhere else instead.</comment>


Problem solving is cultural – EdTech doesn't get it yet - <AUTHOR> https://medium.com/@fjmubeen/edtech-s-culture-problem-c6e37e6cbba2#.19skl83b2 <comment><USER2> >There's a lot we can glean from data — a student's learning progress, their habits and their strengths across a curriculum. But there's so much more that's hidden from view.

What's hidden from the view? Can you give examples?</comment>


Ask HN: What tool do sites use for Mac titlebar screenshots? - <AUTHOR>

Hi HN, I noticed that many sites have screenshots of their app or site with pseudo OS X-style title or menu bars, but I can't for the life of me find what tool they use. Surely there's something out there to easily produce an image with it at the top.
For an example, see DuckDuckGo's whatsnew page that's on the frontpage today: https://duckduckgo.com/whatsnew
https://duckduckgo.com/assets/whatsnew/answers.jpg <comment><USER2> I'm guessing Sketch or some similar drawing tool and then copy/paste. It's a fairly simple graphic.

[http://bohemiancoding.com/sketch/](http://bohemiancoding.com/sketch/)</comment>


Google Releases Tool to Help iPhone Hackers - <AUTHOR> https://motherboard.vice.com/en_us/article/d3x3dw/google-releases-iphone-ios-jailbreak-tool <comment><USER2> What is the usual turnaround time before simiar bugs or exploits are patched, on average?

<comment><USER3> It's already patched, if you update to the latest ios.</comment></comment>


Show HN: EngageSpark, Voice IVR and SMS Text Campaigns Made Easy - <AUTHOR> https://www.engagespark.com/

<comment><USER2> Join our team and help alleviate poverty! We're looking for talented people who want to code and change the lives of people in poverty around the world.

Check out this webinar with Mercy Corps where we changed the lives of 20,000 survivors of Typhoon Haiyan: [http://solutionscenter.nethope.org/blog/view/hitting-it- home...](http://solutionscenter.nethope.org/blog/view/hitting-it-home-soap- opera-campaigns-encourage-financial-literacy-in-the-ph)

</comment><comment><USER3> A a social business where profits are used to subsidize NGOs campaigns.

The technical side is also fun: µservices, Python, Go, Java, Docker, Ractive.js ...

</comment><comment><USER4> engageSPARK's mission is to empower NGOs with a powerful platform to send SMS and Recorded Voice calls to millions of people accross the world. engageSPARK is using code to change the world!</comment>


Ask HN: What service to use as a contacts/calendar server? - <AUTHOR> I'm trying to go through the de-Googling process.
I have used ProtonMail and Signal for a few months and love it so far.
I'd like to move my contacts and calendar away from Google.
ProtonMail offers contacts, but they don't integrate with other apps on Android (maybe I just use it anyway?)
I've read about EteSync [1], which allows for end-to-end encrypted contacts and calendar. However, I'm not sure how comfortable I am with trusting that a project of that scale implements cryptography correctly[2] (no offense @tasn)
Maybe NextCloud?
What does the HN community use to store contacts/calendar?
[1] https://www.etesync.com/ [2] https://git.io/fhpaP <comment><USER2> I use FastMail for email, contacts and calendar with DavDroid

[https://play.google.com/store/apps/details?id=at.bitfire.dav...](https://play.google.com/store/apps/details?id=at.bitfire.davdroid&hl=en)</comment>


Ask HN: Is there a way to stop Alexa/Similarweb from tracking my site? - <AUTHOR> <comment><USER2> A better question would be why you want to do this?

If people use the Alexa toolbar it adds a header to their user agent you could use to block them[0], but Alexa is pure junk and not worth concerning yourself with[1].

I also don't think people quite realise the privacy implications of using that addon, it phones home on literally every page a user is on, that's how it works. Every single site, (porn) link, whatever is tracked.

[0] [https://webmasters.stackexchange.com/a/72663](https://webmasters.stackexchange.com/a/72663)

[1] [http://www.closetnoc.org/?i=definitive-proof-that-alexa- suck...](http://www.closetnoc.org/?i=definitive-proof-that-alexa-sucks)

<comment><USER3> Lots of people quite not realize the fact that they got this nasty toolbar/addon to begin with.</comment></comment>


On the Impossibility of Supersized Machines - gene-h https://arxiv.org/abs/1703.10987 <comment><AUTHOR> Summary: This is a parody of various arguments about superintelligent AI.

It opens by parodying the classic futurist parable of history as exponential growth in intellect and technology, recasting history as a tale of growth in size (after all, the earliest organisms were tiny). It recasts fears about superintelligent AI as fears about super-large beings (wouldn't you be afraid of something that could step on you as easily as you step on an ant?).

Then it switches to parodying some arguments _against_ the possibility of superintelligence, in order:

1\. That intelligence is "irreducibly complex"; since we don't understand what makes people smart, we can't expect to make smarter machines. This, to me, is the weakest of the parodies in the article. We definitely understand size better than intelligence, and lack of fundamental understanding has absolutely impeded our ability to engineer things in the past. To get to the Moon, we had to understand gravitation at a much deeper level than "things fall down", or even than "things fall in parabolas". That said, total understanding of natural phenomena is not always necessary to replicate them: the Wright brothers didn't need to understood how exactly bird flight worked to build the first plane.

2\. That intelligence is poorly defined ("human-level" AI is "meaningless"). "Largeness" is similarly vague, but an Airbus is still obviously bigger than a human. Vague goals can still be met.

3\. That human intelligence is in some way "universal". I don't understand this argument enough to explain the parody. Can someone else chime in?

4\. Psychological arguments against superintelligence, which says that the origin of belief-in and fear-of superintelligent machines is really evolutionary, not logical. This is a classic non-sequitur; if evolution predisposes humans to be afraid of wolves, it does not follow that humans have no reason to be afraid of wolves.

5\. That the goal of AI research is to augment human intelligence, not supplant it. Another non-sequitur.

6\. Arguments from the hard problem of consciousness, and philosophical questions like "can a machine ever be conscious?". Yet another non sequitur: even if you think a machine fundamentally can't be conscious, it doesn't follow that it can't be functionally superintelligent.

7\. Bullshit arguments involving quantum mechanics, Godelian incompleteness, and other things with pop-cultural cachet that most people who invoke them don't have the technical chops to understand.

<comment><USER2> > 3\. That human intelligence is in some way "universal". I don't understand > this argument enough to explain the parody. Can someone else chime in?

This is a reference to the principle of computational equivalence. All Turing- complete systems are capable of emulating each other. A human can execute any program a machine can (only slower), and derive benefit from the results even if he doesn't fully understand the process.

[http://mathworld.wolfram.com/PrincipleofComputationalEquival...](http://mathworld.wolfram.com/PrincipleofComputationalEquivalence.html)

<comment><AUTHOR> I'm familiar with Turing-equivalence, but the argument in that section didn't seem analogous to me. In the first place, it's about _human_ universality, not _computer_ universality; so an implicit premise of the "parodied argument" would have to be something like "human intelligence is Turing-complete" \- I've seen no argument against machine superintelligence that starts from this premise (although not all arguments depend on rejecting it, either).

<comment><USER3> Rejecting human intelligence being Turing-complete in the same sense as a particular conventional computer (i.e as a linear bounded automaton) would be a pretty hard sell. It would be equivalent to claiming that there was a single-threaded C program that a human with unbounded time and scratch paper couldn't step through.

<comment><USER4> Why does the threading matter?

<comment><USER3> It doesn't, but I think it's an easier sell that humans can do that than a multithreaded case. Especially because it introduces a lot more undefined behavior.

<comment><USER4> Seems to me undefined behaviour is the beginning of something approximately human.

</comment></comment></comment></comment></comment></comment></comment><comment><USER5> I've always enjoyed this similar satire: [http://dresdencodak.com/2009/05/15/a-thinking-apes- critique-...](http://dresdencodak.com/2009/05/15/a-thinking-apes-critique-of- trans-simianism-repost/)

</comment><comment><USER6> Sure, it's a parody, but let's take a few moments to take it at face value.

For every machine _of any size_ , a lot of effort goes into its creation. They also don't survive without external intervention. The larger the machine, the more effort that goes into their creation and maintenance (and the more vulnerable they are to minor failures).

Aircraft, as a singular example, have to be virtually torn apart inspected and repaired every couple hundred hours to ensure they won't fall apart during regular use. They are also susceptible to the loss of a single critical piece; the loss of which will cause them to fail, often spectacularly.

Big bridges require almost daily maintenance to keep them safe. Boats are incapable of the simple act of fueling themselves. Computers stop working properly due to cosmic radiation flipping bits. Knives get dull. Batteries run out. Radioactive isotope power generators decay. Plastic breaks down. Stone erodes.

We have, despite hundreds of thousands of years, barely been able create an object which can last for even a couple of hundred years without constant maintenance. We have yet to create a machine of any size which is capable of maintaining itself. Why would a computer program, itself reliant on one of our least reliable and fragile constructs, prove to be any different?

</comment><comment><USER7> Ah, yes, I had of course forgotten the Hard Problem of Largeness, which shows that bigness must necessarily be a non-physical property. How silly of me to ignore philosophy!

</comment><comment><USER8> I thought it was a play on Kafka's quote:

 _" The crows assert that a single crow could destroy the heavens. This is certainly true, but it proves nothing against the heavens, because heaven means precisely: the impossibility of crows"_

I'm still not sure I am wrong.

</comment><comment><USER9> On a more serious tone, I am currently reading the paper that surfaced here tho weeks ago (from 1999): [https://news.ycombinator.com/item?id=13920714](https://news.ycombinator.com/item?id=13920714)

The topic is somewhat similar, and the paper is interesting so far, but I am reserving my opinion for when I will be finished reading it.

</comment><comment><USER10> >6\. The Hard Problem of Largeness

Take that, Dave Chalmers!

</comment><comment><USER11> OK, so I thought that this would be about Dyson spheres etc.

</comment><comment><USER12> I'm sure an AS400 is bigger than a human.

<comment><USER13> Check out fig 1 (page 4).

<comment><USER14> Better check the date :)

</comment></comment></comment><comment><USER15> Pretty sure a D9 bulldozer is bigger than a human, and an A380 and a tunnel boring machine and a steam engine and a crane, and the truck that picks up my rubish and....

<comment><USER16> It's satirical, parodying arguments against superhuman machine intelligence. IMO it's also not as clever as it thinks it is.

<comment><USER17> I think it's very clever. Even if I think that the sarcasm of the paper express the message perfectly, after reading some of the comments here, I'm going to spell it.

It's telling us: we live in a material universe, intelligence is just a function of physical attributes. If you want to deny the possibility of machine intelligence, the burden of proof is on you because, denying that would be so ridiculous as denying supersized machines.</comment></comment></comment>


Show HN: Canetis – a recursive Python audio/text aligner built on Gentle - <AUTHOR> https://github.com/nsheth12/canetis <comment><AUTHOR> We're two college students who built this as part of our research lab work. In our testing, it aligned more words than other forced aligners we found out there, so we wanted to share it. Please send any feedback our way!</comment>


America's monopoly problem, explained by your internet bill - <AUTHOR> https://www.vox.com/the-goods/2020/2/18/21126347/antitrust-monopolies-internet-telecommunications-cheerleading <comment><USER2> If america has an ISP/telecom monopoly issue, why didn't Donald Trump receive more support when he tried to block the sale of Time Warner to AT & T?</comment>


HDCP encryption/decryption code released - <AUTHOR> http://www.cs.sunysb.edu/~rob/hdcp.html

<comment><USER2> That was faster than I expected. Little over a week from the master key release to this.</comment>


Ask HN: Can you self-learn Japanese? - <AUTHOR> <comment><USER2> I think you can self-learn Japanese to a point. You can certainly become proficient enough to read written Japanese, as long as you have both the time and patience to learn and review Kanji compounds (too many resources focus too much on individual Kanji, and not enough on the many compounds you'll actually see in text). You can also become proficient in understanding spoken Japanese, given how many great audio resources there are online now. The challenge there is that there is a lot of slang, and its harder to find good online resources for the slang.

If you want to learn to speak and write Japanese, then that's more difficult, and probably impossible, to accomplish through self-learning. You won't be able to reproduce intonation appropriately without practice speaking to someone who is already fluent in the language. Nor will you be able to pick up the social cues that tell you when to speak in formal, humble, casual, or informal register.

However, I don't recommend trying to learn Japanese in Japan until you are up to an intermediate proficiency at least. There are many language schools for foreigners in Japan, but frankly it's expensive and you won't get that much out of a beginner course in Japan that you won't get from a beginner course or by self-learning at home.

So my suggestion would be to take local/online courses or self-learn until you are roughly intermediate, then take language courses in Japan if you want to try to reach that upper Advanced/Fluent level.

</comment><comment><USER3> You definitely can. Start with the hiragana and katakana. Then some kanji. Then start to listen and talk. Check these two links:

* [https://www.wanikani.com/](https://www.wanikani.com/)

* [https://www.japanesepod101.com/](https://www.japanesepod101.com/)

</comment><comment><USER4> I'm currently learning Japanese, and that is not a well defined goal IMHO. How do you "learn computers"?

Alternate ideas..

I want to be able to:

       * Ask for directions in Japanese

       * Tell a joke in Japanese

       * Write a letter congratulating someone on their new job

       * Order food in a Japanese restaurant

       * Hold a conversation in Japanese about topic X - (My life, my hobbies, the weather, my recent vacation, etc)

       * Watch a Japanese movie w/o subtitles

etc..

Having a specific real-world goal like that makes it _WAY_ easier than dealing with word lists and grammar rules, and trying to 'synthesize an sentence based on rules in your head'. I found the structured book based approach to be very boring. We all learn differently of course, so you may have success doing it either way.

</comment><comment><USER5> Up to a certain point, and especially if you're focusing on reading and listening. Past a certain point, you need to actually use a language in your day-to-day to continue growing. There's a lot of cultural background in the way that many things are phrased

</comment><comment><USER6> I think you can. The one thing I love about Japanese is that you don't have to master many different tones, like Chinese. You can even speak in monotone voice, and as long as you pronounce things correctly, most Japanese people will understand you.

</comment><comment><USER7> DuoLingo added it:

[https://www.duolingo.com/course/ja/en/Learn-Japanese- Online](https://www.duolingo.com/course/ja/en/Learn-Japanese-Online)

</comment><comment><USER8> You can self learn it, but at some point you will like to have some guidance. I had been studying for a couple of years and really helps to have a teacher.

</comment><comment><USER9> Yes, I did. I recommend you disregard advice to learn kanji. Use romaji or hiragana / katakana and focus on spoken Japanese instead of written literacy. You will learn MUCH faster and if you wish to do so you can learn kanji later.

</comment><comment><USER10> The best way to learn Japanese is to head to Japan.

Good luck!

</comment><comment><USER11> Maybe. It really depends on what level you hope to achieve. I suggest using CEFR as a starting reference:

[https://en.m.wikipedia.org/wiki/Common_European_Framework_of...](https://en.m.wikipedia.org/wiki/Common_European_Framework_of_Reference_for_Languages)

For A1 or A2, you can easily be self-taught. Lots of materials work (see below). You will need to refine your skills once you are in a native speaking environment, but you should easily be able to do so. Many Americans consider this "fluent", but I would call it more like tourist-level proficiency — working in a Japanese-speaking organization would be impossible.

For B1 or B2, I suppose you can be self-taught to this level, but perhaps only with receptive skills like reading and/or listening. These are the levels where you need to feel comfortable with authentic texts. For productive skills, it will be tough to reach this level without being in Japan — it's just awkward to try to create authentic daily situations with a teacher in a comprehensive way (it can be done and is done, but it is expensive and time consuming).

For C1 or C2, you need to be in country. In fact, you need to be living in the language. Most/all media, conversations, etc. will need to be in Japanese for a while (1-2 years for C2 would be doable if you start with a solid B2 baseline) before you can reach and sustain at this level.

Recommended materials:

Japan Times materials — they are pretty much all good. Good for A1 to B2.

Japanese Language Proficiency Test (JLPT) 日本語能力試験 — This test has 5 levels, and they release old tests. The tests themselves are designed very well. Look through one to get a feel for what you need to know. When you think you're at level, take the old test. After your done, break down every question and figure out what the right answer is, why it's right, and why the others are wrong, and why those wrong answers are good distractors (some distractors are aimed at non-English speakers, so don't over think this). Rinse and repeat. For me personally, this was a great way to find gaps in my knowledge.

Jorden books (Beginning Japanese and Intermediate Japanese). This books are ancient with some outdated vocabulary, use a suspect teaching method (it sort of works, kinda), but the technical lingustic explanations are the best I've seen. As a simple example, I've never seen better explanations of when to use the particles は and が for beginners than in that book (a better one may exist, I just haven't seen it). When I was learning, this helped me crush the first two levels of the JLPT (Japan Times stuff better for higher levels), and I helped friends do the same when other textbooks and teachers were lacking.

Duolingo — I just love this software for a basic intro to the language. I'm not sure what level it gets a learner to — maybe A1? That said, it's a low friction way to start.

This is an area I know a lot about, so please feel free to ask follow up questions.</comment>


Ask HN: No web browsers left in 10 years, or only web browsers left in 10 years? - <AUTHOR> <comment><USER2> I would really hope for "only web browsers left". But then they wouldn't be web browsers, instead they would be the operating systems standards, like POSIX. I hate the scenarios that goes like this - "Hey I have an idea for a software, ok cool lets build it, but wait, what platform should we target?". A software is just a bunch of computations that interact with IO devices. why can't we have a standard way to do that?

<comment><AUTHOR> I hope so too. Yes there wouldn't be web browsers in the sense that you are writing. I like how a 'browseros' could basically treat software itself as a plug-in where it relegates itself to being an IO device for software. Seems very simple and modular.

</comment></comment><comment><USER3> False dichotomy? Is there a reason that you believe only these two outcomes are possible?

<comment><AUTHOR> Definitely it is, but what outcome would you prefer and why?</comment></comment>


The Advanced Placement Juggernaut - <AUTHOR> http://roomfordebate.blogs.nytimes.com/2009/12/20/the-advanced-placement-juggernaut/

<comment><USER2> My anecdotal evidence says that the teacher makes much more of a difference than even the students. In my high school, every single kid that took AP Calculus got a 4 or 5 because the teacher was great, and barely anyone passed the chemistry exam. In a competing high school not far away it was exactly reversed: there was an effective chemistry teacher and every kid got a 4 or 5, but somehow they struggled in calculus.

</comment><comment><USER3> The point about pressure to take AP courses and exams that students aren't prepared to is rather interesting. One can see this effect by looking at the US News and World Report high school ranking:

[http://www.usnews.com/articles/education/high- schools/2009/1...](http://www.usnews.com/articles/education/high- schools/2009/12/09/americas-best-high-schools-gold-medal-list.html)

The ranking is not necessary a great resource, but IMO the statistics within each school's stats are telling. Let's take the example of my former high school, Thomas Jefferson, versus another highly-ranked one (IIRC they were second last year):

        Thomas Jefferson High School (Alexandria, VA):
        Exams Per Test Taker             7.1
        Exam Passing Rate (3 or above): 98.1%

        Oxford Academy (Orange County, CA):
        Exams Per Test Taker             6.6
        Exam Passing Rate (3 or above): 76.5%

Some schools seem to get away with enormous numbers of AP exams per student-- and still reliably get high scores. Others, despite being top-ranked, don't do nearly as well. Is it because the students are better to begin with? A selective school will clearly get better average scores than a less selective one. Is it because the courses are better-taught? Does any of this count for what is effectively a factor-of-10 gap (in terms of number of failing students)?

Another is perhaps even more telling:

        The School for the Talented and Gifted (Dallas, TX):
        Exams Per Test Taker            13.2
        Exam Passing Rate (3 or above): 60.9%

This one's a magnet school just like TJ, but the number of APs they take is _utterly ridiculous_ : and their pass rate suffers. I suspect that there is a certain number of APs per student that is optimal, and beyond that the pass rate collapses.

</comment><comment><USER4> Scroll down a little to Philip M. Sadler and you will see a great example of cognitive dissonance.

 _Many had passed the A.P. exam, but had either been advised to take the college course as a way to deepen their knowledge or had to because their exam score did not meet departmental requirements. This group gave us an opportunity to see how A.P. students fared in college science, since passing an A.P. exam is presumed to mean that they had mastered a college-level course.

We found that students who took and passed an A.P. science exam did about one- third of a letter grade better than their classmates with similar backgrounds who did not take an A.P. course. Even a score of 5 on an A.P. test is no guarantee of a college grade of A in the same subject._

First, passing an AP exam (3 or better) is only presumed to mean that they mastered the course at the less selective schools. It says in the preamble that the most selective schools recognize that a 3 or 4 is not good enough for college credit.

He then went ahead and decided that he would compare people who _didn't get a 5 on the AP test_ with people who had never taken the course and decided that the grade difference meant that APs don't mean anything. It's like taking a group of people who failed a test the first time, giving it to them again, and then being surprised when the fail again. (Note: They didn't really fail, they just failed to be in an upper percentile of the class, which would be expected if they didn't know the material.)

I also find it hilarious that he expected everyone with a 5 to get an A in the course. I know a bunch of subjects I could have got an A in had I cared less about my CS courses.

<comment><USER5> _I know a bunch of subjects I could have got an A in had I cared less about my CS courses._

I find this comment to be rather sad.

<comment><USER4> Well, GenEng courses require a lot of time and I would rather get an A in my CS course than get an A in Civil Engineering 201 (instead of a B+). My schedule sometimes involves tradeoffs (i.e., two required courses held at the same time), what's sad about that?

<comment><USER5> What's sad is that you apparently treated college as a vocational-training school. That's fairly normal these days, but still not something I like to see happen.

<comment><USER4> No I think that's a false comparison. Simply because I _favor_ my computer science classes over others when they compete doesn't mean I don't receive a breadth education -- it simply means I'm a computer science major. Doing nothing but computer science would be treating college as vocational school, but that's not what I said. Instead I said that sometimes I sacrificed high grades in other courses for a high grade in computer science.

In addition, there's only a loose relationship between getting a very good grade in a course (as opposed to a good-mediocre one) and getting breadth knowledge out of the course. To believe otherwise would be to satisfy tendencies of grade inflation. For example, an A in a course was originally supposed to mean an excellent performance beyond expectation. To get an A in every single course should signal that you are either 1) extraordinarily dedicated to your school work and extremely bright or 2) the school is handing out an A not for extraordinary work, but only good work. In light of this, the most reasonable grade distribution for a bright, dedicated student would be a very strong (hopefully A level) grade distribution in their area of specialization with a good but not as extraordinary distribution in their breadth subjects.

It was interesting that you noted me as focusing on CS like vocational training when I actually take pride in my choice of courses as true liberal arts education. For example, while I am an engineer CS major, I will have taken enough courses in the physics and philosophy departments to almost qualify for a minor in the fields. Simply because I am unable to dedicated my time to all of my varied classes at once does not mean that I do not participate in number of different liberal arts.

</comment></comment></comment></comment></comment><comment><USER6> Not all AP subjects are created equal, either. I had the privilege of attending a Fancy Private School(tm) which offered the full gamut of AP courses, and took advantage of a handful: English, Biology, Chemistry, French Literature, Calculus.

Of all these subjects, the French Literature (not to be confused with the langauge AP) was an order of magnitude harder. At my school, only students who stayed in the AP track from freshman year onwards were able to take the "AP" class, effectively making the AP requirement 4 years long. It was purely necessary: by 9th grade you know a little French, but the intensive vocabulary building, then reading simple books (The Little Prince), then graduating to proper literature and poetry -- it takes time to build up to that level. The program was hard but well worth it: the entire AP class (9 in total, starting from 30) came away with 4s and 5s. NYU later gave me something like three semester-class' worth of credits for that one AP. I think the monetary value for that is something like $10,000. Not too shabby.

I had some friends who took the Music Theory AP and reported a similarly difficult experience.

</comment><comment><USER7> I took a few APs and I got the feeling that while a few students were really interested in the subject and really wanted the college experience, most just wanted the bump in the GPA. Due to the expense of it the lab component was completely dropped. Since I learn mostly by trying and experimenting I felt like I learned less than when I took honors physics. I think by exam time most of realized we weren't really prepared and got used to the idea of taking college physics no matter the grade we got.

The college board makes a lot of money on these exams. The district paid for the curriculum and the exams. About $600 per student on average I believe. So there is a lot of money to be made by signing students up.

<comment><AUTHOR> The exams cost considerably less than $600, even at list price, and the curricula are not published by College Board, but by independent textbook publishers.

</comment></comment><comment><USER8> Not sure if it was the norm but the AP classes in my high school just gave more homework, nothing more challenging nor deeper into the subject matter, just a greater volume. That approach doesn't seem that helpful to me. Hopefully others experienced it differently.

<comment><USER9> That's odd, because my AP experience was exactly the opposite. While I did have more homework in AP Literature, the homework was meaningful, personal, and founded on the cumulative knowledge attained over the course. On the other hand, in my AP Statistics class, the homework hardly counted at all while the emphasis was on the tests (which I feel is appropriate for the subject). In my ordinary classes the homework was boring, redundant and even comical at times.

<comment><USER10> I think the general trend of AP classes is to focus on getting people passing grades on the exam, and this hurts the ability of the class to explore into other topics, or doing things that would not contribute greatly to that specific goal. English essays would be formulaic, and my history class was constant timed practice exams and formulaic essay writing. If I remember correctly, some of my teachers complained about not being able to explore off- topic.

<comment><USER9> I should note that lately I've discovered that my experience in AP Lit was highly unconventional.

</comment></comment></comment></comment><comment><USER11> It seems they should start 'advanced placement' much much earlier than high school.

A modular design to education with students mastering skill sets instead of growing older to 'move through the ranks' would allow students to always remain around their educational peers regardless of age, allow bright students to excel, and maintain support for those struggling.

<comment><AUTHOR> _A modular design to education with students mastering skill sets instead of growing older to 'move through the ranks' would allow students to always remain around their educational peers regardless of age, allow bright students to excel, and maintain support for those struggling._

Yes. There is no particular reason why students should be kept in lockstep by age in school. Schools were once organized differently.

<http://learninfreedom.org/age_grading_bad.html></comment></comment>


Why does VP Sales get paid more than VP Engineering? - <AUTHOR>

They are similar high level positions, just in different departments, but it's pretty common to see VP Sales make at least 20% more than VP Engineering.  If software developers really are in short supply and really good ones even more scarce (the type of person that could fill a VP Engineering role), then what explains this disparity?<p>Not to pick on GeoPalz, but they are one data point that I could easily find that shows this income disparity is: http://www.builtindenver.com/external/node/66881. They have openings for both VP Engineering ($85k-$115k) and VP Sales ($100k-150k) <comment><USER2> Companies live and die by sales. The top earners in most companies are commission sales people. The reason for this is really simple, the sales department drives revenue. Every other department from engineering to accounting are expenses.

</comment><comment><USER3> This is easy. There is always more money the closer you are to the transaction and the P&L that actually makes the profit.</comment>


Nimrod programming language - <AUTHOR> http://force7.de/nimrod/index.html

<comment><USER2> From the docs:

      Case is insignificant in Nimrod and even underscores are ignored:
      This_is_an_identifier and ThisIsAnIdentifier are the same identifier.
      This feature enables you to use other people's code without bothering
      about a naming convention that conflicts with yours. It also frees you
      from remembering the exact spelling of an identifier (was it parseURL
      or parseUrl or parse_URL?).

This has been discussed on Reddit before. I do not like this convention. Its a nuisance if you want to search the code for a particular identifier when it has been spelled in multiple ways. I find it jarring to read code where the same variable has been spelled differently. My brain flags it every time and I have to remind myself that they are the same thing. I can possibly retrain my brain, but I do not want to do that because in almost all other contexts case and underscore does matter.

To me it appears to solve a problem that isnt much of a problem. It is fairly easy to detect misspelled identifiers during code compilation.

<comment><USER3> That is horrible. I like to name my classes e.g "Object" and call instances of that class with the lower case equivalent.. "object".

</comment></comment><comment><USER4> There are a lot of awesome things about this (it's like a semi-perverse grab bag of my favorite languages!), but some aesthetic decisions that rub me the wrong way unfortunately... Still, I'm going to keep an eye on it, and push it just below Perl 6 on my List of Languages to Really Learn.

One of the nicest bits that kept my interest:

        # There are bindings to GTK2, the Windows API,
        the POSIX API, OpenGL, SDL, Cario, Python, Lua,
        TCL, X11, libzip, PRCE, ODBC, libcurl, mySQL
        and SQLite.

</comment><comment><USER2> Some older comments are here <http://news.ycombinator.com/item?id=606892>

</comment><comment><USER5> I'm stunned. I've spent a year looking for a language with that set of features, and I mean, I really tried!

There's a few odd choices. The use of some fairly bizarre operators for unsigned integer arithmetic is slightly weird (a bit like *. for floating point operators in O'Caml). And it seems to be bootstrapped from Pascal, which is a curious choice given that it compiles to C. There's also no built-in bignum type, (though this has the positive benefit that the author is still free to license it BSD - use GMP for bignums removes that possibility).

</comment><comment><USER6> Will definitely have to investigate this with a less-sleepy brain. I very much like what I'm sure I parsed correctly, though :) Ease of metaprogramming + native compilation = happy hacking, in my book.</comment>


Why you can't get the Kindle in Canada - <AUTHOR> http://www.theglobeandmail.com/news/technology/why-you-cant-get-the-kindle-in-canada/article1316081/ <comment><USER2> The title is deceiving because the author of the article can only speculate on why, and his quote is from an analyst.

Anyway: This could all be just timing.

The international Kindle seems to be based on 3G/GSM of some sort. Up until this week, the only GSM provider in Canada has been Rogers. Just this week we've received news that both Telus and Bell will be offering the iPhone in Canada, on their shiny new GSM-compatible joint-built network.

Is it possible Amazon reached a deal with a 3G provider in Canada -- just not Rogers?

<comment><USER3> What I find most annoying is that I couldn't care less about wireless functionality. There's _rarely_ a time when I'm out of USB-cable range of a computer. Do I really need to be able to download fresh books while on the toilet?

Seriously... Does _anyone_ care about the wireless features? Certainly they could release it in Canada and let you download books and just figure out the wireless stuff later, no?

Instead they are going to lose my (current and future book-buying) business to Sony.

<comment><USER4> The wireless is actually pretty cool. On long drives, my girlfriend will finish a book, and then just buy the next in the series, on the road. It's quite a bit nicer than having to plan ahead. The DX also ships a really crappy web browser, which can be pretty useful. I've put my recipes on my colo, so when cooking we use the kindle as a recipe book. Once again, not a killer app, but it's nice.

<comment><USER3> Totally agree, of course, that it's cool. I'm just saying that as a Canadian I would _gladly_ take this scenario:

        - going on a road trip
        - almost done book 1
        - probably should buy book 2 before we leave

... to this one:

        - not available in Canada

:)</comment></comment></comment></comment>


Precog is being open-sourced - <AUTHOR> http://precog.com/

<comment><USER2> Relevant: This comes on the heels of their acquisition by RichRelevance last month ([http://techcrunch.com/2013/08/14/richrelevance-acquires- prec...](http://techcrunch.com/2013/08/14/richrelevance-acquires-precog-to- add-large-scale-analytics-engine-to-e-commerce-personalization-platform/)).

</comment><comment><USER3> What is Precog? Why this is being upvoted? Anyone care to explain a bit?

<comment><USER4> I worked on Precog. Here's my explanation:

It's an analytics platform for big data. Basically, you upload lots of JSON, use the custom language ([http://quirrel-lang.org/](http://quirrel-lang.org/)) for analytical queries and the platform will handle efficient storage and querying of your data.

There are also has extras like a library for charting and reporting query responses using JavaScript and an IDE for writing Quirrel and uploading data.

<comment><USER5> How does this compare to rethinkdb (sharding, map-reduce, indexes, queries and joins on JSON data)?

<comment><USER6> columnar storage, compression etc

<comment><USER5> Interesting, so precog breaks JSON objects into columns dot-named by their path. I wonder how rethink does it, internally?

</comment></comment></comment></comment></comment><comment><USER7> At this point I would not have been surprised if "PRECOG" was a codename for another NSA program.

Fortunately this looks much more benign and pretty cool.

<comment><USER8> It would be really easy to write a bot to make a snarky political reference regarding the NSA on every new article regardless of its content.

</comment></comment><comment><USER9> But I cannot find his previous open-sourced tool anymore, UNA.</comment>