Hacker News new | past | comments | ask | show | jobs | submit | Skalman's comments login

For me the hump was from the get-go.

Following the book, I installed Rust directly, but then i realized that I should've installed it via Rustup. Next, I want a good editing environment, so I install VS Code and Racer, but then I find out that I can't use Clippy unless I use Nightly... and I'm not interested in using Nightly, so I'll wait.


Rustup has been in beta for a while, which is why we don't recommend it in the book. Soon though!


I just installed the nightly tarball and used my usual editor (emacs). I'm not sure what the editing environment has to do with a learning hump.

Now, coming from loose dynamic typed languages or really terrible C or C++ code bases is another matter.


To people helping others on the internet who claim to be security professionals, remember to make sure that the person is actually trustworthy, so you're not helping criminals. Even though a_cherepanov is a new account with only this comment, I suppose their email domain makes them trustworthy enough: ESET is a Slovakian security company that's had a Wikipedia page for 5+ years.


It's an encoding that isn't good at anything: it's neither ASCII-compatible (like UTF-8), nor fixed-length (like UTF-32), but because most characters require only 2 bytes, developers frequently assume that none require more, leading to bugs when a character eventually is represented by 4 bytes.


> fixed-length (like UTF-32),

Utf-32 is only fixed length if you don't care about diacritics, variation selectors, RTL languages, and others. Unicode is not one code point or one char/wchar/uint32 per glyph.


You've changed topic from code points to grapheme clusters. Rust's character/string support is strictly for code points (the documentation is fairly clear about the distinction).

Few string libraries actually deal with grapheme clusters as the native underlying representation (Swift being a notable exception).


The broader point I'm making is that unicode is hard and attempts to simplify it by choosing a different encoding (i.e. switching to utf-32 to save yourself from all problems) are a bit misguided.


My life is a lie.


UTF-32 is not good for anything either, easy access to codepoints is just as useless as access to UTF-8 bytes. Any meaningful operation on text (even counting number of characters) requires parsing grapheme clusters, which have variable length regardless of what encoding is used.


I don't know much about Rust and Rust library, so I have a question: what if I what to develop Windows only software in Rust, will I need to convert back and forth between UTF-16 and UTF-8 (or whatever Rust uses in other parts of the library)?


Yes.

The Rust std library had to pick a string encoding, and it picked UTF-8 (which is really the best Unicode encoding). The String type is platform neutral and always UTF-8.

However, it does provide an OsString type, which on windows is UTF-16. Maybe there is a library - and if not, one could be written - targeting Windows only, and implementing stronger UTF-16 string processing on the OsString type.

EDIT: To be clear, Rust's trait system makes this very easy to do. You just define all the methods you want OsString to have in a trait WindowsString, and implement it for OsString, even though OsString is a std library type. One of the great things about Rust is that its trivial to use the std library as shared "pivot" which various third party libraries extend according to your use case.


I believe Rust uses WTF-8 as an intermediate format for windowsy things (cheaper), but I'm not sure.


What is... oh... UTF-16, the gift that keeps on giving... this is, at the same time, utterly hilarious and horribly depressing:

https://simonsapin.github.io/wtf-8/

But there is actually prior art here - Java's contribution to perverse Unicode encodings is called "Modified UTF-8" and encodes every UTF-16 surrogate code unit separately.

http://docs.oracle.com/javase/6/docs/api/java/io/DataInput.h...


We have an http://doc.rust-lang.org/stable/std/ffi/struct.OsString.html to abstract over a native string in whatever encoding your platform has. Generally, things that interact with the OS use these, and they can convert to a UTF-8 String.


Suppose I'm on Linux, but I want to interact with Windows stuff. (CIFS protocol, NTFS on-disk format, disassembler for Windows executables, Wine-like program, cross-compiler, etc.)

I'll be wanting UTF-16 support. Going the other way matters too; if I'm on Windows I may need UCS-32 support.


Sure. That's not a problem. You can write any kind of string type you want, as a library, and convert between them. One of the nice things about Rust is that it's low-level enough that almost everything is a library anyway, so the language won't get in your way if you need SomeNicheString.


Since the full bullet point was “UTF-16 or UCS-2 support anywhere outside windows API compatibility routines” I'm assuming you'd get UTF-8 out of any high-level interface.


If you don't need to dynamically evaluate the code, compiling ES.next code will be more performant, e.g. using Babel.


Perhaps you didn't catch that basically the difference between let and var is that let is block-scoped, while var is function-scoped?

  let result = 0;
  for (let i = 0; i < arr.length; i++) {
    result += arr[i];
  }


In general, it looks really good.

- I'd like some more focus on keyboard navigation. Make sure that everything looks good when tabbing, even if you've used arrow keys first.

- Anti-phishing: A long domain name will trim the end in the "More from ..." link. Instead it would make sense to trim the beginning.

- Needs better contrast.


I note that mozilla.org is on that list. Does anybody know if they're affected?


According to [1], only Persona and Firefox Accounts were affected, and were fixed when Amazon patched the vulnerability.

1: https://blog.mozilla.org/security/2014/04/08/heartbleed-secu...


Was he ever that critical? From the article:

> Mr. Obama was a sponsor of a bill in 2005 to raise the standard required for federal agents using ... national security letters ... He joined other Democrats fighting the renewal of the Patriot Act until it was amended to address civil liberties concerns, then voted for its extension in 2006 after a compromise, breaking with Mr. Wyden who voted no.

> “The rhetoric was probably sharper than his votes.” By summer 2008, with the Democratic nomination secured and the White House now a real possibility, Mr. Obama voted for legislation essentially ratifying Mr. Bush’s surveillance programs.


That patch would not be welcome. The patch to make the behavior intuitive is literally to remove "!important" from one CSS file. They're not changing because they're afraid to break the web.


> They're afraid to break the web.

They tried a fix and it broke YouTube. So it seems like a reasonable fear. https://bugzilla.mozilla.org/show_bug.cgi?id=349259#c54

> The patch ... is literally to remove "!important" from one CSS file

It isn't a simple one line fix, as Firefox developer kindly explained. https://bugzilla.mozilla.org/show_bug.cgi?id=349259#c76

>That patch would not be welcome.

They describe what work would be required (and where the changes would likely be) for the patch to be accepted in the bug. https://bugzilla.mozilla.org/show_bug.cgi?id=349259#c80


It's a one-line fix to make it intuitive, but that's not what's needed here. Ultimately there should be some spec so that browser vendors can converge towards a single behavior.


Well, it sure is an official guideline [1].

[1] https://en.wikipedia.org/wiki/Wikipedia:COI


You confuse guideline with policies. Guidelines have a fair bit if leeway, policies have very little wriggle room. If a policy has wriggle room, it's not been drafted very well :-)


I say that because in my observation of companies' PR disasters after Wikipedia editing, the real-world idea of what constitutes COI is quite a bit broader than Wikipedia jargon "COI". Rules-lawyering doesn't convince the papers.

I've done a bit of work liaising with the nicer variety of PR person who really doesn't want to get it wrong - the above is my general advice in these cases.


Consider applying for YC's Summer 2025 batch! Applications are open till May 13

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

Search: