<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/src/libstd/fmt/parse.rs, branch try</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=try</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=try'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2014-05-08T16:35:59+00:00</updated>
<entry>
<title>std: Extract format string parsing out of libstd</title>
<updated>2014-05-08T16:35:59+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-05-06T16:52:53+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=80487ddcadda819e709beb9b996b12d322aa11a6'/>
<id>urn:sha1:80487ddcadda819e709beb9b996b12d322aa11a6</id>
<content type='text'>
This code does not belong in libstd, and rather belongs in a dedicated crate. In
the future, the syntax::ext::format module should move to the fmt_macros crate
(hence the name of the crate), but for now the fmt_macros crate will only
contain the format string parser.

The entire fmt_macros crate is marked #[experimental] because it is not meant
for general consumption, only the format!() interface is officially supported,
not the internals.

This is a breaking change for anyone using the internals of std::fmt::parse.
Some of the flags have moved to std::fmt::rt, while the actual parsing support
has all moved to the fmt_macros library.

[breaking-change]
</content>
</entry>
<entry>
<title>librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, except</title>
<updated>2014-05-07T06:12:54+00:00</updated>
<author>
<name>Patrick Walton</name>
<email>pcwalton@mimiga.net</email>
</author>
<published>2014-05-06T01:56:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=090040bf4037a094e50b03d79e4baf5cd89c912b'/>
<id>urn:sha1:090040bf4037a094e50b03d79e4baf5cd89c912b</id>
<content type='text'>
for `~str`/`~[]`.

Note that `~self` still remains, since I forgot to add support for
`Box&lt;self&gt;` before the snapshot.

How to update your code:

* Instead of `~EXPR`, you should write `box EXPR`.

* Instead of `~TYPE`, you should write `Box&lt;Type&gt;`.

* Instead of `~PATTERN`, you should write `box PATTERN`.

[breaking-change]
</content>
</entry>
<entry>
<title>Replace most ~exprs with 'box'. #11779</title>
<updated>2014-05-03T06:00:58+00:00</updated>
<author>
<name>Brian Anderson</name>
<email>banderson@mozilla.com</email>
</author>
<published>2014-04-25T08:08:02+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a5be12ce7e88c1d28de1c98215991127d1e765f0'/>
<id>urn:sha1:a5be12ce7e88c1d28de1c98215991127d1e765f0</id>
<content type='text'>
</content>
</entry>
<entry>
<title>std,syntax: make std::fmt::parse use `Vec`s.</title>
<updated>2014-04-10T22:21:58+00:00</updated>
<author>
<name>Huon Wilson</name>
<email>dbau.pp+github@gmail.com</email>
</author>
<published>2014-04-09T01:46:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=1403b35be70d30fccdf68378b3555d1ce74e852b'/>
<id>urn:sha1:1403b35be70d30fccdf68378b3555d1ce74e852b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>std: Switch field privacy as necessary</title>
<updated>2014-03-31T22:17:12+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-03-27T22:09:47+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=9a3d04ae7629f6f273643b3a14f106726842be6a'/>
<id>urn:sha1:9a3d04ae7629f6f273643b3a14f106726842be6a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>libstd: Document the following modules:</title>
<updated>2014-03-25T17:12:49+00:00</updated>
<author>
<name>Patrick Walton</name>
<email>pcwalton@mimiga.net</email>
</author>
<published>2014-03-16T22:59:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a424e84a3e0157f3f0160ae366ba469457cb6295'/>
<id>urn:sha1:a424e84a3e0157f3f0160ae366ba469457cb6295</id>
<content type='text'>
* native::io
* std::char
* std::fmt
* std::fmt::parse
* std::io
* std::io::extensions
* std::io::net::ip
* std::io::net::udp
* std::io::net::unix
* std::io::pipe
* std::num
* std::num::f32
* std::num::f64
* std::num::strconv
* std::os
</content>
</entry>
<entry>
<title>use TotalEq for HashMap</title>
<updated>2014-03-23T05:59:11+00:00</updated>
<author>
<name>Daniel Micay</name>
<email>danielmicay@gmail.com</email>
</author>
<published>2014-03-22T20:30:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=3829ac2a52f12b08501cb25d82de32f39fbe801e'/>
<id>urn:sha1:3829ac2a52f12b08501cb25d82de32f39fbe801e</id>
<content type='text'>
Closes #5283
</content>
</entry>
<entry>
<title>std: Change assert_eq!() to use {} instead of {:?}</title>
<updated>2014-03-01T07:01:54+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-02-28T09:23:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=02882fbd7edcb8d0d152afcdc8571216efcbd664'/>
<id>urn:sha1:02882fbd7edcb8d0d152afcdc8571216efcbd664</id>
<content type='text'>
Formatting via reflection has been a little questionable for some time now, and
it's a little unfortunate that one of the standard macros will silently use
reflection when you weren't expecting it. This adds small bits of code bloat to
libraries, as well as not always being necessary. In light of this information,
this commit switches assert_eq!() to using {} in the error message instead of
{:?}.

In updating existing code, there were a few error cases that I encountered:

* It's impossible to define Show for [T, ..N]. I think DST will alleviate this
  because we can define Show for [T].
* A few types here and there just needed a #[deriving(Show)]
* Type parameters needed a Show bound, I often moved this to `assert!(a == b)`
* `Path` doesn't implement `Show`, so assert_eq!() cannot be used on two paths.
  I don't think this is much of a regression though because {:?} on paths looks
  awful (it's a byte array).

Concretely speaking, this shaved 10K off a 656K binary. Not a lot, but sometime
significant for smaller binaries.
</content>
</entry>
<entry>
<title>Transition to new `Hash`, removing IterBytes and std::to_bytes.</title>
<updated>2014-02-23T20:44:10+00:00</updated>
<author>
<name>Huon Wilson</name>
<email>dbau.pp+github@gmail.com</email>
</author>
<published>2014-02-23T10:29:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=efaf4db24c92e119e26dc575ffd6bfd3b91fb87d'/>
<id>urn:sha1:efaf4db24c92e119e26dc575ffd6bfd3b91fb87d</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Remove std::condition</title>
<updated>2014-02-06T23:48:56+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-02-05T03:02:10+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=454882dcb7fdb03867d695a88335e2d2c8f7561a'/>
<id>urn:sha1:454882dcb7fdb03867d695a88335e2d2c8f7561a</id>
<content type='text'>
This has been a long time coming. Conditions in rust were initially envisioned
as being a good alternative to error code return pattern. The idea is that all
errors are fatal-by-default, and you can opt-in to handling the error by
registering an error handler.

While sounding nice, conditions ended up having some unforseen shortcomings:

* Actually handling an error has some very awkward syntax:

    let mut result = None;
    let mut answer = None;
    io::io_error::cond.trap(|e| { result = Some(e) }).inside(|| {
        answer = Some(some_io_operation());
    });
    match result {
        Some(err) =&gt; { /* hit an I/O error */ }
        None =&gt; {
            let answer = answer.unwrap();
            /* deal with the result of I/O */
        }
    }

  This pattern can certainly use functions like io::result, but at its core
  actually handling conditions is fairly difficult

* The "zero value" of a function is often confusing. One of the main ideas
  behind using conditions was to change the signature of I/O functions. Instead
  of read_be_u32() returning a result, it returned a u32. Errors were notified
  via a condition, and if you caught the condition you understood that the "zero
  value" returned is actually a garbage value. These zero values are often
  difficult to understand, however.

  One case of this is the read_bytes() function. The function takes an integer
  length of the amount of bytes to read, and returns an array of that size. The
  array may actually be shorter, however, if an error occurred.

  Another case is fs::stat(). The theoretical "zero value" is a blank stat
  struct, but it's a little awkward to create and return a zero'd out stat
  struct on a call to stat().

  In general, the return value of functions that can raise error are much more
  natural when using a Result as opposed to an always-usable zero-value.

* Conditions impose a necessary runtime requirement on *all* I/O. In theory I/O
  is as simple as calling read() and write(), but using conditions imposed the
  restriction that a rust local task was required if you wanted to catch errors
  with I/O. While certainly an surmountable difficulty, this was always a bit of
  a thorn in the side of conditions.

* Functions raising conditions are not always clear that they are raising
  conditions. This suffers a similar problem to exceptions where you don't
  actually know whether a function raises a condition or not. The documentation
  likely explains, but if someone retroactively adds a condition to a function
  there's nothing forcing upstream users to acknowledge a new point of task
  failure.

* Libaries using I/O are not guaranteed to correctly raise on conditions when an
  error occurs. In developing various I/O libraries, it's much easier to just
  return `None` from a read rather than raising an error. The silent contract of
  "don't raise on EOF" was a little difficult to understand and threw a wrench
  into the answer of the question "when do I raise a condition?"

Many of these difficulties can be overcome through documentation, examples, and
general practice. In the end, all of these difficulties added together ended up
being too overwhelming and improving various aspects didn't end up helping that
much.

A result-based I/O error handling strategy also has shortcomings, but the
cognitive burden is much smaller. The tooling necessary to make this strategy as
usable as conditions were is much smaller than the tooling necessary for
conditions.

Perhaps conditions may manifest themselves as a future entity, but for now
we're going to remove them from the standard library.

Closes #9795
Closes #8968
</content>
</entry>
</feed>
