The Mahler Project – The ZX Spectrum Orchestra [video] - <AUTHOR> https://www.youtube.com/watch?v=LxPXLIALJJI&feature=youtu.be

<comment><USER2> This is great! Didn't know what the ZX Spectrum was, and this was a nice little video.

One interesting thing is, to me at least - a musician, is that the Spectrums are not necessarily in tune; the first one playing the melody seems sharper than all the others. I wonder if the devs were aware of this, and tried fixing it?..

<comment><USER3> I doubt that's fixable.

The Spectrum's crystal was chosen for low price, not for closely matching performance (even day-to-day on the same host), so matching would require finding the hosts' CPU frequencies at that moment and compensating for the differences. Possible using the Spectronet, hardly easy.

The Spectrum was a great machine. The kind where the only way to get amazing results was amazing programming. There was no hardware to help the CPU — if you wanted to so something, you had to write code. But that's about the only nice thing I can say about the Spectrum. Build quality, suitability as musical instrument, and so on and so forth... nah.

<comment><USER4> > the only nice thing I can say about the Spectrum...

A restart was always a button-press away if you messed something up. (At least the Spectrum+ had a hard reset button on the side). Not to forget that the OS and BASIC environment were in ROM and took a fraction of a second to boot.

<comment><USER5> In the original Spectrum, there was no reset button. Nor was there a power switch. So if your machine code got stuck, you'd remove the power plug from the jack and put it back in, to get that power-on self test black screen and then a BASIC prompt.

And, eventually, the jack would wear out for those of us who wound up with more bugs than was good for the power jack. Some people actually had to replace the power jack because of this. You can still get those as spare parts, btw. [http://www.dataserve-retro.co.uk/contents/en- uk/d7.html](http://www.dataserve-retro.co.uk/contents/en-uk/d7.html)

<comment><USER6> The Z80 has a non-maskable interrupt that jumps to a fixed location in the ROM, so anyone handy with a soldering iron could have wired up a little push- button to the NMI pin to trigger it ... in the Specrum ROM this was supposed to then read an address from a fixed area in the system variables area of RAM and jump to it, except that due to a bug you could only jump to 0, ie a full reset. This always seemed a terrible shame.

<comment><USER5> Yes, I recall looking at that code in the ROM disassembly and trying to figure out that what the heck is this supposed to mean.

</comment></comment></comment></comment></comment></comment><comment><USER7> Matt's blog post on the topic:

      http://matt.west.co.tt/spectrum/the-mahler-project/

I _think_ I'm visible at the back of the crowd in the video, but the compression & low light makes it a bit hard to tell!

</comment><comment><USER8> Bhaa, do it with the loading sounds. That would be impressive. [https://www.youtube.com/watch?v=RYLoGAL85MI](https://www.youtube.com/watch?v=RYLoGAL85MI)

Seriously though, amazing! I would have loved to be involved.

</comment><comment><USER9> If you want to just hear it and see the setup without all the preamble, here it is: [https://youtu.be/WiFEicJ6grM?t=6m57s](https://youtu.be/WiFEicJ6grM?t=6m57s)

(Starts at 6:57 if that part of the link doesn't work.)

</comment><comment><USER10> Trivia / plug: Matthew Westcott, the creator of this project, is also the lead developer on [https://wagtail.io/](https://wagtail.io/)</comment>


Covid-19 coronavirus epidemic has a natural origin - ____Sash---701_ https://www.sciencedaily.com/releases/2020/03/200317175442.htm <comment><AUTHOR> Any comments on the following? Serious? useful? Garbage? [https://harvardtothebighouse.com/2020/03/19/china-owns- natur...](https://harvardtothebighouse.com/2020/03/19/china-owns-nature- magazines-ass-debunking-the-proximal-origin-of-sars-cov-2-claiming- covid-19-wasnt-from-a-lab/)

<comment><USER2> That is serious and useful, unlike the groundless claim of natural origin. The lab in Wuhan has been publishing coronavirus research for many years. In some of the research, they cause bat viruses to replicate in human cells by using the ACE2 receptor... exactly as this pandemic does.

Here is China making a virus like this one, even acting on the ACE2 receptor and testing it in human cells, publishing it in early 2008:

[https://jvi.asm.org/content/82/4/1899](https://jvi.asm.org/content/82/4/1899)

Here they are again, years later, still playing with extremely hazardous coronaviruses that act on the ACE2 receptor in humans:

[https://www.nature.com/articles/nature12711](https://www.nature.com/articles/nature12711)

When an outbreak of _exactly that type of virus_ happens right next to the lab, the only reasonable assumption is that it came from the lab. If there were a sudden outbreak of smallpox next to the CDC lab in Atlanta, we wouldn't just shrug it off as a natural occurrence. The same applies here.

<comment><USER3> > Here they are again, years later, still playing with extremely hazardous > coronaviruses that act on the ACE2 receptor in humans

"Playing with" as in "identifying and sequencing the virus in wild bats". The editorial notes say "The results provide the strongest evidence to date that horseshoe bats are natural reservoirs of SARS-CoV."

The location is... interesting, but it's also near a large wet market with a wild life section in a big city, pretty much exactly the circumstances you'd imagine to see natural transmission.

It kindles the imagination but it's not really a smoking gun.

<comment><USER2> We won't have a smoking gun unless somebody from the lab tells all, which would involve going to prison in China or claiming asylum in a different country. Such a person might even be ignored unless he provides wikileaks with a hard disk full of lab data.

They were definitely doing more than just "identifying and sequencing the virus in wild bats". They purposely caused bat coronaviruses to become more capable of infecting human cells. It's a cool experiment, but far too dangerous to attempt. One of the modifications was to use the ACE2 receptor. This receptor is found in humans, not bats. The pandemic uses that receptor.

</comment></comment></comment></comment><comment><USER4> " we can firmly determine that SARS-CoV-2 originated through natural processes"

All that means is that they didn't use a gene editor.

In all likelihood, they were experimenting with something in animals in a lab and it accidentally got released.

If you were trying to research transmissibility, then this is probably the most likely scenario.

=====

EDIT - if you downvoted me, please explain why. I ascribe no malice in my post, and if I am misunderstanding the process, then correct me before downvoting me.

<comment><USER5> How many animals would it take to get the exact kind of mutation needed to make something like the coronavirus? It feels like you'd need thousands in a lab, right?

<comment><USER4> No idea.

But if you had animals with weakened immune systems and eight years or more of testing (since SARS), then it seems you have enough time for _some_ mutations to happen.

</comment></comment></comment><comment><USER6> As far as conspiracy theories go, lab-made coronavirus is one of the more interesting and plausible ones.

I still have to reject it. Reasons:

1\. If the Chinese national leadership had designed it as a bioweapon, they would also have foreknowledge of its characteristics. Once it was clear it was a new coronavirus in late December/early January, they would have just shut things down instead of waiting three more weeks.

2\. No nation has attempted to weaponize a coronavirus before, because it makes a terribly non-specific bioweapon. It will almost inevitably come and cripple your economy if you ever did use it on someone else. And it is also very dangerous if one of your labs releases it accidentally.

<comment><USER2> Those are arguments against "designed as a bioweapon" and "intentional release by government". They are not arguments against "created in a lab", "lab containment accident", or "intentional release by crazy employee".

We know for a fact, based on research published in Nature and in Journal of Virology, that the lab in Wuhan was modifying bat coronaviruses to replicate well in human cells. Some of these modified viruses were changed to use the ACE2 receptor found in humans, just as the pandemic virus uses.</comment></comment>


What was your experience protecting your work with a software patent? - <AUTHOR> I've literally spent years (2-3 hours a day, often 7 days a week) developing a program.  Much of this time was spent reevaluating my approach and applying new insights as my experience with the concept evolved.  It was far more than just coding.  I feel I have something creative, unique, useful and unfortunately very easy to copy once someone understands my insights.  A software patent appears to be the only way I can benefit from my work.  What insights can you offer? <comment><USER2> A few downsides to patenting software:

1) A patent requires you to describe how your thing works. Ow anyone can copy your idea.

2) Short of reverse engineering someone's executable, how do you know if they are infringing?

3) So you do your patent research and find out someone has a (stupid) patent that your idea infringes on. If you go forward and someone sues you for infringement you are now responsible for triple damages because you _knowingly_ infringed. And believe me, there are lots of incredibly stupid software patents out there that should never have been granted. Just today there was something on HN about IBM getting a patent for the "out of office" email idea.

</comment><comment><USER3> It's a waste of time and money, for a few reasons.

1\. Suppose you get your patent. You won't enforce against an infringer unless at least one of you is making a lot of money from it. You'll already be beating the odds if you get that far -- nice problem to have.

2\. It's software. It's one solution to a problem, among many. If someone is infringing and needs to work do something else, other solutions are out there. Obviously I don't know what problem you are solving, or whether your solution is the only practical one, but usually there are workarounds.

3\. A patent is no guarantee that you will benefit from your work financially. You will also need to build a business around your software, which will probably dwarf the effort you've put in to date. And if someone else does that work, infringing your patent, you are unlikely to make money licensing your work (see #2). You will probably have to sue (assuming they don't voluntarily pay you), which is more time and money.

I can think of two reasons for getting a software patent. 1) You are trying to get VC funding. VCs love patents. 2) You work for a big company and they collect patents. That's obviously not you.

Also: assuming you work for some company now, check your employee agreement. They may actually have rights to your IP.

<comment><AUTHOR> Thanks. Lots of what you say is right on. In my case I'd never succeed defending a patent. That's why my goal is to establish a little traction, then look for a buy-out, someone with the money and business needs to defend the patent.

</comment></comment><comment><USER4> I do not think that you should view patents as the only way that you can benefit from your work, because the likelihood is that many people will benefit from your work. If this is true, you are most likely to be watching people benefit from your work, unable to enforce due to financial constraints. That said, in a consolidating market, acquirers are highly likely to value said patents. So, to think that patents are not an asset is false. To think that you will gain competitive advantages in a land grab is also false. I do think that patents, when your product does take as much advantage of your IP as possible, are a net benefit, but they will cost you dearly to get and simply maintain.

</comment><comment><USER5> If you believe it will be a huge commercial success, you should go for patents IMHO. Here's some info on software patents: [http://www.europeansoftwarepatents.com](http://www.europeansoftwarepatents.com)</comment>


Alternative theory of gravity makes a nearly testable prediction - <AUTHOR> https://arstechnica.com/science/2019/07/alternative-theory-of-gravity-makes-a-nearly-testable-prediction/ <comment><USER2> Fluff piece, light on any interesting details.

<comment><USER3> Seems to be a bunch of words for filler wrapped around one significant paragraph:

"The changes to the gas in the outer region of galaxies [by modified gravity modeling] causes higher densities of gas to form there, which in turn increases the efficiency of cooling of that gas. It turns out that an instrument of the Square Kilometer Array radiotelescope will be sensitive to the altered properties of the gas. As a result, it may be able to pick up any deviations from general relativity."

</comment></comment><comment><USER4> tldr: they simulated the formation of galaxies with general relativity and an alternativ theory and found a property that differs between both simulations and should be measurable with the Square Kilometer Array radiotelescope.

(a nice thing is that this is a general approach that could be used to quickly test and unvalidate alternativ models)

</comment><comment><USER5> "nearly testable" LOL</comment>


Julian Assange's clear and present danger - <AUTHOR> http://www.eurekastreet.com.au/article.aspx?aeid=29449

<comment><USER2> If one believes in a cause very strongly, then, when the time comes when one must stand for it or fold --for whatever reason, then taking the consequences, whatever their basis, is the natural course. It's how the status quo is changed. It's not frequent that one can effect major change without some personal cost.

I think if one is looks into these kinds of disruptions and one believes in them one has to not be naive and think that disruption will have little personal consequence. One can't have one's cake and eat it too, is more of less apt for this.

I'm not saying doing what he did is right or wrong --that's another debate. Belief in the righteousness of one's cause demands one put one's self aside, unselfishly and without self-promotion. One is only a vessel for the idea, at that point, rather than the raison d'estre.</comment>


A Look at the Design of Lua - <AUTHOR> https://cacm.acm.org/magazines/2018/11/232214-a-look-at-the-design-of-lua/fulltext <comment><USER3> I studied at PUC-Rio and I met Roberto Ierusalimschy (the main author of Lua) when he was teaching a course on semantics. I once asked him if I could send a PR about a feature I wanted in the language and he said something that I never forgot: "Yes, but I won't use your code. I love that people send me ideas, but I actually enjoy coding... so I will gladly take your suggestions, though I will write it myself."

He then explained this "dictatorial" behavior is what allowed him to keep the implementation simple and concise over the years. At the time he boasted about the source code being less than 8K LOC, though it has likely increased in recent versions. (I think it was around version 3.) I'd recommend taking a look at the source code, it's truly a C masterpiece.

<comment><USER4> I'm currently a PhD candidate at PUC-Rio. For context, there's a 'meet the researchers' round of seminars during the first semesters mainly targeted towards Master's students (so they can choose an advisor).

Prof. Ierusalimschy's was one of the most interesting seminars in my first year. His passion is apparent in the way he talks about Lua's history and current development. Unfortunately I haven't taken any courses with him

As a side note, it's nice to see folks from around here on HN

</comment></comment><comment><USER5> I've the feeling that Lua became popular mostly based on its implementation, fast, small and self-contained portable C code, and not for the merits of the language itself. Certain things are addressed in Lua 5.3, but in general Lua has several flaws:

\- Before Lua 5.3 there was no integer type, this makes a lot of things harder than needed in programming, unless you just write high level code.

\- Lua trivially departs from standard syntax like ==, !=, zero-based indexes, without good reasons, creating a general feeling of confusion.

\- There was an odd idea about what to include by default and what was optional. The lack by default of bit operations makes the language always in need of a trivial library.

\- Tables as a single data structure are not ideal for many tasks. Especially the dualism between tables that are indexed by sequential numbers and tables acting as maps. It's a lot more kind to your users to give up with the solely academical ideal of "just one data structure", and give programmers at least an ordered and a map data type, or at least come up with something better than that. Lisp attempt at doing most things with lists was much more successful and clean.

\- The stack-based C API is not comfortable to use.

I could continue to be honest, for instance by default you can't type an expression in the REPL and see the value returned. However when the task at hand is to write small scripts for a larger system, the implementation of Lua offers big enough advantages to make it a worthy choice.

<comment><USER6> > _Tables as a single data structure are not ideal for many tasks. Especially > the dualism between tables that are indexed by sequential numbers and tables > acting as maps. It 's a lot more kind to your users to give up with the > solely academical ideal of "just one data structure", and give programmers > at least an ordered and a map data type, or at least come up with something > better than that. Lisp attempt at doing most things with lists was much more > successful and clean._

I have a different view.

Lua tables are the _foundation_ for just about any conceivable data structure in CS. While you can do a lot with raw tables in Lua, you can also use them to build all kinds of things on top of them, like b-trees. Or an object system (which is a popular hobby among Lua aficionados).

There's a limit to what can and should be built into any base language. Trying to wedge in more container types can cause a bit of difficulty, in my opinion. Python is the classic example here, where you have tuples using parens, arrays using square brackets, and dictionaries using curly brackets. At some level that is clever, but at another level it is a cause of confusion.

<comment><USER7> Sorry, but tables are awful in practice. I have to iterate all the elements to get a count? This is especially egregious when I'm using one like a list/array and need to know how far to iterate. Maybe there's a better way I don't know?

<comment><USER8> If you need something quick-and-dirty, you can maintain an extra `["length"]` field on your table to cache that information. If you want something more polished, use a proxy table with custom methods/metamethods mediating access to your array so that the length is properly kept up to date. This isn't terribly different from the situation in C with arrays.

Tables are a basic mechanism for implementing any data structure. That is a qualitatively different statement from saying that tables can _replace_ any data structure. If you need semantics different from what tables immediately provide, you'll need to implement the desired data structure yourself -- but Lua gives you good tools to do that.

> Maybe there's a better way I don't know?

You can use `for i, v in ipairs(arr) do ... end` to iterate over an array without worrying about "how far" to iterate. The `ipairs` iterator will determine when it hits the end of the array.

<comment><USER7> Yeah, this is fine until I want the last element of an array. Then I have to iterate it to find it. And writing a loop to get the last element of an array is crazy-town.

<comment><USER9> Have you actually used Lua? You don't need to iterate to get the last element of an array.

<comment><USER7> I have! I'm not an expert at it, though.

</comment></comment></comment></comment></comment></comment></comment><comment><USER10> Lua is a big reason why I'm interested in both systems and PL today. I started using Lua to build game mods in high school, and I was struck by how simple it was compared with Java, or even Python that I had tried learning earlier. The all-encompassing "everything is a table" paradigm really sparked my interest in the design of systems of computation, and how a broad range of programing patterns could be expressed with a few primitives.

<comment><USER11> You might find Isle interesting ([https://github.com/gvx/isle](https://github.com/gvx/isle)). It is a small programming language I've designed and implemented a couple of years ago heavily inspired by Lua's "everything is a table". In it, a function call looks like a name concatenated to a table literal, and calling a function actually consists of creating that table and using it as the environment for the function.

I still think it contains some neat ideas and concepts, even though I would never actually use it for something practical.

</comment></comment><comment><USER12> Stay away from Lua and use Python, Go, Node, Rust or even C in new projects. This is going to be a lengthy rant for a comment; apologies in advance.

Having written a ton of networking code in Lua I can tell it has a lot of design defects that most other programming languages have avoided. Especially the deeply embedded one-based indexing and lack of a separate integer type (chars are strings, ints are floats) make it wearing to type any code that has to parse any binary data. Even bit manipulation requires going through the FFI. Considering that Lua is often touted as the optimal lightweight solution in small embedded systems, these features are must-haves.

The builtin string pattern matching library attempts to mimic regular expressions, but bites the user in the leg every time they attempt to use it for anything remotely regex-y. Unfortunately most usual string manipulation seems to revolve around them and the string.gsub function.

The inconvenient string library is also largely irrelevant. The developers call their language eight-bit transparent which in reality means that the programmer needs a separate Unicode library, rendering the whole standard string library mostly useless. One cannot even format UTF-8 text, because the string library doesn't differentiate between characters and bytes.

The official documentation mostly revolves around C bindings. The actual Lua language documentation is provided by another web site that looks like it has been written by an attention-deficit child. Instead of getting to the point, the articles often first provide a list of ways on how not to implement things, or they are actually benchmarks of fifteen different ways to call the standard library to get the same effect. Sometimes, the provided code does not even work – for example, the given XML parser code crashes when it hits one of the error paths.

The small runtime and fast VM do not really matter when the language itself is lacking and requires a metric ton of external libraries to achieve even the simplest things that are possible in standard C and Rust, which provide the same level of performance and better type safety.

<comment><USER13> These are quite unfair arguments against Lua, especially since that you seem to be using it for low level networking code and on embedded systems, which are not really Lua's strong points. (Lua is designed to be embedded as per being a scripting interface to C and other compiled languages.)

One based indexing is just a design choice, while it complicates interoperation, I find it justified as Lua tables are actually hash tables, so it would be weird to model it upon memory offsets. It reminds me that I am only dealing with a hashmap with integers as keys.

Bitwise and UTF-8 string operations are lacking out of the box, but these are arguably too specialized to be expected in a general scripting language. The patterns are a little underpowered compared to other languages, but it is still quite useful. I suggest looking into LPEG for more complicated operations. Lua 5.3 do have some functions to deal with UTF-8 codepoints.

Also, regarding Unicode, I'd rather the PL provide only operations on bytes, and let me decide what "characters" are to be represented. Nearly all PL providing some Unicode facilities fail in different ways, just let me deal with ICU myself if I really need Unicode. Also it is a royal pain in the butt to deal with different encodings, with a language having special "characters" and "strings" constructs.

I don't understand the complaint on documentation. It is one of the most practical and clear technical writing that I have seen, if a little terse. Perhaps you mistook the wiki as the main document? (The Lua language manual is an one-page HTML page.)

<comment><USER14> > These are quite unfair arguments against Lua, especially since that you seem > to be using it for low level networking code and on embedded systems, which > are not really Lua's strong points. (Lua is designed to be embedded as per > being a scripting interface to C and other compiled languages.)

If this is true, and I actually agree with you, then where is Lua actually better than an alternative?

And, while I don't share the specific points of the parent poster, I experienced similar issues with Lua. I found that while the Lua core language itself is small, I had to compile in so much extra stuff to make it useful that it wasn't actually small anymore.

And, once you get large enough that you start demanding big ARM Cortex M4 microcontrollers, Python is now in your scope.

<comment><USER15> Running untrusted code to allow modding of games. Suddenly the fact that you have a standard library or a complex language with a large amount of features is no longer a benefit and instead is actually a liability often to the point that you disable the standard library in lua entirely and only selectively load parts of it and write your own modding API to allow modification of the game.

There are entire games built around modding via lua such as gary's mod which similar to a web browser has to download random code from a server. Then there are mods like computercraft/opencomputers for minecraft in which direct file access to the host doesn't make any sense at all because every computer has it's own filesystem.

I just looked up Python's sandboxing capabilities and I can't find anything. All I see is answers like [0] that suggest that it's not trivial.

What about other implementations like pypy that claim to have a sandbox? [1] I can see lots of warnings like "This is not actively maintained."

The lack of mature sandboxing for python makes it impossible to use for the usecases I've described above.

[0] [https://stackoverflow.com/questions/3068139/how-can-i- sandbo...](https://stackoverflow.com/questions/3068139/how-can-i-sandbox- python-in-pure-python) [1] [http://doc.pypy.org/en/latest/sandbox.html](http://doc.pypy.org/en/latest/sandbox.html)

</comment></comment></comment></comment><comment><USER16> For those of you who are interested, I run a Lua newsletter.

The Lua community is small so every bit helps :)

Shameless Plug: [https://Luadigest.immortalin.com](https://Luadigest.immortalin.com)

</comment><comment><USER17> It's worth mentioning the debt Lua owes to Self and Newtonscript. An extraordinary amount of Lua's syntax and semantics is directly lifted from these languages. Newtonscript in particular seems to be a template for a great many of Lua's interesting features.

What drove me away from Lua is its philosophy of providing minimal tools in which it is _possible_ , but never _easy_ or _convenient_ , to do work in various programming modalities. Polymorphism, namespaces and packages, arrays, unicode... these things all can be done, but require significant head-standing and in many cases a lot of boilerplate. Even proto-style OO, which you would imagine would be Lua's signature feature, involves lots of rigamarole compared to languages (like Newtonscript) where it is baked in and elegant.

I kept wanting Lua to pick a pony.

Throughout my usage of Lua, I've consistently gone back to Lisp, where I could change the language to _make_ inconvenient things convenient when I needed to.

<comment><USER18> Maybe it's because I've mostly used Lua as a tool in my homebrew game engine side project, but what you said about their philosophy of providing minimal tools where it is possible to work in different programming modalities is one of my favorite things about Lua.

</comment></comment><comment><USER19> As a developer, I've always liked languages that stress maps/hashes/dictionaries/tables/associative-arrays as their man data structure.

Off topic, but I've always thought that JavaScript and JSON would have been a lot better without the relatively artificial distinction between objects and arrays. Now that there's object shorthand and destructuring, this will never happen, but it was a nice thought for a while.

<comment><USER20> Nobody is stopping you from just using arrays for everything - <USER2> they're also objects.

        const a = [2,3,…]
        a.prop = "hi"

Now whether that's actually something you _should_ be doing is a different matter...

<comment><USER19> I was thinking more along the lines of using "objects" for everything like Lua: let foo = {'a', 'b', 'c'}; .

(Also on my JS wish list: Killing the use of const for anything besides actual constants.)

<comment><USER21> > Killing the use of const for anything besides actual constants

You should be using const for _everything_ besides variables that need to get re-assigned.

<comment><USER19> Heh, I like how you carefully worded that, because normally 'const' would signify that a variable is immutable in just about any other programming language in the world. Except in JS, where const was awkwardly jammed into the language. I guarantee if the spec writers had known how badly const was going to be abused, they wouldn't have added it.

If you want a strongly typed language, go use C or Java and stop making JavaScript incomprehensible to all but the most pedantic developers.

<comment><USER22> > normally 'const' would signify that a variable is immutable in just about > any other programming language in the world

That's not true in Java, C, Ruby, or Perl (with the 'constant' prag-module), not really true in C++ (unless you're careful), and . . . generally just isn't true in most languages.

While a few languages do add recursive immutability properties to their equivalent of 'const', most languages use the idea of a 'constant' only as a means of prohibiting _name re-binding_ , not _data modification_. And even then, many languages that only prohibit const re-binding only do so in an optional (i.e. it's a warning) way.

Many of those same languages do support immutable data structures either out of the box or via popular libraries (though in non-compiled language, such structures often come with a performance cost). They just don't call them const[ant]s.

Edit: I'm also curious about how you think 'const' is being abused in JS. I'm not an expert in the language--this is a genuine question; not a veiled disagreement.

</comment></comment></comment></comment></comment></comment><comment><USER23> To courious web nerds: currently both Nginx and HAproxy have got Lua scripting modules to extend themselves by implementing e.g. customized filtering, routing, caching, proxing, storage etc. One can even build a full featured web app backend in embedded Lua tied to Nginx.

<comment><USER24> Disclaimer: I am CTO of Kong.

If you want to look at a large OpenResty/Lua application from a code perspective you could take a look at Kong[1] - which is the most popular public codebase built on top of NGINX/Lua at the moment.

CloudFlare also uses the same stack but most of their codebase is proprietary.

What really makes Nginx/Lua a good combination is primarily LuaJIT[2] support, a much faster implementation of the Lua VM.

[1] - [https://github.com/Kong/kong](https://github.com/Kong/kong)

[2] - [http://luajit.org](http://luajit.org)

<comment><USER25> What made you choose Lua instead of say, embedding Python into nginx? I can think of a few good reasons like embeddability, code size, simplicity but it would be interesting to hear your take on this.

<comment><USER26> Can't speak for Kong, but I'm currently working on creating a microservice in lapis (using moonscript). The speed of the underlying OpenResty server, as well as lapis ergonomics make this really fun. I guess the only practical reason I can see is the async everything without clutches approach, as well as the truly impressive TTFB.

For me, day 1 productivity is really high, comparable to Nancy, the framework I was using before.

</comment></comment></comment></comment><comment><USER27> Of particular note; LuaJIT can pretty much directly call C libraries. From here:

* [http://luajit.org/ext_ffi.html](http://luajit.org/ext_ffi.html)

        local ffi = require("ffi")
        ffi.cdef[[
        int printf(const char *fmt, ...);
        ]]
        ffi.C.printf("Hello %s!", "world")

So while, say, Python is "batteries included", LuaJIT is "all the batteries".

Using C libraries in regular Lua is fairly easy as well, but LuaJIT is exceptional.

<comment><USER28> > So while, say, Python is "batteries included", LuaJIT is "all the > batteries".

Do you say this because LuaJIT can call shared libraries dynamically? If so, what about ctypes[0]? Is LuaJIT's FFI just easier to use, or does it do something that ctypes can't?

[0]: [https://docs.python.org/3/library/ctypes.html](https://docs.python.org/3/library/ctypes.html)

<comment><USER29> The two most appealing features of the LuaJIT FFI:

1) The syntax. To specify the types of the FFI functions you you use a DSL that is similar to C declarations. Often you can copy paste function prototypes from ".h" files with very minimal modifications. With ctypes you need to specify the types with Python function calls. See "ffi.cdef": [https://luajit.org/ext_ffi.html](https://luajit.org/ext_ffi.html)

2) Performance. If your code is inside a JIT-compiled trace, LuaJIT FFI calls have minimal overhead. They compile down to something very similar to what a C compiler would generate. Ctypes, on the other hand, must "interpret" the FFI calls which adds more runtime overhead (although admittedly this is also true for LuaJIT if your code ends up outside a compiled trace).

</comment></comment></comment><comment><USER30> Roberto Ierusalimschy, et al., on "The evolution of an extension language, a history of Lua (2001)" [1], is an interesting read.

The word "configuration" makes repeat performance in that paper, but oddly is entirely missing from this 2018 paper (by the same authors).

[1]: [https://www.lua.org/history.html](https://www.lua.org/history.html)

</comment><comment><USER31> For game development lua is wonderful. Pico8 uses lua as does love/lua. Both are wonderful tools to write games.

</comment><comment><USER32> While I'm _not_ a developer nor I like lua I'm curious about a thing: what's the difference between for instance Guile scheme?

Because they seems closely similar to me and Guile is _far_ more clear and effective, at least for my programming skills...

</comment><comment><USER33> I'm planning to use tcc as a scripting language. Not sure if it's a good idea, but as long as I don't have to rebuild my code, and as long as it's not slow like most scripting languages, it sounds like it's good enough.

Although I agree it might be difficult to write scripts in C, in the end it might just depend on the core functions that are exposed.

I'm not a fan of C, I prefer python, but I guess I will have less issues when interfacing c code to c++. Python seems quite fat, slow, and too much different than C++.

</comment><comment><USER34> What Lua lacks in terms of performance and broad-scale, low-level library integration can be made up for within the Rust ecosystem where these exist along with a well-built Lua wrapper, rLua.

</comment><comment><USER35> The images appear to be dead..

</comment><comment><USER36> I always perceived Lua of being completely weird, and asked myself why people would ever want to use it. Especially nowadays, where embedded Python is everywhere.

<comment><USER12> On modern embedded hardware, Python is a better alternative in practically every case. If size and computing power are an issue, either investing in better hardware or spending time writing C yields better results.

<comment><USER37> > On modern embedded hardware, Python is a better alternative in practically > every case.

How so? Do you have an example where Python outperforms Lua or uses significantly fewer resources?

<comment><USER38> > or uses significantly fewer resources?

Do you count developer time as a resource?

<comment><USER39> Everyone does, of course, but hardware constraints are a reality, nonetheless.

</comment></comment></comment></comment></comment><comment><USER40> Since the lua authors wrote this article, it can't bring much of a new perspective on Lua</comment>


Beyond CRISPR: A guide to the many other ways to edit a genome - <AUTHOR> http://www.nature.com/news/beyond-crispr-a-guide-to-the-many-other-ways-to-edit-a-genome-1.20388 <comment><USER2> This week's Kurzgesagt episode covered CRISPR in an easy to understand fashion: [https://www.youtube.com/watch?v=jAhjPd4uNFY](https://www.youtube.com/watch?v=jAhjPd4uNFY).

<comment><USER3> And massive reddit thread about it @ [https://www.reddit.com/r/videos/comments/4x1s2k/genetic_engi...](https://www.reddit.com/r/videos/comments/4x1s2k/genetic_engineering_will_change_everything/)

</comment></comment><comment><USER4> The big challenge at the moment is coverage; getting enough of the cells successfully edited by the gene therapy to make a meaningful difference. There are promising signs in mice, such as the muscular dystrophy study from earlier this year [1], but in general this is still an ongoing battle, without a standard approach.

The coverage issue is why you can't go out and get any one of a hundred edits [2] and expect things to happen as a result. As soon as that is robustly solved, well, gene therapies will be out there in the medical tourism market, starting with telomerase, myostatin, and follistatin, I'd imagine. Most likely the second of those up front since its already fairly robustly proven in humans via antibody therapies. [3]

I would be extraordinarily surprised to find that there were no humans already tinkering with their myostatin balance via genes or antibodies, given the number of people with access to the technology, and the ease with which such a therapy could be assembled.

[1]: [http://www.nature.com/cr/journal/v26/n5/full/cr201628a.html](http://www.nature.com/cr/journal/v26/n5/full/cr201628a.html)

[2]: [https://www.fightaging.org/archives/2016/06/a-short-list- of-...](https://www.fightaging.org/archives/2016/06/a-short-list-of-potential- target-genes-for-near-future-gene-therapies-aimed-at-slowing-aging-or- compensating-for-age-related-damage-and-decline/)

[3]: [http://news.iupui.edu/releases/2015/12/myostatin-warden- musc...](http://news.iupui.edu/releases/2015/12/myostatin-warden-muscle- growth.shtml)

<comment><USER5> The biggest challenge with gene editing is knowing what to edit! If you're trying to correct a single base-pair genetic defect, it's more straightforward, but even for something as "simple" as height, we have little insight into what genes control that characteristic nor how to actually modify them.

</comment></comment><comment><USER6> It's nice there are more gene editing methods but this just moves the problem back where it always belonged: delivery of the vector to the cells that matter, and knowing what edit to make are still extremely hard problems. The latter seems to be the ultimate challenge: our current understanding of genomics is still very much stuck in the "the function of a gene is assumed to be the largest eigenvalue of its principle component analysis". In complex, redundant systems with feedback (like the genome and its associated cellular machinery) it's basically impossible to fix an actual problem, with limited side effects, by just modifying a single gene.

</comment><comment><USER7> Ok, so while irrational, what makes this not mean that FOXDIE is about to become a reality?

<comment><USER8> Recognizing one human among seven billion by their DNA would probably take an unwieldy large amount of recognition sequence. Releasing a weapon with a killing payload and letting it be subject to natural selection risks it evolving to kill more people, or all people. In general, bioweapons are scary because they can't by their nature have reliable off switches.

They are also a heap of excessive effort when a sniper rifle or drone missile works fine.</comment></comment>


Show HN: Appdash, an open-source perf tracing suite - <AUTHOR> https://sourcegraph.com/blog/117580140734/ <comment><AUTHOR> Hi all, my name is Stephen Gutekanst and I'm the primary developers working on Appdash at Sourcegraph.

I'll be available throughout the rest of the day to answer questions you might have, I'd also love to hear thoughts on how it can be adapted to fit your needs! :)

</comment><comment><USER2> I haven't used Appdash in any of my projects yet, but I have seen it used and it is neat.

I'm curious how it compares against other similar solutions, can you describe that a little? Is there anything else that's similar? What are the pros/cons of Appdash?

<comment><AUTHOR> The awesome news is that all of the software I'm going to mention all uses almost identical terminology, which originates from Google's Dapper[1].

\- Dapper itself is a closed-source and internal Google project, so you and I can't make use of it.

\- There is something called AppNeta (previously named Tracelytics), a paid service, I haven't ever used it but it was on HN a while back. [2]

\- Most notably is Twitter's Zipkin[3], which is what the rest of my comment will make comparison of (but take note I haven't used Zipkin extensively, I've only researched it).

Zipkin is written in Scala, and Appdash in Go. Depending on which you're familiar with might make your decision between the two easier. A language you know and love goes a long way for hacking on a project.

On a user-interface side; they're both pretty similar. I think Zipkin is getting an aggregated data view sometime soon, but Appdash already has an extensive one with several different viewing modes (see screenshots in [4]).

I don't know Scala too well and couldn't determine during my research how extendable Zipkin is -- but Appdash was designed from the ground up with interfaces providing core logic: this means you can swap out where the traces get stored (in memory, evicted after a certain time, in a database, your own custom implementation, etc), define your own event types with their own meta- data associated with them (an HTTP event has headers, an SQL event has the literal query that was run, your own type could have anything you want, etc).

Appdash has a Python support library so you can generate traces from Python applications, too. This works because it uses Protobuf for communication. We hope support for more languages might be contributed. IIRC Zipkin uses Apache Thrift for communication, but doesn't officially support integration with other languages via libraries.

A really useful feature of Appdash that I think Zipkin doesn't have is the ability to import and export single or multiple traces as JSON from the UI. You can literally copy+paste traces to co-workers, etc, and they can load them up in their own Appdash instance to analyze them if they want.

Perhaps missed among all my discussion of HTTP-esque-tracing-systems is that Appdash is really suitable for analyzing the performance of any application at a high-level (i.e. not micro-benchmarks). If you can time something, want to log something, or have something important with a timestamp on it -- you can just give it to Appdash and it'll display it in a nice UI for you.

[1] [http://research.google.com/pubs/pub36356.html](http://research.google.com/pubs/pub36356.html)

[2] [https://news.ycombinator.com/item?id=3197490](https://news.ycombinator.com/item?id=3197490)

[3] [http://twitter.github.io/zipkin/](http://twitter.github.io/zipkin/)

[4] [https://github.com/sourcegraph/appdash/pull/58](https://github.com/sourcegraph/appdash/pull/58)

<comment><USER2> Thanks for the detailed reply, that really answers my question.</comment></comment></comment>


LA Is Trying to Fix Its Prostitution Problem by Banning Right Turns at Night - <AUTHOR> http://www.thedrive.com/news/24324/la-is-trying-to-fix-its-prostitution-problem-by-banning-right-turns-at-night-and-it-might-be-working <comment><USER2> So the signs are there so that the police have probable cause to stop someone that they otherwise wouldn't have probable cause to stop.

Does anyone else see a problem with making otherwise perfectly legal and safe behavior(turning on to a side street) illegal just to legalize an otherwise unconstitutional traffic stop?

Seems like another slippery slope we ought not to be sliding down.

<comment><USER3> Think of it another way: the locals overwhelmingly agreed to change the rules because they probably understood that while they could adapt to the rule, outsiders probably would not be as well-informed.

Someone making a right turn after hours paints themselves as a potential outsider who doesn't know the rules and, given the location's history, is probably there to solicit sex.

I like that the community was empowered to make this change.

<comment><USER4> The city is empowered to make the change. The court are empowered to overturn it as an unconditional restrictions on our liberty. Specificially the fourth amendment The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things .

<comment><USER5> That just shows how smart the idea is of having a constitution and separating government powers.

And by the way, I guess UPS trucks can't deliver at night now. Stuck between a rock and a hard place mwahaha

[https://amp.cnn.com/cnn/2017/02/16/world/ups-trucks-no- left-...](https://amp.cnn.com/cnn/2017/02/16/world/ups-trucks-no-left- turns/index.html)

</comment></comment></comment></comment><comment><USER6> I live about three miles west of Western between Hollywood and Sunset, a couple of blocks from where Hugh Grant was arrested in 1995. We still have these signs up here, I can't turn onto my street after 11pm.

What I find interesting is that these signs are still up even though the problem they were trying to solve went away many years ago. It seems that there's nobody that looks to undo changes like this—government rarely gives back the freedom it takes away—even if that's simply the freedom to make a turn at night.

<comment><USER7> So ... what do you do if you get home after 11pm?

<comment><USER8> I suspect you can use the grid to enter the street straight or by a left turn. I know in Argentina I have seen weird interdictions like that where we had to loop around the block.

</comment></comment></comment><comment><USER9> There is no "prostitution problem", other than meddling moralizers who want to tell people what they can do with their own bodies. Legalize prostitution, get the government out of the business of trying to control people's bodies, and the "problem" goes away.

<comment><USER10> On the addiction relief program "Intervention" they showed a woman who said that she had to inject heroin immediately before this type of work to make it tolerable, and she also said that she found most disgusting to her was that she had to pretend to enjoy what the clients did to her.

<comment><USER11> If you are really concerned about the horrors of prostitution, I recommend you work on the Glass Ceiling issue in non sex worker industries so women have more real options for well paid work.

<comment><USER12> At what rate do you think women are driven into prostitution because they hit a glass ceiling in their previous line of work?

Versus, you know, never getting off the ground floor?

<comment><USER11> I have six years of college, including a Certificate in GIS. I worked at a Fortune 500 company for over 5 years. The only person at the company who knew what GIS was without me having to explain it was a senior programmer who asked me for a date, thereby making it vastly less likely that I could ever successfully get a job in his department.

I've been a member of HN for over 9 years. I spent nearly 6 of it homeless. I have been quite open about hoping to make professional connections here and thereby improve my finances. I've made damn little progress on that goal. HN has not proven to be a good means for me to network.

While homeless, there were a number of men who offered me money to sleep with them or asked if I needed a place to stay (the implication being I could stay with them in exchange for sex).

I've talked about this many times on HN. If I didn't have a serious medical condition making sex work a non starter for me, I likely would have long ago given up on finding another solution because I'm still dirt poor.

I was one of the top three students of my graduating class in high school and I won a National Merit Scholarship. I don't lack talent. But most men don't really want to talk to me in earnest unless they are looking for a sexual relationship. It has proven to be a tremendous barrier to resolving my financial problems and rejoining the middle class.

<comment><USER13> I've known many more or less unemployable people who started contributing to significant open source projects, and based on that got hired to well paid positions.

<comment><USER11> Thank you. That's both encouraging and a useful tidbit to help me find a path forward.

</comment></comment></comment></comment></comment></comment></comment><comment><USER14> First, they should ask:

Is there a prostitution problem? And what is the prostitution problem?

Is it the problem that prostitution is sinful? Then they could perhaps finally come to the 21st century, and the problem is solved by itself.

Is the problem that prostitution is illegal? That's a self imposed problem, they can just change the law (like other countries and some states/counties have).

Is the problem that society has decided it shouldn't have prostitution? That's valid, I guess, but they should ask to verify whether this is true, before considering it a problem (and before making laws unilaterally. E.g. society apparently didn't consider marijuana to be as much of a problem as lawmakers made it).

Is the problem that prostitution is a dangerous and coercive environment? This stems from it being illegal, and thus unregulated.

<comment><USER15> It seems to me, that legalizing prostitution would be at the top of the issues list for feminism.

Most of the arguments made in support of legal abortion could also be made for legal prostitution.

Furthermore, there is a fair amount of research indicating that legal prostitution reduces occurances of rape.

Although I suppose it would increase "liquidity" in the market, and reduce the value of sex to a certain degree.

<comment><USER16> There is a "real-politic" feminism/feministic view where the goal is to increase the value of women in the sexual market.

The value of goods sold will always be at a higher value when you have a monopoly. Legal prostitution would get men sex for certain at a known cost, whereas taking somebody out on a date is not certain to lead to sex. Keeping prostitution illegal means the monopoly is strengthened.

BTW, here in Denmark, having sex for money is legal, but only the prostitute can make money of of it (directly, anyway), which means that prostitutes can outsource their protection to the police. In Sweden it is legal sell sex, but not to buy it, which means they technically could call the police anyway, but it will destroy their business -- and that the customers they do get are less likely to obey they law and so are more likely to be violent.

<comment><USER17> > having sex for money is legal, but only the prostitute can make money of of > it (directly, anyway)

So how do brothels/"massage parlors" make money? Charge prostitutes? Sell overpriced condoms?

</comment></comment></comment></comment><comment><USER18> Won't this just become learned behavior? A lot of people that use prostitutes are repeat customers, they're just going to learn to not turn right. Seems to me that the turning right only serves to help police ticket or pull over individuals that could even be lost. It's basically like a speed trap that some neighborhoods enact to fund their towns and local police. Eventually it will move from punishing their actual target, to punishing everyone for ticket revenues.

Good luck getting it reversed. If there's one thing government is really good at, it's not reversing bad laws once their purpose has been served, especially if money becomes involved.

</comment><comment><USER17> >the law gave police probable cause for a traffic stop, since plenty of people at first ignored the signs. He added that such violations are especially useful for regular patrol officers, who might not have the training or experience to spot the signs of a potential sex-work transaction.

>"We used to stop cars all the time with the signs in Hollywood. The majority of the time it was residents, but now and again we'd hit someone who picked up a prostitute and catch them in the act

So basically now that LAPD goes fishing more often LAPD catches more fish.

</comment><comment><USER19> America is doing everything it can to run a Prohibition War on Prostitution by driving it further underground and over-criminalizing poor and vulnerable people (with the other 8 million in prison, more per capita than any other country, save Seychelles, and possibly China with the Uygur concentration camps). The moral panic "war" is lost: regulate and let people live. It works in the UK and Europe. Oh yeah, American porn is somehow legal prostitution with a video camera because it's "art" and "professional." Consistency fail too. Maybe start making lots more "porn" that satisfies legal requirements and then the oldest profession becomes legal.

</comment><comment><USER20> I lived in that area of LA for 5 years and wouldn't say it had a prostitution problem. Sure there were some sex workers out, but it wasn't really causing issues. Then again this was before they banned backpage/craiglist

</comment><comment><USER21> I read the entire article trying to find the rationale on why this cuts down on prostitution.

<comment><USER22> They're bringing in a weird traffic rule so the police can selectively pull over whoever they want who happens to make the mistake of falling in their cunning illegal left-turn trap, thus giving the illusion of probable cause for a traffic stop.

<comment><USER21> I see. I was theorizing it cut down on certain circular cruising behavior, perhaps, or the ability to pull off the road to drop off or pick someone up.

<comment><USER22> Yes, it's a bit of a clickbaity title.

Another title could be, "LAPD is trying to misuse obscure traffic laws in order to search people without probable cause".

But I guess that's clickbaity too.

</comment></comment></comment></comment><comment><USER23> It's odd that johns are described as "predation" when prostitutes are the ones who benefit financially and the ones who least want prostitution punished.

</comment><comment><USER24> What is the legal basis for outlawing prostitution? Seems like I've read so many articles about "stopping" prostitution which have merely moved to another form and continued on like this article stated.

<comment><USER25> I'd argue there isn't any legal basis for any law, as claiming so is circular reasoning.

</comment></comment><comment><USER26> This reminds me of when San Fran proposed putting a net on the golden gate bridge in effort to thwart suicide jumpers.

</comment><comment> rv-de I'm from Germany. Maybe that is why I don't get it.

Does "banning right turns at night" mean that it is banned to take a right turn at night? As in not being allowed to enter a crossing street in the right direction?

ELI5, please. Thank you.

<comment><USER27> What is it that you don't get?

From the article: "The idea was to discourage people from picking up a prostitute and pulling into a residential neighborhood to transact business."

</comment></comment><comment><USER28> Looking forward to the army of automated drones patrolling around, checking thermal imaging to catch people in the act.

Cue hundreds of horny teenagers in dismay. /cynicism

</comment><comment><USER29> The GDPR screen is broken, any mirror?

</comment><comment><USER30> Late Stage Capitalism.</comment>


Controversy Fuels 9X Growth for Reddit - <AUTHOR> http://techcrunch.com/2015/08/03/bring-your-pitchforks-and-torches/

<comment><USER2> and the damage control pr starts...</comment>


C2 Programming Language: An Evolution of C - <AUTHOR> http://c2lang.org/ <comment><USER2> Looking at the language, I fail to see a point. It seems to fix things that are slightly nagging, but not real problems with c (lack of real modules, structs, default arguments, integer sizes) while failing to fix the real problems (strings, buffer checks, metaprogramming, type introspection (_Generic doesn't _really_ solve this, and neither does __typeof__(). A slightly enhanced __typeof__() plus a slightly enhanced _Generic might have a shot)).

No more includes/header files seems to imply no more preprocessor, which is a shame because while it may have been hackish, it was one of c's greatest strengths.

> more logical keywords (public/local replaces static)

My friends, have you heard of the wonderous c preprocessor?

        #define func
        #define local static
        #define public

Agree with what comex said about compilation/building.

For a slightly nicer alternative to c, what about zig[1]?

1: [http://ziglang.org/](http://ziglang.org/)

<comment><USER3> Why does no more headers imply no preprocessor.

<comment><USER2> Because #include is a major part of the preprocessor. Because I didn't see any other preprocessor use in the example programs.

<comment><USER4> Maybe they meant that you do not need "permission" from a language to use a preprocessor, and so can use one anyway.

</comment></comment></comment></comment><comment><USER5> From a cursory look at the documentation this interests me, but with one huge caveat: does this support incremental compilation?

The documentation goes on at some length about how the C2 compiler parses and analyzes all source files at once, before generating code. Supposedly this improves compilation speed because:

 _The code generation (and optimization) steps require a lot of time. So if you have 100 C source files and the 99th file has a syntax error, the compiler has to go through a lot of work before showing the diagnostic. In C2 it only takes very little time. So during development, developers never have to wait for diagnostic messages._

Except that during development of C programs, in practice, most changes will only require recompiling one or two files. The rest of the files have already been compiled and don't have to be examined at all until the link step, which is relatively fast.

Admittedly, C is simple enough, and the header file and process-per-source- file models inefficient enough, that the C2 compiler might be able to parse and typecheck 100 files in an amount of time similar to what make and clang take to build two. I haven't tested it, but let's assume so. Then if I have an error, I indeed wouldn't have to "wait for diagnostic messages" (for too long, anyway). And it would be nice that the same speed could be achieved regardless of what I change, whereas in C touching a common header file may well require rebuilding everything. Then again, this fundamentally doesn't scale well.

But what if I don't have an error? With an incremental C build, I don't have to wait to run and test my code, either. If the C2 compiler doesn't support incremental compilation, it'll have to redo code generation for everything, using the same backend (LLVM) as my C compiler. Thus, the 'feature' of compiling everything at once becomes an antifeature.

It is possible to implement incremental compilation in a compiler more 'natively' than C's file-based approach, and this can turn module-at-once compilation from a mixed bag for performance to a pure win. If the C2 compiler has done so, I shouldn't be complaining! But since it's not mentioned in the documentation pages I looked at, I'm guessing it hasn't.

</comment><comment><USER6> If any of you who found this interesting also know Prolog, I am working on a compiled language you should check out (The compiler is written in Prolog).

[https://github.com/GordianNaught/Juicy](https://github.com/GordianNaught/Juicy)

</comment><comment><USER7> With the large number of new languages coming out (and maturing) these days, I've always found it annoying that there's not been a real attempt at a better C. So this is nice to see.

I don't count Rust, because one of the good things about C is that it's quite easy to write a compiler for. A better C shouldn't require a too clever compiler.

Another attempt I stumbled across recently is Zig: [http://ziglang.org](http://ziglang.org)

<comment><USER8> > I don't count Rust, because one of the good things about C is that it's > quite easy to write a compiler for. A better C shouldn't require a too > clever compiler.

Why is that relevant?

<comment><USER9> Maybe one reason is portability? Although the Rust strategy of leveraging LLVM is a good answer, there are situations -- a partial implementation for the sake of analysis, or a clean room implementation for reasons of IP or national security -- where a simple language retains an edge.

<comment><USER2> There _was_ a new implementation of rust in c++ [https://github.com/thepowersgang/mrustc](https://github.com/thepowersgang/mrustc)

<comment><USER9> Yeah but it still needs original rustc for verification (borrow checking).

</comment></comment></comment></comment></comment><comment><USER10> Packaging needs to be improved, especially given that it requires their fork of llvm and clang.

deb/rpm files or at least a PKGBUILD would help make it a lot more accessible.

</comment><comment><USER11> looks solid, but seems to lack a few features I would want in a modern C replacement: if-expressions, tagged unions, immutability by default.

<comment><USER12> Why is imutability by default important to you? Why not just add const to your definition?

<comment><USER13> Why make it easy to use something bad and hard to use something good? The concept of "this variable is mutable" makes more sense than "this variable is constant" anyway; saying that a variable is mutable is like _adding features_ to it (i.e.: the ability to mutate it).

<comment><USER12> The very name "variable" implies changing value. When you define something that doesn't change you are defining a "constant".

I also don't think a mutable variable is bad or hard to use. Is this bad/hard to use?

        for (int i = 0; i < 10; i++)

Or is this bad....

        int line_number = 0;
        char *line;
        while (read_line_from(stdin, &line))
        {
            // TODO handle line
            line_number += 1;
        }

I don't think so. I think much of this buzz about how bad variables are comes from Rust merely existing and no practical examples.

What inherently makes this

        for (mut int i = 0; i < 10; i++)

better than our last example for loop?

If you're actually against mutability where it doesn't need to be you can create tooling that can warn you of where you can add const. I think that's much better.

<comment><USER14> > The very name "variable" implies changing value.

Variables, both in ordinary mathematics and in the semantics of programming languages, are given meaning by substitution, not mutation. This is true even in the semantics of imperative languages[0][1].

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

[1] [https://en.wikipedia.org/wiki/Predicate_transformer_semantic...](https://en.wikipedia.org/wiki/Predicate_transformer_semantics)

</comment></comment></comment></comment></comment><comment><USER15> yet no closures

(arguably, the only thing easy to do in assembler that you cannot comfortably write in C)

</comment><comment><USER16> this really looks like a point on the interpolation between C and Go. not that thats a bad thing.

but assuming that I think they should just have pulled in the type syntax from Go

</comment><comment><USER17> How is struct function different from c++ class member function?

</comment><comment><USER18> Interesting. Deserves far more upvotes.</comment>


Ask HN: NodeJS for large scale projects - <AUTHOR>

We are planning large scale and quite complex project with possible 500k or more users(Well u never know) and considering between two development options Python with Pyramid or NodeJS. So my question would be.. Would you call me mad to take NodeJS for this kind of project? <comment><USER2> Why Pyramid? Why not Tornado, or better yet Tornado on PyPy (if you don't need any non-PyPy-supported libs)?

<http://www.tornadoweb.org/>

<http://github.com/facebook/tornado>

Tornado is Python's best counterpart to Node.js, and was battle-hardened by FriendFeed b/f Facebook bought them. Now used by Quora, among others:

[http://www.quora.com/Tornado-web-framework/Who-are-some- famo...](http://www.quora.com/Tornado-web-framework/Who-are-some-famous-users- of-Tornado)

<comment><USER3> Due to its nature NodeJS is performance-wise still a better solution than any Python-based one, at least for now. And it's async in core and by rule, thus nodejs modules are async too, yet no async-motto is coupled with Python, so it's much harder to get async-ready libs suiting Tornado. Therefore COTS-wise NodeJS is actually also a better solution.

But in the end the most important thing is whether you're more familiar with Python or JavaScript and which solution will be more productive for you. Unless you're going for really large scale project and want to shorten your time by using existing modules, Tornado is obviously as good as NodeJS.

Loosely relevant: <http://amix.dk/blog/post/19484#Comet-with-node-js-and-V8>

<comment><USER2> Right, I know the advantages of Node over Tornado/Python, but my comparison was Tornado vs Pyramid, not Tornado vs Node.

Node makes sense for the OP's brief project description, but if you're also considering Python for a _"Large scale and quite complex project with possible 500k or more users"_ , why Pyramid and not Tornado?

</comment></comment></comment><comment><USER4> My advice here is not to plan for premature optimizing and scaling. Between Python, NodeJS and Erlang you have three options to choose from. However, trying to choose between them should basically come down to your personal comfort level and knowledge with each language.

I am just assuming here - but you will probably not reach 500k users overnight, so building on something which can allow you to maintain a good solid codebase would be more important.

NodeJS is still not stable (relatively speaking to Python), but from my own experience and what I have read, it does scale well. What you have to be wary about is some frequent changes to the API etc.

<comment><AUTHOR> Thanks for good answer, that's what i was thinking. Just had to approve it. Gonna go with python, have good past experience with it and that would be way more safe than risking it with node.

</comment></comment><comment><USER5> I wouldn't choose JavaScript language for a large scale project.

<comment><USER6> Me too, but for me this is just a gut feeling. I guess the OP was more interested in possible justifications for a decision than the decision itself. Can you provide some reasons for what you have said? I would be interested too.

I personally would neither consider Python nor NodeJS for such a project if it was somehow time critical. The reason for this is that I don't know any of those enough to be confident that I could finish the project on time.

So the best advice I can give here would be: If you have a hard deadline that is very close stick with the technology you know better. Otherwise stick with the one that is more fun. I _guess_ that you can resolve any performance problems in both technologies. And when your site starts to take off you probably have to re-write and re-design lots of your code anyway (I don't know where I read this first, but it was a startup that took off).

<comment><AUTHOR> What i did not mention is that it's gonna be quite lean startup, so time is not that big pressure. And Python/Javascript dev time seems quite equal to me while not on big scale, don't know how its gonna be when I would have to scale it up on Node.</comment></comment></comment>


Most of What You Read on the Internet Is Written by Insane People - <AUTHOR> https://www.reddit.com/r/slatestarcodex/comments/9rvroo/most_of_what_you_read_on_the_internet_is_written/ <comment><USER2> I would agree to a certain point, but I wouldn't take the "all people is crazy" too seriously, given the growing number of confirmed to be true -previously tin-foil hat- theories.

Remember the "the government is intercepting EVERYTHING worldwide" from the 2000s? Awesome, I didn't thought it was feasible to do actually, but there are some quite smart(er) folks out there.

Remember that at some point many people knowing first-hand untold no-public truths started to share bits here and there in Internet, that years later were confirmed -with solid evidence- by themselves or other people.

</comment><comment><USER3> Ironic that this post is coming out of the Internet-Rationalist movement, which IME the participants are infamous for putting out huge amounts of written content of questionable merit.

I'm not exactly sure what the relevance of the producer/consumer ratio is, especially for digital content. There are popular people with hundreds of millions of fans. There are active bloggers with 0-10 monthly readers.</comment>


The Set of Prime Numbers (2007) [pdf] - <AUTHOR> http://arxiv.org/pdf/0709.1539v1.pdf

<comment><USER2> Summary of paper:

All n = 0, 2, 4 mod 6 are divisible by 2. All n = 0, 3 mod 6 are divisible by 3.

Thus all primes are either 1 or 5 mod 6.

If n is composite and 1 mod 6, n = pq with p, q > 1 such that both p and q are both 1 or both 5 mod 6.

If n is composite and 5 mod 6, n = pq with p, q > 1 such that (wlog) p is 1 mod 6 and q is 5 mod 6.

What remains are the primes.

You have to look a little bit deeper than arithmetic modulo 6 if you want to say something interesting about the primes!

</comment><comment><USER3> This seems like... maybe "crankery" isn't the right word, but certainly something overblown in that ballpark.

The claim is made "We obtain for the first time an explicit relation for generating the full set P of prime numbers smaller than n or equal to n", but the rule ultimately boils down to just "A number is non-prime if it is either divisible by 2, or divisible by 3, or the product of two numbers which are neither divisible by 2 nor divisible by 3", which is completely trivial.

(Also, the author was apparently attempting to patent this insight, as noted at the bottom of the first page. You know what? I've changed my mind. I'm going to happily call this "crankery". Well-LaTeXed crankery, but crankery nonetheless...)

<comment><USER2> They even threw in a reference to a fields medallist on page 1 just to alert everyone that it was crankery.

</comment></comment><comment><USER4> So if you have some lookup tables you can determine if a given number is prime. Up to some maximum based on the size of the tables. And apparently the time to generate the tables is quadratic in the size of n? Why is this relevant? AKS shows that determining if n is prime can be done in polynomial time - polynomial in log(n), not n. Is there something significant about these 2 sets of primes they talk about?

<comment><USER2> You mean O(sqrt(n)), not quadratic. And given that the most obvious algorithm there is (check every possible divisor up to sqrt(n)) is O(sqrt(n)) arithmetic operations, I think it is fair to say this is not an important result.

I suppose it is a constant factor better than sqrt(n). But tricks along these lines go back to Gauss, at least.

Edit: ah I see, _they_ claim O(n^2). Well I've never had an O(n^2) primality test before. I will put that in my kit of "do-not-ever-use-this" tools, just in case all my other ones break.</comment></comment>


Nightcode: An IDE for Clojure and Java - <AUTHOR> http://nightcode.info/ <comment><USER2> This seems to be the blog post about it: [http://www.marshut.com/sspkm/nightcode-an-ide-for-clojure- an...](http://www.marshut.com/sspkm/nightcode-an-ide-for-clojure-and- java.html)

It's nice to see people getting passionate about this sort of thing, but it's incredibly alpha, and atm it doesn't seem to have any features worth writing home about. At least, not from what I could tell after playing around with it for a little bit.

<comment><USER3> I'm the creator of Nightcode, and I agree, which is why I didn't announce it here. It is pretty half-baked and I was hoping to fix some of the more obvious bugs before promoting it more. That being said, I can't really complain.

<comment><USER4> Any plans for Clojurescript support?

Also, is it just me or is every new editor/IDE using that same Sublime-ish colour scheme?

<comment><USER5> If you are wondering about Clojurescript support, just take a look at the screenshot ...

<comment><USER4> Oops, I hadn't looked - I haven't played with Clojurescript yet, but it's on my list.

</comment></comment></comment></comment></comment><comment><USER6> I see this (very cool-looking) IDE has one-click Clojure Android project skeletons. I'm in the midst of Android development, and find that Java is slowing me down more than I would have anticipated. I just can't sketch out ideas like I do in scripting languages. So my question is: how is Clojure on Android these days? I know that historically, it's had some performance issues. Are these getting better? Is interaction with the Android API pretty seamless?

I'm half-tempted to use Nightcode just to spare me the pain of trying to set up a Android project using Clojure. If any of the previous non-Java languages I've used on Android are any indication (Python and Lua, mainly), it's a huge pain in the ass. I really wish Google had built a more polyglot-friendly environment in Android.

<comment><USER7> This seems like the place to start. [https://github.com/clojure-android/lein- droid](https://github.com/clojure-android/lein-droid)

</comment></comment><comment><USER8> This is amazing.. The greatest thing you have done ( I havent checked out the whole IDE yet ) is to reduce the whole step of setting things up down to 1 click.. The biggest gripe I had with Clojure / Cljs was the setup process.. I am not familiar with the java world and I hate setting things up before getting my hands dirty. This sir, does everything for me.

Just wow! and thank you.

<comment><USER9> If you're looking for a Clojure IDE, you should check out Light Table: [http://www.lighttable.com/](http://www.lighttable.com/)

<comment><USER10> Although I agree that LightTable is a more polished clojure IDE, it doesn't do the one thing that ganarajpr mentioned: create lein projects for you through the UI.

Even though lein is easy to use, integration like this lowers the barrier to entry for new folks wanting to learn clojure, which is awesome.

<comment><USER11> Doesn't anyone else find it odd that command-line tools would be a barrier to entry for _programmers_? Sure, I see it all the time; I just don't get what people are expecting.

</comment></comment></comment></comment><comment><USER3> I just released 0.0.2, so those who are having issues with running and building on 0.0.1 may have better luck this time. It also now correctly uses command instead of control for keyboard shortcuts on OS X.

As I said before, it is still a very early release, so please let me know about other bugs you find.

</comment><comment><USER12> I'm using IntelliJ which has so far been great for great for Clojure and Java plus every other language I use. I'm definitely willing to give this a shot and I also want to know if you're looking at doing any Scala support?

<comment><USER13> I'm in the same boat - I've been a very happy IDEA user for over a decade now, and any other IDE that targets the JVM has a pretty high bar as far as I'm concerned.

With that said, I'd _love_ to see the Scala equivalent of this - the Scala plugin for IDEA works fairly well (they still have quite a few problems with inline error highlights/parsing when your Scala code uses path dependent types), but the Typesafe official Scala IDE uses Eclipse, which utterly rules it out as far as I'm concerned.

A lightweight but functional Scala-native IDE with builtin sbt support would be absolutely awesome for a pure-Scala project.

<comment><USER14> I write Clojure and Scala, Clojure got me into Emacs and then Emacs+Ensime led me away from IDEA for Scala development. I recommend it fully.

I am a big fan of IDEA and use that for Java and Groovy, and also Jetbrains' AppCode for Obj-C development, but the Scala support in IDEA is currently just not good enough.

<comment><USER12> How is AppCode compared to xCode? Everyone has been telling me I need to make the switch but I don't want to break any of my existing iOS projects.

<comment><USER14> I can't really give you a fair comparison, I've only used Xcode enough to know that I don't like it.

I don't even think the full switch can ever be made. Because it's Apple development, everything is in an "Xcode project" (instead of, say, "iOS project"). So even using AppCode I'm still dropping back to Xcode some of the time.

</comment></comment></comment></comment></comment><comment><USER15> Would this be a good resource for learning Clojure for someone who's a rather inexperienced programmer? I remember looking at Leiningen a while back and being a little lost. I've heard really good things about Clojure and functional programming in general but I still have my programmer training wheels on.

<comment><USER16> Re: learning resources, I found the book "Clojure Programming" by Chas Emerick, Brian Carper, and Christophe Grand to be excellent.

[http://www.clojurebook.com/](http://www.clojurebook.com/)

After reading through that, the exercises at [http://4clojure.com/](http://4clojure.com/) helped me to solidify things and learn what the core library has available. Work through a problem on your own and then check out how someone like 'immo' or 'jbear' did it.

</comment></comment><comment> test-it How does it compare to Emacs, Idea and Eclipse?

I've been planning to learn a modern (compared to Interlisp, which I used in the 80s) Lisp for a long time. What stops me is the need to 1st learn a very complicated IDE.

I'm also having some doubts about Clojure compared to true Lisps - those store all data as lists for a very good reason - it allows fantastic code reuse.

<comment><USER17> About your last point, Clojure's seqs enable code reuse. You can operate on lists, vectors, sets, maps, etc as seqs. I don't know about Interlisp, but Common Lisp does not unify these datatypes under such a common sequence abstraction.

<comment><USER18> >I don't know about Interlisp, but Common Lisp does not unify these datatypes under such a common sequence abstraction.

[http://www.lispworks.com/documentation/HyperSpec/Body/c_sequ...](http://www.lispworks.com/documentation/HyperSpec/Body/c_sequen.htm)

[http://www.lispworks.com/documentation/HyperSpec/Body/t_seq....](http://www.lispworks.com/documentation/HyperSpec/Body/t_seq.htm)

[http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.65....](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.65.1604&rep=rep1&type=pdf)

[https://github.com/sbcl/sbcl/blob/master/src/pcl/sequence.li...](https://github.com/sbcl/sbcl/blob/master/src/pcl/sequence.lisp)

EDIT: Some actual problems [http://ilc2009.scheming.org/node/7](http://ilc2009.scheming.org/node/7)

<comment><USER17> Yes, I had Rhodes' work in mind. In Common Lisp, sequences are hardcoded as lists and vectors. [1] Which excludes the sets and hashtables (which I mentioned), not to mention anything sequence-like which users might come up with. (Actually, it doesn't even have sets built in. I've seen people use degenerate hashtables to simulate them — keys which just hash to true.)

Furthermore, the by far most common mapping functions operate only on proper lists, not sequences. [2] And in the very popular (albeit notorious) LOOP macro, one must even use in/across/"k being the hash-key using (hash-value v)", depending on whether you're operating on lists, vectors or hashtables respectively! [3]

(Of course, one could add these things to CL, in the sense that you have all of CL's power in C — by implementing CL atop C. Or you could invent your own generic seq functions, and hope others use it.)

Someone could point out that had CL's standard had continued to evolve, it might've had these things. Or that these limitations were due to weaker computers. But whatever happened happened, and this is the real-world CL we have. CL's a wonderfully powerful language (not counting the troll-dominated community), but there's seams.

[1] [http://www.lispworks.com/documentation/HyperSpec/Body/26_glo...](http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_s.htm#sequence)

[2] [http://www.lispworks.com/documentation/HyperSpec/Body/f_mapc...](http://www.lispworks.com/documentation/HyperSpec/Body/f_mapc_.htm)

[3] [http://www.unixuser.org/~euske/doc/cl/loop.html](http://www.unixuser.org/~euske/doc/cl/loop.html)

<comment><USER18> " But whatever happened happened, and this is the real-world CL we have."

Some of my links were there to point out that it's not really, we do have extensible sequences in SBCL for example.

Thanks for making such a long reply for what basically was link dumping.

</comment></comment></comment></comment></comment><comment><USER19> I am unlikely to witch my Java IDE away from Netbeans and unfortunately Netbeans does not have any support for Clojure. (Enclojure is dead).I wish someone would would develop a Clojure plugin for NB. That would solve a real problem for those gently switching to Clojure.

<comment><USER20> IDEA shouldn't be too foreign to you, and I'm pretty sure the clojure plugin runs in the free community edition.

</comment></comment><comment><USER21> I like the idea and might contribute to the source.

I have the feeling the response to keystrokes is somewhat delayed? Type "asdf" for example and you will set it takes perhaps 1.5x more than it should and its not even.

</comment><comment><USER22> there are quite a few editors to code in clojure and I don't see how you can differentiate from the others, but good luck, it looks promising. I personally use macvim/vim.

<comment><USER23> Are there really that many Clojure IDEs available? I suspect you're conflating IDE and text editor.

<comment><USER24> I think the only major one is the IntelliJ plugin (though SLIME is a sort of marginal case).

<comment><USER25> don't forget the Eclipse plugin Counterclockwise: [https://code.google.com/p/counterclockwise/](https://code.google.com/p/counterclockwise/)

</comment></comment></comment></comment><comment><USER26> Hey, this is awesome. I've never been able to get too far with Clojure because of unfamiliarity with tooling and lack of desire to setup Emacs/Slime.

<comment><USER27> Emacs + nrepl if properly set up is really the killer combo. You get instant popup-style access to documentation, auto-complete, repl and unit test integration.

with paredit the ( ) handle themselves pretty much.

I wrote up some notes on setting it up here:

[http://crucialfelix.github.io/clojure/2013/05/16/learn-by- wr...](http://crucialfelix.github.io/clojure/2013/05/16/learn-by-writing-in- the-repl/)

</comment></comment><comment><USER28> I am getting : "Error: Could not find or load main class nightcode.lein" when clicking "Run" in ClojureScript, v 0.0.3.

</comment><comment><USER29> This looks exciting. The Android integration is really attractive to me. I'll be sure to try this out soon. Thanks, gw!

</comment><comment><USER28> I can't figure out how to use/find templates ...</comment>


Interactive World History (2000 BC to 2000 Ad) Using Wikidata - <AUTHOR> https://chronas.org <comment><AUTHOR> A summary of the project with an intro video and image gallery is here: [https://www.producthunt.com/posts/chronas](https://www.producthunt.com/posts/chronas)</comment>


An Ultimate Checklist on Productivity and Getting Organized - <AUTHOR> https://www.reddit.com/r/getdisciplined/comments/528n3w/method_an_ultimate_checklist_on_productivity_and/ <comment><AUTHOR> I have compiled an exhaustive list of ideas to get more productive. It runs into 10,500 words.

Kindly give me a feedback on anything you feel that's missed in this, something you don't agree with or something that requires elaboration.

</comment><comment><USER2> Thanks, will read this and give more feedback to you, but looks solid</comment>


Tata Introduces Flatpack Nano House: 215 Square Feet For $720 - <AUTHOR> http://www.caradvice.com.au/128924/tata-announces-worlds-cheapest-flatpack-house/ <comment><USER2> The picture in the article is the same picture as every article I've googled for (thanks Web for the homogeneous content </snark>), is the wrong picture. The article correctly notes that it is for another project.

But what irks me is that, if a company comes out and says that they have a revolutionary idea, please supply a picture of a prototype or something. Google Image search isn't bringing anything up.

<comment><USER3> They also appear to have stolen the image from someone else and cropped off the attribution in the bottom-right corner. Classy.

<comment><USER4> The attribution text (partially visible) suggests the source to be CarAdvice.com. Interestingly, the image on attributed caradvice.com article has same image as the one in the linked article. CarAdvice in turn seems to have taken image from another blog[1] (as linked in the article) and added the attribution.

[1][http://blog.miragestudio7.com/affordable-mass-housing-in- ind...](http://blog.miragestudio7.com/affordable-mass-housing-in-india/3235/)

</comment></comment></comment><comment><USER5> [http://www.dnaindia.com/money/report_after-nano-tata- plans-r...](http://www.dnaindia.com/money/report_after-nano-tata-plans- rs32000-house_1566154)

its old viral news, never happened, the project was put on haitus.

</comment><comment><USER6> If you like this, you should watch the documentary on the tiny home movement:

<https://www.youtube.com/watch?v=lDcVrVA4bSQ>

</comment><comment><USER7> Article is from 2011. I think by default articles which are not from the current year should be noted in the title.

</comment><comment><USER8> This is great. I think that in general home construction should be more modular.

The really hard part though is buying the land.

Are there any municipalities in the world where the space above the ground and below the ground are subdivided for private property? I.E., two people may own land in the same area but at different elevations, or maybe one person underground and other above ground.

<comment><USER9> Do condos count? I know you buy them but I'm not sure on the details.

<comment><USER8> Oh, right. Dunno.

</comment></comment></comment><comment><USER5> <http://www.300house.com/>

check this out, for a continued process.

</comment><comment><USER10> On a related note, here's a TED talk on automatic house building: <http://www.youtube.com/watch?v=JdbJP8Gxqog>

</comment><comment><USER11> 1) Is there a real picture of this thing?

2) Is it legal?

2a) Or will the real-estate lobby go Uber at it?

<comment><USER12> Concerning 2/2a: Many places in the US enforce a minimum square footage for real/permanent homes, some places 1500-ft^2 for new construction (appalling, I know). I imagine this might be useful/legal for people wanting to drop a temp shelter to occupy while building on-site (often with time limits imposed -- one county I personally inquired with was 6 or 12 months). For _really_ remote or lax places, a wink and a nod to your county inspector/engineer might result in near-indefinite time for your construction project, but in very few places this will be a legal permanent, full-time residence.

<comment><USER13> Tata is an Indian company, so they probably intend to sell these houses there, not in the U.S.

<comment><USER12> Oh, I know. However, it seems that whenever one of these super-cheap technologies from abroad are announced, many folks from the US wonder if it would be available/legal here.

</comment></comment></comment></comment><comment><USER14> You can get a 112 square foot tent for $60.

Doesn't mean you would want to live in it.</comment>


Google kills its Twitch killer - <AUTHOR> https://arstechnica.com/gadgets/2019/05/googles-killing-the-youtube-gaming-app-this-week/ <comment><USER2> Pretty much from the moment Google announced Stadia, people were cracking jokes about when it was going to be shut down.

This doesn't exactly inspire confidence that Google is "all-in" on gaming. To be honest, I doubt Microsoft and Sony have much to fear.

<comment><USER3> They aren't lying. To Google's credit, at least they don't let applications that don't work linger.

</comment></comment><comment><USER4> It is so unlike Google to kill a project like this...</comment>