EU says new cars must include built-in speed limiters - <AUTHOR> https://www.telegraph.co.uk/news/2019/03/26/every-new-car-built-may-2022-must-capable-housing-in-built-breathalysers/ <comment><USER2> If we had a culture where killing people with your car, even accidentally, was viewed as similar to killing people with [other implement, gun, etc.] even accidentally, this wouldn't be necessary.

Imagine it - person wants to go bird hunting, and the local school is great hunting grounds. A kid gets killed by some stray buckshot, and they get a fine and increased insurance costs.

But we let people operate deadly devices right by streets (you know, the things made for walking until ~100 years ago), schools, parks, etc. and _even when their irresponsibility kills people_ the punishments are tiny. The only exception seems to be alcohol - but just being an idiot driver is fine.

I strongly dislike the privacy implications and nanny state here. But not as much as I dislike ~60,000 dead people a year. Besides, if you carry a phone (or licence place for that matter) you've sacrificed all your privacy anyway.

And really, it's more deaths than that, due to excess pollution (both air pollution and sound pollution).

<comment><USER3> > A kid gets killed by some stray buckshot, and they get a fine and increased > insurance costs

Killing someone in a car accident where you're to blame will result in a suspended prison sentence at the very least. It's called vehicular manslaughter unless you were obeying the laws and what happened was not intentional or reasonably preventable. Like if someone falls out of a tree under your wheels. So the comparison doesn't stand.

<comment><USER2> Drivers are rarely held to blame, though. [https://www.nytimes.com/2013/11/10/opinion/sunday/is-it- ok-t...](https://www.nytimes.com/2013/11/10/opinion/sunday/is-it-ok-to-kill- cyclists.html)

<comment><USER3> This doesn't seem to be my experience in most of Europe. Actually in some countries the driver might even be held responsible for cases when someone jumps in traffic from between cars parked on the side of a road.

Edit, from the article:

> there is something undeniably screwy about a justice system that makes it de > facto legal to kill people, even when it is clearly your fault, as long > you're driving a car and the victim is on a bike and you're not obviously > drunk and don't flee the scene

If true it's actually shocking that any civilized country would have this system.

<comment><USER4> A study in Australia found a sizeable percentage of car drivers do not believe cyclists to be full human beings.

[https://www.bostonglobe.com/news/science/2019/03/27/australi...](https://www.bostonglobe.com/news/science/2019/03/27/australian- study-some-car-drivers-say-bikers-aren-completely- human/pnZ779ml6nY53bduYwx8rI/story.html)

<comment><USER5> As an Australian, I can confirm this. It's not necessarily their fault, but cyclists are extremely irritating for drivers, and an outright danger in some cases. Due to our road designs being mostly car-centric and our laws, it is hard to share the road with them.

We are required to give 1 metre clearance when driving at < 60km/h, and 1.5m at 60km/h or over. If it is no other lane available and we cannot cross the dividing line due to oncoming traffic, we are forced to reduce our speed to that of the cyclist (which often means halving it or more) until we can overtake them safely.

The government is attempting to retrofit bike lanes, but this does not remove the requirement to give space, and the lanes are co-located with parking spaces, which forces cyclists to move back onto the roads. This also leads to a lot of mirrors being damaged, mostly accidental but some cyclists brag about damaging cars that regularly park in the same place and block bike lanes. This leads to a lot of resentment from car owners.

As an aside, cyclists are also allowed on our footpaths, and this has led to quite a lot of pedestrians being injured by cyclists colliding with them at speed.

I could go on about this at length, but the point is that there is a considerable amount of frustration, resentment, and anger towards cyclists.

One of the major bones of contention is the government refusing to require the registration of bicycles for road use (number plate) as it would discourage bicycle use, which would be at odds with the government promoting it for health benefits. But I know multiple people who've been injured or had there cars side-swiped by cyclists, and have no recourse due to being unable to identify them for a police report.

<comment><USER2> colocated with parking spaces???

Can you imagine doing that with a general traffic lane? "Oh here's your motorway btw there might be cars parked in it"

That's worse than no lane at all.

<comment><USER3> The problems with cycling is that the riders have both far more "flexibility" in what they can do and get away with, and that many have zero "legal" qualification to practice the activity. I say this as both a regular (daily) cyclist and driver, and I find the 2 points dangerous to myself in both these functions.

So the first point means many cyclists will just choose what kind of participant to traffic they are at each moment: they will behave like a car or pedestrian as they please, following car rules, pedestrian rules, or personal rules depending on which fits them best. And not having a driver's license to suspend means the rules are usually written on the spot. Traffic lights, stop signs, are just informative. So many cyclists insist that requiring them to wear a helmet is "victim blaming". [0] Not many would say the same about not wearing a seatbelt.

For the second point, the lack of any formal education equivalent to a driving school where you are told about the laws and best practices translates into people being blissfully unaware when endangering themselves and others. Most pedestrians and drivers will know the rules even if they don't follow them. They are taught in school and sometimes from a young age. Cyclists fall in the middle, neither this nor that.

[0] [https://www.dw.com/en/german-bike-helmet-ads-labeled- stupid-...](https://www.dw.com/en/german-bike-helmet-ads-labeled-stupid-and- sexist/a-48044927)

<comment><USER2> The problem with helmet laws is that it then means if you kill a cyclist who's not wearing a helmet, people (even erroneously) apportion some blame to the cyclist.

After all, why don't drivers wear helmets? Head trauma kills plenty of people in car crashes.

Give it time, and eventually you start seeing people picked on while they're walking, too. Our minister for transport wants to make it illegal to walk at night without wearing a high vis vest.

[https://www.kildarestreet.com/wrans/?id=2017-10-03a.1396&s=t...](https://www.kildarestreet.com/wrans/?id=2017-10-03a.1396&s=term%2C+I+am+exploring+whether+the+wearing+of+high+visibility+clothing+is+better+achieved+by+way+of+educational+and+publicity+campaigns+run+by+the+Road+Safety+Authority#g1398.r)

Maybe instead of forcing everyone to dress like clowns, just don't hit people with your car. Also, note that the safest places in the world for cycling (Netherlands, Denmark) have very low helmet usage. They DO, however, have presumed liability laws, meaning that the operator of the more dangerous vehicle is presumed liable in a crash.

<comment><USER5> Having presumed liability laws sounds dreadful - you can really follow all the road rules and still be found guilty, because a "less dangerous" vehicle crosses your path and causes an accident?

Australian road rules are quite reasonable - all parties have a duty to try and avoid accidents, but for example if a bicycle exits a footpath onto a lane where you have an existing right of way and hit them, they would be at fault for failing to give way, and also because any action that causes a vehicle with right of way to change their behaviour can be considered dangerous driving

<comment><USER2> Presumed liability doesn't mean drivers are _always_ at fault, but it does mean that the person operating the more dangerous vehicle has a higher burden of proof.

If you operate a car on a city street where you _know_ there might be kids running in to the street, then _you_ are the one introducing an element of danger, not the kid. Similarly, if you drive by a child walking down the sidewalk (pavement, walkway, depending on where you are), you should slow down to aid in stopping on the off chance that child runs in to the street. Even if it's your right of way.

Similarly, a cyclist might hit a pothole and fall, etc. and the reality is that a slight scratch on your bumper will be death to them, so you have to be more careful.

100, 110ish years ago, streets were full of people walking, horses, etc. It would be ridiculous to say "well I had the right of way so I killed that street vendor in my way". But enough drivers killed enough people using the street and we decided to say it was the fault of the person using the street as people had for millenia.

That, of course, makes driving less convenient - but then, cars make walking and cycling massively inconvenient and we seem OK with that. Also, for situations where you need long, uninterrupted stretches of high speed motoring, limited access roads (aka motorways) exist, and there it's reasonable not to expect pedestrians, cyclists, jaunting cars, etc.

<comment><USER3> > the person operating the more dangerous vehicle has a higher burden of > proof.

Which many times means you are basically guilty by design. Witnesses may be hard to come by and they are unreliable in all regards (memory, understanding of what happened, honesty), and unless the country accepts dash cam videos and you have one installed it means you're pretty much screwed as a driver.

</comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment><comment><USER6> It will just alert the driver not actually limit. [1]

Many systems already exists like that. Even simple ones which you can set by hand to a specific speed and it will beep when you go over.

[1] ""The Commission wanted to make it compulsory that the car would automatically slow down to observe speed limits but we have secured a compromise where the system merely has to alert the driver that he or she is speeding," said Daniel Dalton, the Tory MEP for the West Midlands."

<comment><USER7> > The speed limiter device, called intelligent speed assistance, or ISA, uses > GPS data and sign recognition cameras to detect speed limits where the car > is travelling, and then will sound a warning and automatically slow down the > vehicle if it is exceeding the limit.

[https://www.theguardian.com/world/2019/mar/27/all-new-uk- car...](https://www.theguardian.com/world/2019/mar/27/all-new-uk-cars-to-have- speed-limiters-by-2022-under-eu-plans)

<comment><USER8> My Volvo has sign recognition, and although it is quite good, it frequently gets it wrong. It will pick up signs on the back of lorries/buses, as well as signs for i.e. a neighborhood (5kmh) without subsequently picking up the fact that I have moved out of that area, and am now allowed 50kmh. If this erroneous behavior would translate to limited speed, I'd be extremely unhappy.

</comment></comment></comment><comment><USER9> It is surprising to me how many here are okay with nanny state policies like this, yet are up in arms any time government tries to do anything that limits our digital freedoms.

I know this doesn't limit freedoms, per se, since it's already illegal to speed. But I find something about it deeply troubling.

</comment><comment><USER10> Why not enforced collision detection? Presumably that will prevent more accidents than alerting for speed will.

Most manufacturers seem to have these systems already (even if they're reserved as optional extras / high end models) - and it seems crazy that this wouldn't be the first safety measure to apply.

Edit: Seems this story has been moderated: [http://hnrankings.info/19498747/](http://hnrankings.info/19498747/) @dang - any idea why? Seems a few stories about EU regs, but this is focusing on motoring.

<comment><USER11> The bills will also include forced automatic emergency breaking/collision detection.

<comment><USER10> Ah nice! Thanks for enlightening me. That should be the headline (and in the article at the very least)!

</comment></comment></comment><comment><USER12> Non issue. This is just haptic feedback when you get to the limit. I hope it does log the speed as well as the last two accidents on the road I live on people were killed by idiots doing 40+ mph in a 20mph limit.

What is a problem is fixing this shit when it breaks. Which it will because it adds to the bottom line cost of the vehicle so will be done by the lowest bidder.

<comment><USER13> If it is just haptic it's OK but the talk was at least in media that it would be an actual speed limit which in current implementation is idiotic.

We have a new car which can read speed signs. In theory good idea. But tech isn't where it should be. For example when you drive on highway 100 km/h with 130 km/h speed limit and the car is warning you that you are speeding because it saw speed sign for 40 km/h on exit ramp it's a little worrying if car would actually obey speed limit. Breaking from 100 to 40 for no reason by car itself would not be good.

And there are also speed signs for only some vehicles which I don't think any car can read and for example Austrian signs (30 km/h limit and then subtext "valid only for side roads"). And another thing speed signs says limit is 50 km/h. It is valid up to next intersection. Intersection that invalidates speed limit is defined as intersection with more then 4 housing units. It's sometimes hard for human to know if intersection invalidates speed limit or not. How would a car know?

</comment></comment><comment><USER14> Built in breathaliser is a horrible idea.

(1) It's an unnecessary limitation on personal freedom.

(2) It's a burden to people with lung issues.

(2a) It introduces the possibility or infectious disease spread, because people share cars and are less likely to clean the breathaliser frequently enough to prevent bacterial buildup.

(3) These things are garbage and often don't work the first time, especially in the cold.

</comment><comment><USER15> Right, so minor speeding is practically never a contributor in accidents. In accidents where speeding was the cause it's typically not minor, i.e. someone going 180km/h at 80km/h road.

I really like the current state of affairs here in Germany where speeding is a minor office until around >40km/h at which point you'd get a 1 month driving ban. This means that when the traffic conditions permit you can easily go that 10-20km/h faster and no harm done. (This applies to landstrasse)

FYI here's a table describing the fines for speeding: [https://www.bussgeldkatalog.org/german-driving- laws/](https://www.bussgeldkatalog.org/german-driving-laws/)

I bet in reality this is just about some instance wanting to have mandatory GPS tracking in the vehicles for their own malicious purposes.

</comment><comment><USER16> UK MEP:

"It is true that cars built in Britain will have to carry these safety systems and standards if they are to be exported to the EU," Mr Dalton said. "But we have also secured improved rules"

Its almost like having a seat at the table, for your biggest export market is a good thing.

<comment><USER17> If you were a Brit opposed to these speed limiters, surely you'd prefer "EU speed limiters not needed in britain" to "EU speed limiters needed, but with improved rules" ?

<comment><USER16> True, buts that's a separate issue to having a say on the rules of countries you're trading with.

Plus you could replace Brit and Britain with EU (citizen) and it would still be as true.

</comment></comment></comment><comment><USER18> I really dislike the prospect of more software in cars.

</comment><comment><USER19> A sensible stepping stone towards full autonomous driving in the few remaining years/decades that we are actually still allowed to risk each other's lives on the road by driving ourselves. Once this stuff gets good enough, I expect insurance and liability to make non automated driving increasingly more expensive and restricted.

Obviously this plan will have a few hurdles to take before it becomes law. Also, I expect e.g. the German car lobby to not like this at all as they do like their no limits stretches of autobahn here.

</comment><comment><USER20> Good. People have been driving too fast for too long. Too many people die in car crashes. Speed is often the factor that determines whether you (or the pedestrian they're hitting) lives or dies. Drivers have had plenty of time to moderate their own behaviour, but they haven't. If they can't behave, they should be forced to behave.

<comment><USER21> Speed is one factor but not everything:

\- Speeding

\- Driving under the influence of alcohol and other psychoactive substances

\- Nonuse of motorcycle helmets, seat-belts, and child restraints

\- Distracted driving

\- Unsafe road infrastructure

\- Unsafe vehicles

\- Inadequate post-crash care

\- Inadequate law enforcement of traffic laws

</comment></comment><comment><USER22> >The alert system will ensure drivers observe speed limits through GPS and road sign recognition cameras.

So all new cars track you and can track others on the road as well?

Perhaps I am irrational nut but I always dislike state and technology taking away agency from me.

</comment><comment><USER23> I can already see it happening. My car will randomly decide it is actually a truck and slow down to 80km/h on a highway with a 130km/h speed limit and then I get a fine in the mailbox.

</comment><comment><USER24> This article is based on this press release from the commission [http://europa.eu/rapid/press- release_IP-19-1793_en.htm](http://europa.eu/rapid/press- release_IP-19-1793_en.htm)

</comment><comment><USER25> I think a speed limit is good. EU's implementation? not sure about that. What about driving by a slow driveR? you have to speed up above the limit to do that.

It's about safety, and no street legal car should be driven above 140-160km/h (87-100mph) on the highway; most people do not know how to handle a car above 80mph. It's really dangerous for both that car as well everybody around. IF you drive on your own land, race track etc. then yeah, that's where it should be allowed.

<comment><USER16> 1\. This is a speed warning, not a limiter, it will just tell you when you're speeding.

2\. If you're following a slow driver. By definition they will be going below the speed limit. You yourself say people don't know how to handle a car at 80mph. Why then allow them to reach that speed to overtake?.

<comment><USER18> > If you're following a slow driver. By definition they will be going below > the speed limit

That doesn't mean it's safe. I had the terror of joining the motorway behind a car doing 30mph last night. It kept that speed once we miraculously made it onto the lane. It was an absolute menace.

<comment><USER26> I had a similar experience two nights ago where the car in front of me just slowed down for no reason before joining. I was checking my shoulder and only realised when it was too late.

It was either rear end him or join. My front wheel came off the ground in my frantic attempt to gain the speed of the car just behind me. Fun times.

Maybe autonomous driving really is a good idea.

<comment><USER27> Autonomous driving is an _amazing_ idea, we just don't have good-enough implementations yet.

</comment></comment></comment></comment></comment><comment><USER28> Sounds like a good idea. But I wished the cars would have a limit rather than a warning.

</comment><comment><USER29> Seems completely pointless as nobody will be driving cars by 2022. Self driving will be available way before then.</comment>


Reverse Engineering Shopify Private APIs - <AUTHOR> http://ma.rtin.so/reverse-engineering-shopify-private-apis

<comment><USER2> Like most sites, there are public and "private" APIs. Publicly documented APIs are officially support. Private API can (and often do) change at any time, which is why we don't recommend they be consumed by customers.

</comment><comment><USER3> I don't understand.. Why wouldn't they spend the few minutes needed to just make this public?

<comment><USER4> Hi, Shopify dev here - when we roll out APIs we usually keep them private for a period before making them public to iron out bugs as well as harden them to work fast at scale.

<comment><USER5> Awesome to see this post, and your response here... I'm actually the author of the article.. Can you be more specific than "period"? It seems you guys have had coupon generation ability for quite some time.

<comment><USER4> I didn't have a hand in the discounts code directly but I believe the private API was added last fall so that we could offer this free app to solve most people's needs with discounts ( [http://www.shopify.ca/blog/6668676-new-free- shopify-app-bulk...](http://www.shopify.ca/blog/6668676-new-free-shopify-app- bulk-discounts#axzz2NSNbnxG3) ).

BTW, if you're interested, <http://www.shopify.com/careers> \- things like "I reverse engineered your private APIs and got it on front page of HN" set you apart from the herd ;)</comment></comment></comment></comment>


Why Rust fails hard at scientific computing - <AUTHOR> https://andre-ratsimbazafy.com/why-rust-fails-hard-at-scientific-computing/ <comment><USER3> > Consequences ? You can't use Rust arrays to represent a matrix bigger than > 4×8, how useful is that?

I went and Google'd "rust linear algebra library" and immediately found [https://nalgebra.org](https://nalgebra.org) which can represent such matrices just fine, and even integrates with LAPACK. Did the author do this most cursory of research before springing to write their rant? This is like saying "Python fails hard at scientific computing" because the default list type isn't an efficient basis for representing matrices, while entirely ignoring NumPy.

Also, those are _memory slices_ , not arrays: they aren't pointers to heap- allocated data. So [[f32; 9]; 5] corresponds to a contiguous block of memory representing a 5x9 matrix of 32-bit floats. It has the same memory structure as [f32; 45], but you can index it as eg. my_matrix[3][2] to access the element in the 2nd column of the 3rd row. Again, I guess it's much easier to bash something than try to understand it.

<comment><USER4> > _I went and Google 'd "rust linear algebra library" and immediately found > [https://nalgebra.org](https://nalgebra.org) which can represent such > matrices just fine, and even integrates with LAPACK. Did the author do this > most cursory of research before springing to write their rant? This is like > saying "Python fails hard at scientific computing" because the default list > type isn't an efficient basis for representing matrices, while entirely > ignoring NumPy._

The author didn't want to use/leverage/whatever some ready made package. He wanted to write his own.

Python does suck for scientific computing at that level as well -- Numpy and Scipy are huge wrappers for C/Fortran etc code.

<comment><USER5> If the author wanted to write his own, he could very easily write an nd-array- alike wrapping a really long double[] in Rust, right?

From the author: _You can work around it by using a Vec (arbitrary sized sequence /list) but then your matrix is allocated on the heap not the stack, meaning slower operations. Plus that means you cannot use Rust wonderful type system to check that you multiply matrices with compatible dimensions, say a 2×2 matrix with a 2×1 matrix, without jumping through hoops._

So he thought of that, then decided not to go that way, even though that's how it's done in C/Fortran underneath every single linear algebra library in the world, and his conclusion is that rust sucks?

I'm finding it a little hard to believe that there are real-world linear algebra problems where allocation is the bottleneck and doing it all on the stack is the answer.

<comment><USER6> If you have to do X in the new language in the same way as in Fortran, the new language is not better for doing X than Fortran, is it ?

<comment><USER5> Sure it is. Both in larger program design and in affording several different ways to accomplish the subscripting into the giant nd-array Vec<f64>. Maybe Rust should also provide language support for the ndarray type, but lack of such isn't a barrier to being as-good/better than existing langauges.

If you're doing linear algebra on big matrices, putting them on the stack is most likely madness. It sounds like the author is interested in Rust for the 'expressive' type system enforcing logical invariants about his matrices, which isn't why Rust built their expressive type system.

</comment></comment></comment></comment></comment><comment><USER7> What happened to the readability of code? This looks dreadful. I am sure there is a way to come up with a better syntax without sacrificing the type safety aspects.

      fn main() {
          let my_str: Rc<RefCell<Box<MyStruct1>>> =
      Rc::new(RefCell::new(Box::new(MyStruct1)));

      my_trait_fn(Rc::new(RefCell::new(Box::new((**my_str.borrow()).clone()))));
          my_str.borrow().my_fn();
      }

I come from a Python/Java world and I remember when I first delved into embedded MCU programming in C/C++, it was a cognitive overload and a half. I think we need to take a step back and while I understand the differences between high level languages (Java/Python) and C/C++ having the burden to allow for low-level programming; readability aspects of code often gets the lowest attention.

If we, humans, spend so much time writing/parsing code through our vision system, programming languages need to take this aspect seriously and optimize the syntax over readability than expressivity.

I recall Kernighan's "The Elements of Programming Style" where he talks about making the code more understandable than "clever". The syntax of a programming language directly facilitates (or impedes) this idea.

Edit - Everyone seems to keep pointing out it is a contrived example. Yes, I agree but the syntax has nothing to do with making the contrived example even more difficult to read?

<comment><USER8> _I am sure there is a way to come up with a better syntax without sacrificing the type safety aspects_

Well, this is the generic curly-braces-and-semicolons style. If you want to see nice clean yet type-safe syntax, just take a look at OCaml or Haskell.

<comment><USER9> What is meant by "type-safe syntax"? A syntax that permits type annotations? I will say I find Haskell and especially OCaml hard to read; I'm writing a pretty minimal language with a Haskell-esque syntax, but that's because it's easy to build a parser, not because I find it more readable. And the syntax will likely change when readability becomes more important than prototyping.

<comment><USER10> I think the intent was "a _language_ with nice clean syntax that is nonetheless type-safe".

A large portion of readability comes from familiarity. I find most Haskell code fairly easy to read—or at least, approximately as simple or complex syntactically as it is semantically. Other mainstream languages tend to be either much more complex syntactically than what they do semantically ("verbose") or much simpler ("magic").

<comment><USER9> That makes sense, and I agree with your assessment of readability.

</comment></comment></comment></comment></comment><comment><USER11> I wish the HN community would collectively decide to downvote posts like these, which reward people who use clickbaity titles to get attention at the cost of hiding more careful analyses.

The post can be summarized as a critique of a programming language that did not meet the author's desires, but sections of the critique is (1) dislike of the syntax, (2) a specific missing feature, and (3) a very specific feature which doesn't exist in any of the popular scientific computing languages. It's fine to talk about not liking a tool, but it doesn't merit "fails hard".

<comment><USER12> 3) very much exists in julia

</comment></comment><comment><USER13> Aside from all the discussion around these low-level complaints, the Rust community is well aware of the lack of higher-level scientific computing libraries, which IMO is the more relevant reason not to use Rust today: [http://www.arewelearningyet.com/scientific- computing/](http://www.arewelearningyet.com/scientific-computing/)

Hell, Rust doesn't even have stable bindings around BLAS/LAPACK/LINPACK and friends which are the lifeblood of _every_ language capable of scientific computing.

Give it time. Scientific computing was never the primary thrust for Rust, and other more pertinent domains have yet to reach complete maturity.[0]

[0]: [http://www.arewewebyet.org/](http://www.arewewebyet.org/)

<comment><USER12> It's also totally fine for rust to be not as good for scientific computing. If you try to be everything for everyone you'll fail to be good at any one thing. It's hard to imagine rust will ever be competitive at scientific programming, say, with Julia. You might get say a 20% boost in number crunching performance at the expense of developer time.

Conversely, you'd be a damn fool to try and write Firefox in Julia.

</comment></comment><comment><USER14> Lack of multidimensional arrays as a language primitive is a problem. It was a problem in C, C++, and Go, too. There, you either have arrays of arrays, or some macro/template that does a multiply on the subscript. The reply in one of the Rust forums is that multidimensional arrays are only found in "domain- specific languages", like FORTRAN.

When someone brings this up the usual excuses are trotted out:

\- "It can be done with templates".

\- "You can have an array of arrays".

Then there's bikeshedding. Some people want to be able to extract an arbitrary subarray slice from an N-dimensional array and treat that like a regular array. This is possible but complicated, and if implemented slows down the simple operations. Then there are people who want N-dimensional arrays where N is determined at run time. (This now includes the machine learning people.) Endless arguments between these groups resulted in nothing being done in Go. I haven't followed that discussion for Rust.

The big advantage of doing this in the language is that there's a lot of hardware support for doing number-crunching fast on dense arrays, and you want the compiler to be using it effectively. Matrix multiply on arrays of arrays is much slower than on a dense array where the compiler knows the spacing between the rows at compile time.

At least have arrays as good as FORTRAN. This is why some heavy number- crunching work is still done in FORTRAN.

<comment><USER15> Are there any more efficient ways to represent a dense multi-dimensional array than a one-dimensional array + index multiplication? Is there any difference between said multiplication done by some internal function inside the compiler, or by a regular (and trivial) function generated by a macro / template system?

<comment><USER14> Yes. And yes.

One dimensional array + index multiplication doesn't make it clear to the compiler that the rows are disjoint. So the compiler can't assume there's no aliasing. It also probably can't strength-reduce the multiply to an add when advancing through an array in the "wrong" direction. FORTRAN compilers have been doing subscripting optimizations like that since 1956.

After those optimizations, it may be possible to use some of the SSE instructions on x86.

<comment><USER16> I wonder how are FORTRAN arrays implemented. I was also assuming was a bing single arrays + indexes...

If I wanna add this to a language, what I need to consider to be as FORTRAN?

<comment><USER14> Look at the generated code for a matrix multiply in different languages. How tight is the inner loop?

</comment></comment></comment></comment></comment><comment><USER17> I am going through the rust by example thing every weekend and also trying to write some Rust code on my own and I found the 'too much symbols'/unreadable code and just the general complexity of the language very off putting.

If I have to write low level code, I might just stick with C or C++ - <USER2> devils I know rather than trying to tame a new incarnation of the devil that is Rust. The complexity and learning curve costs of Rust far outweigh the benefits at this point.

Edit: If I sounded like I am giving up on Rust above, that's not yet the case. I am currently enjoying challenging myself to learn something complex and to that effect, Rust is holding my interest.

<comment><USER18> Did you try the book? Just curious.

<comment><USER17> I started there, 1st edition IIRC - went up to refs and borrowing and then thought maybe the by example approach is something I would like better - and I do find the example approach keeps my interest better.

Although I suppose I should go look at the 2nd ed draft when I need to look into more theory - reading the refs and borrowing section from 2nd ed right now :)

<comment><USER18> Ah yeah, the second edition is just straight-up better, and _does_ contain examples. For example, ownership, references, and borrowing are theory-based in 1st edition, but are with String/&str in the second. That said, both are great resources. For some people, the book doesn't work for them but RBE does, and for others, RBE doesn't but the book does.

<comment><USER19> I went through the books, yet it was a big challenge porting an old Gtkmm toy application to Gtk-rs, because of lifetimes on callbacks.

Initially I was referring to the fields on the struct, but ended up passing them around as parameters.

You have a referrence to this kind of problem on the NLL proposal.

But unless I missed it, the books don't talk much about this.

<comment><USER18> The book does, but it basically says "Don't do that", whereas since you're binding to a library that does that, you don't have a ton of choices.

I haven't really used Gtk-rs enough to say more than that, really.

<comment><USER19> Basically the idea of having structs implementing widgets, which need to respond to UI events and handle their state, stored as struct fields.

On modern C++ you can easily use this approach with _std::enable_shared_from_this_.

</comment></comment></comment></comment></comment></comment></comment><comment><USER20> > then your matrix is allocated on the heap not the stack, meaning slower > operations

This doesn't seem right at all... Does anyone know more? Maybe they meant slow to allocate / deallocate? The author's problem appears to require you to generate a lot of temporary data and then throw it away. They might benefit from just writing their own pool allocator, so they don't have to wait for heap allocates (assuming that's their problem).

<comment><USER21> I imagine the following problems affecting performance outside of the alloc/dealloc themselves:

\- Heap memory may not be reused as cleanly as stack memory, which means lower cache efficiency. Your suggestion of a pool allocator should take care of this.

\- Runtime code for bounds checking needs to take the array size from the object even if it's constant. I recall there were XXX_unsafe() versions of accessors, which should not do any bounds checking, but the code is going to look ugly.

\- Having to go through an indirection from the object to the memory buffer. Here you are at the optimizer's mercy.

So to avoid overly complex / ugly / brittle code where you need high performance, you are pretty much forced to write your own matrix types from the ground up, which is one of the concerns of the OP. I don't believe this is a terribly bad thing, and if the existing crates for this are not great yet, it would seem to me that it's just not been a focus for the Rust community, not an insurmountable problem.

</comment></comment><comment><USER22> Extensive discussion on /r/rust: [https://www.reddit.com/r/rust/comments/76olo3/why_rust_fails...](https://www.reddit.com/r/rust/comments/76olo3/why_rust_fails_hard_at_scientific_computing/)

</comment><comment><USER23> Re: (2), this RFC was merged: [https://github.com/rust- lang/rfcs/pull/2133](https://github.com/rust-lang/rfcs/pull/2133)

<comment><USER24> To add a little context here:

> 2\. Arrays in Rust are a second-class citizens, actually I think they don't > even have their visas. I hear them laughing at me when I try to use them. > You can't even clone them:

RFC 2133[1] adds Clone to Arrays (and Tuples), it has been merged and implemented[2].

> 3\. Rust is still "discussing" integer as generic type parameter (since > 2015), meaning a matrix type Matrix[M, N, float] will not exist before a > long long time. The following github discussions are quite the read:

It links to a bunch of stuff, but fails to recognize that this also has a merged RFC [3] and implementation is actively worked on[2].

[1] [https://github.com/rust-lang/rfcs/pull/2133](https://github.com/rust- lang/rfcs/pull/2133)

[2] [https://github.com/rust-lang/rust/pull/43690](https://github.com/rust- lang/rust/pull/43690)

[3] [https://github.com/rust-lang/rfcs/pull/2000](https://github.com/rust- lang/rfcs/pull/2000)

[4] [https://github.com/rust-lang/rust/issues/44580](https://github.com/rust- lang/rust/issues/44580)

<comment><USER25> > fails to recognize

The article is dated April 1st, your links on const generics are from later.

<comment><USER24> Ah, sorry, I missed that.

</comment></comment></comment></comment><comment><USER26> > _I'm not even talking about Rc, RefCell and Box which seems like security > through obscurity._

What do you mean?

</comment><comment><USER27> I don't know if Nim would be my first choice for a future scientific computing language. I think I'd be more focused on Julia or, recently, Crystal.

Julia has some extreme magic that it can do to make your life easy. Crystal will attract the Ruby-like crowd of people who will create very neat and effective libraries.

<comment><USER28> I disagree (but then again I am biased). I think Nim has a chance of attracting the Python-like crowd of people (plus Python has some very good scientific libraries like pandas) and I would be willing to bet that Nim's ability to perform magic surpasses that of Julia (or at least is equivalent).

Edit: Shameless plug. My book, Nim in Action, is 50% off today with code HalloweenPB50 (From Manning). Perfect opportunity to grab a copy and learn Nim :) [https://book.picheta.me/](https://book.picheta.me/)

<comment><USER12> Does Nim have first class distributed computing primitives? For embarrassingly parallel operations, I can deploy on a slurm provisioned cluster on a supercomputer in about 5 lines of native Julia.

There's a lot of really nice "magic" in Julia. I implemented an experimental numerical system (a binary representation of real numbers) and after generating the +-x/ operations, I had complex numbers, Fourier transforms, and lu decomposition for free.

With the macro system I then wrote a library that let's me generate verilog code and built a hardware implementation of the number system and deployed comprehensive tests cross correlating the results of all operations across native Julia, hardware simulation in Julia,and verilog version transpiled through verilator.

I wanted to play around with Mary Wootters' discoveries about Reed Solomon encoding, so getting working Reed Solomon code over arbitrary galois fields was as simple as building the type rules and basic +-x/ and then again using matrix solving to solve erasures (in this case you can tell the type system there is no order to the type so it doesn't do partial pivoting). Then I needed to do some brute force searching of a large parameter space. The core program for this search is about 25 lines of code in the main loop, which reads like simple math statements out of a well written text, and the backing galois field and Reed Solomon libraries are about 100 and 50 lines, respectively.

</comment></comment></comment><comment><USER29> I suspect Rust also fails hard at interactive code (UIs).

Why? Because Rust's memory management doesn't work well with cyclic structures, and closures are such structures. Closures have shown to be very useful for interactive code (see Javascript).

Someone please prove me wrong. (I'm wondering how Firefox deals with this).

<comment><USER18> Rust uses closures quite heavily.

The biggest problem with UIs is that they tend to be based on inheritance, which Rust doesn't have. It's not insurmountable; there are people who have written macros to make this kind of code more concise, or alternative UI libraries that don't rely on inheritance.

<comment><USER29> > Rust uses closures quite heavily.

I suppose they only support read-only free variables then?

<comment><USER18> Not exactly, no. There's a bit more ceremony since there isn't a GC, but that's a systems language for you.

Closures are basically syntax sugar for a struct that represents the environment, and a function pointer which takes that struct as one of its parameters. So you can do anything that you can do with that setup, aka, anything :)

[https://doc.rust-lang.org/book/second- edition/ch13-01-closur...](https://doc.rust-lang.org/book/second- edition/ch13-01-closures.html)

</comment></comment></comment></comment><comment><USER30> > You might say, 30 lines, easy no? Well except that Go can be played on 9x9, > 11x11, 13x13, 15x15 and 17x17 too, any oddxodd size, no way I'm implementing > those 30 lines x 6 times, this is not fun

I'm curious if the author has tried using macros, which would require him writing the code only once.

</comment><comment><USER31> Scientific Computing doesn't really happen in low level language spaces today. FORTRAN, C and C++ are what powers the Higher Level languages.

Most is done in R, Matlab, Python, and Julia and for good reason. Most people doing scientific computing are not coders that can do the work at a higher level at a productive level.

</comment><comment><USER32> for one point, an efficient programm probably wouldn't need to pack memory intensive arrays on the stack all at once.</comment>


A Defence of Common Sense (1925) - <AUTHOR> http://www.ditext.com/moore/common-sense.html <comment><USER2> I like how no-one commented on this. Its a formidable bit of writing. You'd need to make sure you really got it before risking a critique or an analysis of it. A risky thing to comment on.

I find the language interesting, he's having to use very specific phrases and structures again and again to try and carve out what he's saying and what he isn't saying. Makes me wonder what a philosophical declarative language might look like, or even a philosophical programming language (what would that even mean?? I like the idea though).

<comment><USER3> On my to-read list. If more people were to adopt this attitude with respect to their usage of language, I think the world would be a far better place! (albeit not a practical one...)</comment></comment>


Residents from NY,LA, MN, NH, AS May  Need a Passport for a Domestic Flight - <AUTHOR> http://www.travelandleisure.com/articles/drivers-licenses-new-york-domestic-flight-real-id <comment><USER2> > "Of the noncompliant states, only New York and Vermont issue enhanced > licenses."

Minnesota has been offering them since Feb, 2014.

[http://www.startribune.com/minnesota-to-offer-enhanced- drive...](http://www.startribune.com/minnesota-to-offer-enhanced-driver-s- licenses-id-cards/244738141/)</comment>


An open letter to Tim Cook and Jony Ive - <AUTHOR> http://www.samlecuyer.com/2012/11/dear-apple/

<comment><USER2> Did they get lazy or do they not want people to actually redeem free content easily? It's a bit of a pain to mash all those random characters, not to mention the fact that the redeem button is all the way at the bottom of the app.

<comment><AUTHOR> I kind of get the feeling they just don't want to give things away.</comment></comment>


Show HN: Travel Destination Search Engine - <AUTHOR> Myself and 2 friends wanted to help people make smarter decisions on big  purchases. This is our story of committing the cardinal sin of  startups.. creating a consumer travel product.
The Product: https://www.getcluey.com/en/explorer/
Once described it as a load balancer for tourists.
It's still a work in progress, the data is not perfect, and it's more of a tool than a product at the moment. But we want to share the concept and trade ideas.
Similar tools have existed in the past but not to this level of detail. The ones we came across in our research were generally vague and seemed to always suggest the same places.
We're new to travel. It's going to be a battle, but we're passionate about the problem we are trying to solve. Travel can be indulgent, but there are a lot of important benefits too. Injecting money into small, local economies. Meeting new people, seeing new cultures - breaking out of the bubbles we can fall into day to day.
Cluey's goal is to allow people to quickly search and compare travel destinations. Looking for places for a balmy beach holiday in October within 7 hours flight of you? Hard but doable. Try to overlay that with popularity, cost, rainfall, safety, activities, language? Hope you have a degree in data science.
Some user feedback we've received:
- I thought Armenia was dangerous and war torn, it's not? It looks beautiful.
- I was going to fly to the Bahamas but its probably because it's so prominent on American media. I couldn't figure out where in the pacific it's warm without tropical drizzle. Actually there's heaps, a lot cheaper, and a shorter flight.
It's not really going to help you already know exactly where you want to go and do there. It's useful if you have limitations or specific needs. Eg a popular one seems to be young families who only want to fly X hours with their children and would like to see what the options are. <comment><AUTHOR> If anyone has worked in the travel industry especially around product or marketing I have a question. Why hasn't anyone built this yet?

I get emails from airlines telling me about all their deals to a continent, then seem to expect me to research all the destinations myself before I can even decide if their deal is relevant to me. In the age of personalisation this just seems so.. vague?</comment>


U.K. Police Will Soon Be Able to Search Through U.S. Data Without Asking a Judge - <AUTHOR> https://www.eff.org/deeplinks/2020/01/uk-police-will-soon-be-able-search-through-us-data-without-asking-judge <comment><USER2> > In colonial times, the British military used general warrants to search > through houses and seize property. This practice was part of what fueled the > American Revolution, and formed the basis for the 4th Amendment to the U.S. > Constitution.

Well I wouldn't worry too much - the US won't hand over the American woman that forgot she was in the UK, drove on the wrong side of the road and in so doing annihilated a poor unsuspecting 19 year old motorcyclist, so I think you're safe from redcoats knocking at the door in the middle of the night.

<comment><USER3> Wish I could downvote.

Five Eyes is laughing at you.

</comment></comment><comment><USER4> It will be hard to fight this. Even if fighting it now, it will happen at some point in the (near) future anyway. And it will broaden.

The big problem is that most people (voters) will simply say; catching terrorists (or criminals in general) is good, they do not care about losing a bit of privacy! Maybe they would care if they knew all the consequences?

In Spain you cannot film public spaces (cctv or otherwise) without permission of the persons you film, owners of cars you film etc. The fines are pretty high. The mayors of towns around here have been fighting the police (not the normal police but the Guardia) from putting up cctv to catch criminals. And with success; no cameras anywhere where I am, in any of the towns around me. If someone hangs one up at their house that points to the street, they will pay fines and have to remove it; they drive around and check.

Law enforcement is not as strictly held to the privacy laws but they also cannot do what they want; they need permission, the equipment is costly as it needs to be stored in ways that protects the public and accessing it is very restricted to actual crimes in the location.

The people 'in the bars' are against all of this; they want cctv cams everywhere (with facial recognition if they know what it is) they can be put to catch burglars and robbers. So it will happen eventually. Not today, but soon-ish, when there is enough pressure by voters.

<comment><USER5> Which part of Spain are you referring to? Because at least in Valencia I was surpassed to find a ton of cctv in public spaces like parks and busy streets.

</comment></comment><comment><USER6> As a European, I find that a bit amusing, though begrudgingly so. We non-US citizen are in that situation since ever, because the American agencies simply don't care about the rights of foreigners. That didn't seem to bother US citizens at all, as long as "terrorists" could be stopped. I'm struggling to be too emphatic about you guys now.

<comment><USER7> My thoughts exactly as a non-american. I just find this amusing and all I can say is welcome to the club of being spied on with impunity.

<comment><USER3> If you think your government isn't collecting as much as they can, then, you're likely mistaken.

<comment><USER6> But that is not the point. The point is being spied on by a foreign government with a slight superiority complex. The point is that there isn't anything we can do about it, contrary to our home country, where we can vote for our desired policy.

</comment></comment></comment></comment><comment><USER8> The NSA is allowed to search all foreigner's data without any warrant - it's open season for those hunters. Only makes sense, and is fair, for foreign countries to do the same. We need some serious release of a US politician's google searches to fix this problem.

<comment><USER9> The cynic in me says that wouldn't even fix the problem.

</comment></comment><comment><USER10> Wonder how long it take for US police to ask UK police to do a search for them?

Or if that's actually be design.

<comment><USER11> If you haven't heard, this is how Xkeyscore scheme is said to work to dodge 4th amendment:

US lets UK spies read US wiretaps they legally cannot, and construct dossiers from them. Then the UK side does the same.

Both then share the resulting work with each other.

<comment><USER12> Do you have proof?

<comment><USER13> The intelligence services of both countries that openly admit they cooperate with each other, they just don't say to what degree. Also Five eyes, which has been operating since the 1940s.

</comment></comment></comment></comment><comment><USER14> This data / capability is worth at least tens of billions. From a purely cold calculation perspective, the UK could if desired use this data in a myriad number of ways to extract lucrative financial value. The US could too but because of the disproportionate size of the respective economies, I'd much rather be the on shortstack side of this kind of deal.

</comment><comment><USER15> I'm ok with this if I can have access to all of the UK and US politicians' and all their associates' real time communications data.</comment>


Estimating images using CSS - <AUTHOR> http://www.gradifycss.com

<comment><USER2> Misleading title. It's using Javascript to get most dominant color in an image. It has almost nothing to do with CSS</comment>


Event Confirmed: Apple can't count. - <AUTHOR> http://blog.jarederondu.com/iphone-event-confirmed-apple-cant-count

<comment><USER2> They are releasing iPhone 5. The branding is iPhone 5. Not the version number.

</comment><comment><USER3> I have no idea what you are on about with the clock. It's a deformed clock? Wat?

</comment><comment><USER4> Maybe you're thinking way too hard about this.</comment>