Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I use Rust a lot for my generic scripting around the office. Small tasks like copy a few thousands files, selectively re-naming them based on a group of regexes.

The Regex crate (which I think is being merged with std) uses the same syntax as Python's regexes.

The Path/PathBuf type in std makes manipulating paths easy (and type safe). No more slicing notation/regexes to find where extensions start. Also it handles unix/windows / vs \ for you.

Python DuckTyping slightly drives me insane. What interfaces are/aren't typed feels like Russian roulete. Nothing like the 4000th processed file crashing your script

The real win is compatibility. If you avoid unsafe you don't need to think to port to Linux/MacOS/Windows.

Lastly it's a binary. So to share with a coworker, just copy it. No module management.



> (which I think is being merged with std)

It's on that path, but it's unclear if and when a literal merge into std will happen. Right now, the design of 1.0.0 has been accepted, and once that lands and is released, it will move from "the nursery" to the regualr rust-lang org. From there it could go into std, or it may just stay there forever.


regex has some dependencies, though.

aho-corasick, memchr, thread_local, simd, utf8-ranges

That functionality would have to be in std.

Regex in std would sure be nice, though.


Can be in std without being exposed. libc does this IIRC; the stdlib depends on libc but doesn't expose it.


Right, so this would be one of the questions with moving it into the actual distribution. All of that would have to be replicated in-tree and stabilized separately...


> The Regex crate (which I think is being merged with std)

To add to what Steve said: there are currently no plans to export regex from std.




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

Search: