Hacker Newsnew | past | comments | ask | show | jobs | submit | more lambda's commentslogin

I think the main blocking part there is getting LLVM working on AVR. I believe there is a fork of LLVM that does (https://github.com/sushihangover/llvm-avr), but you would have to merge that fork with the LLVM that Rust uses in order to run Rust on it, and it looks like the fork is a little out of date so it may take some work.

This particular likely doesn't affect running Rust on an Arduino at all, as what it is doing is removing the runtime for std, which contains many of the OS abstractions. You don't have an OS on an Arduino however, so std isn't particularly helpful there. Several months ago they already did what was necessary for that, factoring out much of the completely OS independent functionality into a "core" library (http://doc.rust-lang.org/core/), so you can opt out of using std and use "core" instead, plus add a little bit of platform specific glue, to run Rust on bare metal.


Too bad, I was hoping for easier embedded usage as well. I don't particularly like the Arduino abstractions, too much is hidden, and to get decent performance or ADC precision often requires dropping to low-level C or even assembler.

But the last commit to that fork was just 10 months ago though... might be tempted to have a look during the holidays.


Yeah, as said above, checkout zinc.rs. It runs on ARM MCUs though, but AVRs are becoming legacy anyway.


Aren't AVR and ARM different power envelopes, though? I thought ARM was for small computers and AVR is for things that want to be slightly more complicated than a gearbox.


Cortex-A series is for small computers (eg smartphones etc), Cortex-M is more of a contender for AVR, especially Cortex-M0 which are the smallest ARM cores. There is currently lot of activity around ARM and power-optimization in the industry, while AVRs are generally bit older design.

Just for fun, I picked a semi-random example of ARM mcu from digikey: EFM32ZG110F32[1]. Based on the datasheet it consumes about 8mW when running on full 24MHz speed. Meanwhile the AVR chip used in eg. Arduino Uno[2] consumes about 10mW when running at 8MHz. Of course at these ultra-low power levels there are quite a large amount of variability depending exactly what you are doing and how well your code is made.

[1] http://www.digikey.com/product-detail/en/EFM32ZG110F32-QFN24...

[2] Atmega 328p http://www.atmel.com/devices/atmega328p.aspx


There's a wide range of ARM processors, but you can maybe sort them into three tiers: small AVR-like scale (e.g. Cortex-M), the smartphone speed (e.g. Cortex-A8/9 what most people come into contact with), and edging it's way into the market - the server targeted ARMs.

The small, deeply embedded scale usually runs bare-metal or a small RTOS, while the next tier up often runs Linux. Now the small scale ARM is basically on the fast side (32bit proc) the very low end embedded cpus class. But it's often selected for everything but the most cost or power sensitive applications which tend to go for very small, power sipping 8bit cpus (e.g. MSP430s)


I love it. The day C and C++ die I'll be dancing on their grave and twerking on the tombstone.

Will be hard to find an ARM equivalent for the ultra low power MSPs though.


The new atmel D21 arm looks interesting - 40ua/mhz , and 0.9ua standbay with ram retention and rtc.


With rust-bindgen , you should be able to use vendor supplied HAL written in c quite easily.


> power storage will continue to improve

Power storage may continue to improve, but it will take a long time before you hit the energy density of fossil fuels; the difference between batteries and fossil fuels is something like a factor of 10 (actually greater than that, but electric motors are more efficient so let's say 10 for the sake of argument), and it's improving much more slowly than Moore's Law, doubling maybe once every 10 years. That means if those trends continue (and there's no guarantee they will), you're looking at 30-40 years before the energy density allows electric helicopters to be competitive with fossil fuel powered.

For cars, energy density isn't quite as important, as the weight of the car is not the dominant factor in its efficiency (it does have an effect, but the aerodynamics, engine efficiency, transmission efficiency, tires, etc. all make a big difference too). But for a helicopter, every pound you add to the batteries is another pound you have to lift, so energy density of your power source is quite important.

So, if trends hold on battery technologies, it will come about eventually; but I would put money more on the decades timeline than the years timeline.


If you take a look at the master's thesis on designing the compressed opcode format[1] (expressing instructions in a 16 bit encoding, similar to ARM Thumb, to increase efficiency of instruction cache utilization), in which they counted what registers were used most often in order to determine which to allow access to in the compressed format, you'll see that the 0 register is the 5th most common register, making up approximately 9% of all registers referenced in instructions. Dynamically, in terms of instructions actually executed as opposed to merely present, it's a little less common at closer to 4%, but still common enough to be worth choosing as one of the 8 registers accessible in the compressed format (actually, they only allow it for some operands of particular instructions where it is particularly useful in the compressed format, allowing other operands to have access to one more real register).

It's useful for several things. One is as a no-op instruction; as you point out, AND, OR, XOR, etc. with zero are no-ops, and no-ops are sometimes useful for achieving certain alignment in code, or leaving space for instructions to be patched out with other code (which is common for debugging, tracing, and hot-patching of code).

It can also be used for copying from one register to another, without another instruction. "ADD rd, rs1, 0" is a way to write "MOVE rd, rs", so you don't need to waste an extra instruction on that.

0 is also one of the most common values that you want to compare against (many loops can be turned into decrementing a value until it becomes zero, or you're just walking along a data structure or string until you encounter a null value), and so their branch instructions work by comparing two registers and branching to a particular offset. Having a dedicated 0 register means you can always do a compare against 0 and branch in a single instruction, without having to have separate instructions for comparisons against immediates versus comparison of two registers.

[1]: http://www.eecs.berkeley.edu/Pubs/TechRpts/2011/EECS-2011-63...


I did not think about comparisons ... that is right.

The other examples are also valid, but rather special to RISC architectures ... but of course it does the trick.


It's not the infrastructure that he cares about. He believe that any provider you use should be free to run their infrastructure as they see fit, releasing or not releasing any code as they see fit. It's the fact that the software that you run, on your end, is non-free.

With Skype, you cannot connect your own client to their network; you must run their proprietary, highly secretive client.

With the phone system, you can attach any device that you want. You can use a dumb, analog phone, or a digital phone running free software, or a digital phone running proprietary software, or modem, or a fax machine, or whatever, to the phone system.

Note that this was not always the case (https://en.wikipedia.org/wiki/Carterfone, https://en.wikipedia.org/wiki/Hush-A-Phone_v._United_States).


So a reverse engineered Skype client would be OK then?


Absolutely.

Now, he also does have other concerns about the infrastructure; he would generally prefer to support infrastructure running on open tools and technologies, and may have various other concerns with particular providers.

But he sees that as a separate question of the ethical question about running non-free software on his own computers.


Yes, for the same reason Samba, a reverse-engineered SMB/CIFS implementation, is OK. It's a Free Software (GPLv3) way to use a proprietary technology.


yes, I think so


It appears that at lest so far, this only applies to collectible items; the kind of thing you might be more likely to sell on eBay than on Amazon, or perhaps offer for sale on Amazon so that it will show up on searches, but then do the haggling offline once you've found an item you're interested in.

Adding the "Make and Offer" button for these kinds of items could increase transparency, as it keeps Amazon in the loop and all of their standard policies apply like free shipping, so you won't get into situations where you go offline, negotiate a price, then get hit by hidden shipping fees or something of the sort.


  Is the point that the order you pull things out of the
  set doesn't matter, so demanding that it behave as a 
  stack is overly prescriptive?
Right. In fact, there are several parts of the algorithm that are not really fundamental; one is how you pick the pivot, and another is how you perform the partitioning (ensuring that all elements before the pivot are less and all elements after are greater).

Lamport's point is that if you look at the fundamentals of the quicksort algorithm, which are that you must pick a pivot, partition such that smaller values come before and larger values come after, and then at some point later apply the same two steps to the two intervals [start, pivot) and (pivot, end].

Any algorithm that follows that specification will correctly sort the array, and then you can tweak exactly how you do that depending on your constraints. You could do it recursively, you could do it iteratively, you could divide it up into separate threads until you have one thread per processor each of which does the recursive or iterative algorithm on a private work list, you could do a worker pool in which each worker takes intervals from the set of remaining intervals to sort, etc. And likewise, you can tweak how you pick the pivot (picking the first element in the array is usually a bad idea, as it gives worst case behavior for already sorted arrays), and tweak how you perform the partitioning.

Anyhow, he didn't go into this kind of detail, he just pointed out that thinking about the fundamental specification can help get you away from the details of a particular implementation.


  More modern languages have overcome the most glaring 
  inconveniences of early languages, but the core 
  assumption -that a PL's purpose is ultimately and 
  exclusively as a tool to convey instructions to the 
  machine- remains unchallenged.
I really feel like you're selling an awful lot of the programming language design world short here. An awful lot of what programming language design is about is making it easy to precisely express what you mean, in a way that will make sense to future programmers, be robust in the face of changes, and so on. It has been a long time since it has merely been a way to convey instructions to the machine.

  Configuration files and XML domain-specific languages 
  may work this way, and it's a very natural way to reason 
  for the human mind
Your mind must work fairly differently from mine if you find XML a natural way to reason.

You seem to be ignoring all of the tools for building embedded domain specific languages in Lisp, Scheme, Ruby, Haskell and various other language, logic programming languages which are much more declarative, and so on.

Literate programming has existed for years, but never really caught on because it turns out that one of the best ways to express the meaning of a lot of code (especially code for a large project that changes fairly often) is via the code itself, not a bunch of natural language prose associated with it.


  "I really feel like you're selling an awful lot of the programming language design world short here."
You may be right about that :-) Although now I realize my words didn't exactly convey what I intended to say, see below.

  "An awful lot of what programming language design is about is making it easy to precisely express what you mean, in a way that will make sense to future programmers, be robust in the face of changes, and so on."
Actually this is more what I was actually thinking when I said "the core assumption remains unchallenged". There are ways to program that don't assume you're trying to build a robust, unambiguous and precise meaning (and which are therefore much more adequate for non-technical users). But these ways have not been explored in depth, and are not known to the general mass of developers.

There is a lively conversation at the original blog, would you mind to move the conversation there, to keep it at one place?

http://programmingzen.com/2014/11/27/programming-languages-a...

  "Your mind must work fairly differently from mine if you find XML a natural way to reason."
I was not thinking of XML as natural, but of "creating instruction sets that work as recipies and can produce different executable code, so their meaning changes depending on the context on which they're executed". :-D This is the way that humans follow instructions when they receive orders. It's what makes the following a joke:

Q. How did the programmer die in the shower?

A. He read the shampoo bottle instructions: Lather. Rinse. Repeat.

P.S. (BTW, how do you create those intended quote blocks? I don't know how to do it)


No one has a single "permanent" Bitcoin address.

A Bitcoin address is just an identifier (cryptographic hash) of a public key in a keypair. For every transaction you do, you can create a new one. It's also possible to publish one publicly, as an address to anonymously send donations to, which can also make it easier for the public to track how many donations have gone to that address, but for most purposes, you create one per transaction, so you can keep track of how much has been spent in that transaction.

Any time you send Bitcoins, the way it works is that it sends the portion you specify to the given address, and generates a new keypair for yourself to send the change back to an address you control.

So, unless you just happen to leave a single address published publicly as your donation address, you don't have a permanent address. If you want to collect any additional information associated with a transaction; an email address to send thanks (or hit up for donations later), information to collect for tax purposes, etc, you just create a new keypair and thus new address for that transaction.


I have a single, permanent Bitcoin address (1jb55g498MEa274Z1YWUXQFxZE5NzvhV7). I don't pretend Bitcoin is anonymous and I always set my change address to go back to the inputs.

I understand the risks of how the address inputs and outputs as probabilistically tied to my identity. If I cared about those things I probably use stealth addresses and dark wallet or something.


So, that "single permanent address" can work fine if you're just looking for donations, or doing transactions with people you trust.

If you're doing any kind of transactions in volume, it's much easier to just give each customer a unique address to send to, so you can verify that you've been paid when the right amount has been transferred to that address. That way you don't have any confusion of who has actually paid you if two people owe you similar amounts at the same time, and you see a transaction come in of that amount.

So yes, it's possible to pick one address as your "single permanent address", but it's not something that's expected or common.


There are also cryptographic risks associated with reusing an address, not just identity risks. The address is a hash of your public key. You don't have to reveal the public key matching the address until you spend from the address. When the public key is secret, your address is safe even from hypothetical attacks on Bitcoin's crypto implementation. Once you spend from the address, the public key is public knowledge and that extra protection is lost.

https://en.bitcoin.it/wiki/Address_reuse


I think if someone can hack my wallet from a public key we have bigger problems


You just contradicted yourself, which is misleading. You started off by saying:

> No one has a single "permanent" Bitcoin address.

And then you finished with:

>So, unless you just happen to leave a single address published publicly as your donation address, you don't have a permanent address.


So yes, you can arbitrarily pick one address of yours to share publicly and keep permanent.

But there is nothing in the protocol or any of the default clients that gives anyone a distinguished "permanent address". So saying "I wish we knew Mozilla's permanent Bitcoin address" indicates that such a thing is expected, when in reality any one address that an entity has is a good as any other, and addresses are generally intended to be ephemeral and single use.


No, because this is not in any way going to cause consumer confusion, but instead is simply used for compatibility purposes.


Confusion is the measure used when trademarks aren't registered and is much harder to prove. When considering registered trademarks it's not necessary for confusion to be actually present at all - 100% of customers can know that your product isn't an iPad but if you advertise it as an iPad then you're infringing: it doesn't say "AppleWebKit compatible" in that string and the string is not required to make the browser function at all.

If, for example, people offer alternative services to people with an Apple UA string (BBC iPlayer did this) then you're impersonating such tech use via the trademark - it might be now for example that people need to turn off specific iPad enhancements as they break IE11 - that's commercial interference using a trademark. The trademark isn't needed in any technical way for IE to operate as it should, so it's not a compatibility issue.

Website content owners can choose to cut out certain browsers if they wish, impersonating another browser is fine .. but if you do that as a company utilising someone else's trademark to do so .. it just has feeling for me of not sitting quite right with what I know of TM law.


I would think the courts would recognize a difference between advertising to the end user for the purpose of purchase/consumption, and advertising to 3rd parties as part of a compatibility protocol.

The UA string is not visible to the consumer, and wouldn't affect the number of people who download and install the browser.

Its only purpose is to ensure compatibility with the server after the browser has already been installed.

Also I wouldn't say the browser is actually impersonating another browser. If it was trying to impersonate, the UA string would need to match the other browser exactly and it doesn't attempt to do that. The string is still uniquely identifiable as an IE11 UA.


So, the one main use case that can't be handled by feature detection or a JavaScript API is returning a mobile or desktop site without extra round-trips.

If a server can detect that you have a mobile user-agent, it can directly deliver you an optimized mobile site, that avoids sending lots of extra data that is only relevant for the desktop version, and avoids extra slow round-trips to fetch data later once JavaScript based detection has had a chance to run.

UA strings are awful, but I haven't seen any other good solution for this problem.


Why are desktop and mobile sites so different? Why do they need to be different? Can't we just make responsive designs?

Having separate desktop and mobile sites is an anti-pattern.


I disagree, there are instances where having a completely different website for a smaller form factor is beneficial to the user.


It is! And I wish more sites would make it accessible like it used to be by just going to m.domain.tld rather than user-agent sniffing, because I often prefer the simpler mobile version I get when I spoof my user agent from the desktop.


Which is great.. until I do a google search for my closest movie theater on my phone to pull up the listings... the link to that theater's page is right at the top... "great" ... now I click the link and the site redirects me to m.theater.com/ (no path after the slash) ... now I'm stuck slogging through several pages to get to what I wanted.

This happens a lot.. there's a page on the desktop site that doesn't correspond. Responsive design still shoves a lot of extra resources at a client that the smaller devices especially don't need. Responsive rendering then loading an adaptive client in the browser is a better option... browser sniffing is the only way to do this.


A phone-optimized site will have less content, usually, so why send the extra data to phone that don't need it, especially when those phones are running at lower bandwidth and are often billed per gigabyte?


I usually find it frustrating when a phone site doesn't let me see what the desktop site does. If there's content only for one form-factor, load it with AJAX.


If you are trying to serve a separate mobile website, you are doing it wrong (as of ~2 years ago). Responsive design is the modern standard. (I am a frontend developer)


It would be great if we had a header that tells the screen size.

And it would actually help solve the problem, instead of just placing another layer of band-aids above it.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: