9 ms·
Rust 1.53
- BelenusMordred 5y ago> Identifiers can now contain non-ascii characters. All valid identifier characters in Unicode as defined in UAX #31 can now be used. That includes characters from many different scripts and languages, but does not include emoji. Don't despair fellow emoji devs, our time will come soon enough.
- kbelder 5y agoHere's our new feature. Please, never use it.
- jagger27 5y agoIn the English speaking world, I have a hard time justifying untypeable identifiers. Maybe, and this is a fat maybe, Greek symbols could make the odd write-once math or scientific code easier to read. It would be bonkers to use any non-ascii codepoints in a public API.
- beforeolives 5y ago> Maybe, and this is a fat maybe, Greek symbols could make the odd write-once math or scientific code easier to read. The Julia community has been trying really hard to convince people that this is a good idea and I'm still not on board with it.
- high_density 5y agomaybe we can have some keyboard plugin/"mode" that merges letters to form symbols in special way? Korean windows have a "special-emoji" keyboard that can be invoked by: 1. type a charactor 2. press 'hanja' key 3. (wild special character selection menu appears) example: § (from 'ㅁ') / ㈜ (from 'ㅁ') / ㎖ (from 'ㄹ')
- kibwen 5y agoMost Linux environments already have this, it's called "compose key". You may need to enable it in your desktop environment's settings, but then after pressing the key you can press !? to type ‽, 12 to type ½, <= to type ≤, n~ to type ñ, <3 to type ♥, etc. Here's GTK's list: https://help.ubuntu.com/community/GtkComposeTable https://help.ubuntu.com/community/GtkComposeTable
- mynameisash 5y agoIt would be nice if this were built into Windows, but in lieu of that, I have been using WinCompose[0] for several years for typing diacritics (as part of my learning French). For example: * ALT e' = é * ALT u " = ü * ALT n ~ = ñ It's not limited to diacritics; you can type ligatures (ALT ae = æ), extended characters (ALT [/] = ), I assume the majority of UTF (ALT #G = 𝄞) and so on. And yes, even emoji (ALT ALT alembic = ) edit: apparently, HN won't show the checkbox (U+2611) or alembic[1]. [0] http://wincompose.info/ http://wincompose.info/ [1] https://emojipedia.org/alembic/ https://emojipedia.org/alembic/
- jcranmer 5y ago> It would be nice if this were built into Windows, but in lieu of that Something that's basically equivalent is builtin. Just switch your keyboard from EN-US to EN-INTL, and now several accent characters become dead keys, so ' e = é, etc.
- borodi 5y agoJulia does this in a pretty simple way, you type \lamdba then press tab and it becomes λ, emojis and many other things work like this, so typing them is very wasy.
- wongarsu 5y agoFor Windows, the ENG-INTL keyboard layout is pretty good for simple accented characters, covering latin-based European languages [1]. Windows+. also allows you to just type to search for emojis, so e.g. typing WINDOWS+. sad ENTER gives you a sad emoji. Sadly this doesn't work for symbols, even though the Windows+. menu has a good coverage of symbols. I guess you can always switch your keyboard to Korean input. 1: https://community.windows.com/en-us/stories/keyboard-shortcuts-for-typing-accent-marks-over-letters-in-windows-10 https://community.windows.com/en-us/stories/keyboard-shortcu...
- BadInformatics 5y agoIt helps here to have good shortcuts (i.e. \tex like commands) for all the symbols. Otherwise writing them is a PITA and nobody will do it (e.g. Go supports full unicode identifiers, when was the last time you saw one in the wild?)
- buzer 5y ago> Go supports full unicode identifiers, when was the last time you saw one in the wild? Back when someone used them to add pseudo-generics https://old.reddit.com/r/rust/comments/5penft/parallelizing_enjarify_in_go_and_rust/dcsgk7n/ https://old.reddit.com/r/rust/comments/5penft/parallelizing_...
- remexre 5y agoScientific computing is actually a use-case I see this working well in; IMO, it's perfectly fine to have terse code that exactly matches up to equations in a longer paper that justifies correctness, etc. (as long as the paper is easy to find from the code!)
- nonameiguess 5y agoThis is the one thing I used to love about Maple back in college. You can compute directly with mathematical symbols, draw matrices and rational numbers the same way you would on paper, and the language runtime understands it. Too bad it's a $5000 license or whatever.
- kadoban 5y agoIt's really not hard at all to make them typeable, it just requires some minor setup (use an IME). Still doesn't necessarily mean it's a good idea, but it's not a total blocker.
- freeopinion 5y agoYour statement here has so many qualifiers that it's hard to treat it as a general rule. "English speaking world" "untypeable" "public API" Even then you exempt Greek symbols. I suppose you might be willing to accept ¢ or €. Of course, "untypeable" is very ambiguous. Still, not all code is "public API" and not all code is intended for the English speaking world. So I think it's great to support non-ASCII symbols. よろしく
- jagger27 5y agoI was not trying to argue against its general support, only that for this English-speaking audience (HN) there are very limited use cases.
- runarberg 5y agoEven if english speaking, it is still ambiguous. For example in my keyboard the micro sign (µ; not to be confused with the Greek small letter mu) is easy to type (AltGr + M). I bet this is the same for the majority of HN users. The US keyboard doesn’t use third level shift (usually AltGr) so most people that use US keyboard exclusively are unaware of this. Whenever I see people using the Latin small letter U (u) instead of the micro sign, all I think about is how restrictive the US keyboard actually is, and how much of a shame it is that the culture which predominantly uses this restrictive keyboard design came to be the dominant when designing computer interfaces.
- jdrek1 5y ago> For example in my keyboard the micro sign (µ; not to be confused with the Greek small letter mu) The greek letter mu IS the micro sign, where do you think it comes from?
- runarberg 5y agoLook the same, but different code points. MICRO SIGN (U+00B5)[1] vs. GREEK SMALL LETTER MU (U+03BC)[2] 1: https://www.fileformat.info/info/unicode/char/00b5/index.htm https://www.fileformat.info/info/unicode/char/00b5/index.htm 2: https://www.fileformat.info/info/unicode/char/03bc/index.htm https://www.fileformat.info/info/unicode/char/03bc/index.htm
- Pet_Ant 5y agoI like to use the poop emoji in the names of methods that are dangerous hacks that we want to (eventually) get rid of. Being harder to type is part of the point.
- airhead969 5y agoCan't you just use poop emoji in comments and search for them like TODOs?
- Peckingjay 5y agoI assume making the name of the function they want to eventually get rid of more annoying to type is part of the reason to do this rather than just tracking ones needing replacement.
- Pet_Ant 5y agoBut then others won't feel dirty when they use the method. The goal is to make people feel bad when they add more usages of it and make it harder to remove. This is the case when it's easier and faster than the proper way. When there is crunch time it's hard to push your lead to reject the PR so it's soft pressure and it's apparent at the call site whereas a TODO in the method definition is not.
- kibwen 5y agoThere is a famous story of a codebase that used `sleep` calls for this purpose. Start by sleeping 1 ms every time that the undesired function is called. Next release, up it to 10 ms, then 100 ms, and so on.
- dllthomas 5y agoReminds me of Haskell's tendency to prepend "unsafe" (or, in one case where that was insufficiently dire, "accursedUnutterable"), although the use case is a little different.
- airhead969 5y agoBut that's method shaming! /s I guess you have a point. It's clearly a "let's meet in the back alley" API.
- vvillena 5y agoThere's lots of non-english codebases out there, supporting symbols for their languages is a big deal. In a way, it's in part a job for the dev tools. Autocomplete engines should be able to complete these symbols from an ascii-only hint. 'a' should offer "α" as one of the completion options, and 'bla' should offer "BLÅHAJ".
- TazeTSchnitzel 5y agoThey're hard to type if you're a Windows user. Other OSes have better input systems.
- dt12345 5y agoI tried doing this once, but it's not worth the pain of having to switch keyboards or copy-paste symbols
- dllthomas 5y agohttps://en.m.wikipedia.org/wiki/Compose_key https://en.m.wikipedia.org/wiki/Compose_key
- airhead969 5y agoAnimated GIF meme identifier devs of the world unite! We will overthrow this repressive violence against our kind. Baby dance will be the next "Hello, world!"
- Symmetry 5y agoSoon we'll be able to do the equivalent of the C++ typedef shared_ptr<Foo> Foo STAR_EMOJI; EDIT: My star emoji doesn't seem to be showing up in HN posts so image that STAR_EMOJI is actually https://emojipedia.org/star/ https://emojipedia.org/star/
- flippinburgers 5y agoI cannot understand how this new "feature" could be considered a good idea.
- GolDDranks 5y agoAt last, I'm able to pass bona fide stack-allocated iterators of a few elements into things. I'm very happy with this newly gained array neatness.
- Arnavion 5y agoYou didn't have to wait for this release. `std::array::IntoIter::new()` was stabilized earlier already. This release just adds places where you don't have to write that explicitly any more.
- divtiwari 5y agoShould one learn Rust, lets say after 3-4 years, i.e by mid 2020s, once it becomes more mainstream? The syntax of Rust is a mix of OCaml/C++ and I feel some of the concepts are very esoteric for a normal enterprise Java/C#/JS/Python developer, so it takes a lot of cognitive overload to master it. So is it worth learning now or later?
- skywal_l 5y agoYou can spend the time on it since you will make it up by not having to worry about your awful C++ dependency/build system which is the language targeted by rust to replace (/complement) ;)
- divtiwari 5y agoDo you recommend it for those developers not working in the C/C++ space?
- deleted 5y ago[deleted]
- dthul 5y agoWhether you should learn it or not I can't answer, but I want to mention that I personally don't feel anything in Rust is very esoteric. Python's metaclasses or JavaScript's prototype object model feel more unusual to me than anything I encountered in Rust. If you have never written in an unmanaged language like C++ though I could see that a lot of Rust feels foreign.
- cgh 5y agoLifetimes qualify as esoteric, I think. They seem unique to Rust (please correct me if wrong) and are not immediately intuitive.
- duped 5y agoC++ developers deal with lifetimes all the time (grep for "outlive" in a large codebase, for example). It just isn't baked into the language. The notion of the "lifetime" is fundamental to systems programming, particularly when dealing with concurrency. It's quite natural to folks who are used to dealing with use-after-free/use-after-move and iterator invalidation bugs, imo.
- ashton314 5y agoI love the `|` matching anywhere in a pattern. That will certainly cut down on a lot of code and improve readability.
- nonameiguess 5y agoI just recompiled rustc on my Linux From Scratch desktop. I guess I should have timed it, but it sure felt a lot faster. Finished when I wasn't even paying attention. Went from 9 failed tests on 1.52.1 to 13 on 1.53.0. I'm not expecting Firefox to compile, but that's entirely on Mozilla.
- sakawa 5y agoI'm a little OT (sorry), but I am wondering if is there a way to learn Rust while keeping up with the changes made from last edition (Rust 2018, which is 1.31)?
- steveklabnik 5y agoNot specifically, changes since then have landed in all editions. We did have a doc that described the full set of changes, but people didn't like it, so it got removed.
- ostenning 5y agoI love the non-ascii character support although for me as an English speaker I wouldn't use it, but I'm sure there many Asian teams that would appreciate these changes struct 人 { 名字: String, }
- Svetlitski 5y agoSweet, cmp::min_by_key and cmp::max_by_key have finally been stabilized. Was sorely missing this little convenience in Rust, as it helps express a particular idea more clearly and succinctly. Also the improvement to compile times on macOS due to the change in how debug info is stored is a nice productivity boost.