Re: [rust-dev] Removing ~foo

2014-04-24 Thread Clark Gaebel
Bonus: BoxT, OwnT, HeapT would play nicer with allocators (in terms
of syntax) than ~T.


On Thu, Apr 24, 2014 at 11:52 AM, Bill Myers bill_my...@outlook.com wrote:

  Something like this will work, yes. It'll probably look more like:
 
  Box::new(*x)
 
  This will be described in some of the RFCs that are coming up soon.

 Awesome!

 We should really get rid of the ~T syntax in favor of FooT (where Foo =
 Box, Own, Heap, etc.), since it is deceptively simple for something that
 should in fact be rarely used.


 ___
 Rust-dev mailing list
 Rust-dev@mozilla.org
 https://mail.mozilla.org/listinfo/rust-dev




-- 
Clark.

Key ID : 0x78099922
Fingerprint: B292 493C 51AE F3AB D016  DD04 E5E3 C36F 5534 F907
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] Removing ~foo

2014-04-24 Thread Bill Myers
 Something like this will work, yes. It'll probably look more like:
 
 Box::new(*x)
 
 This will be described in some of the RFCs that are coming up soon.

Awesome!

We should really get rid of the ~T syntax in favor of FooT (where Foo = Box, 
Own, Heap, etc.), since it is deceptively simple for something that should in 
fact be rarely used.

  
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] Removing ~foo

2014-04-23 Thread Niko Matsakis
On Wed, Apr 16, 2014 at 12:21:20AM -0400, comex wrote:
 If I have x: [char, ..5], I can use ~*x to get an owned version
 without a lot of typing.  Would it be too insane to have that work for
 [char] or str with DST?

Something like this will work, yes. It'll probably look more like:

Box::new(*x)

This will be described in some of the RFCs that are coming up soon.


Niko
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


[rust-dev] Removing ~foo

2014-04-15 Thread Patrick Walton

Hi everyone,

I'd like to remove the `~foo` literal syntax for owned strings in both 
expressions and patterns. After dynamically sized types, this syntax is 
the last remnant of the strange parser behavior by which the parser does 
something different for `~foo` and `~(foo)` (i.e. by which it looks 
at the next token when it sees a sigil and does something different than 
it would otherwise).


The new replacement for `~foo` will be `foo.to_owned()`. You can 
also use the `fmt!()` macro or the `.to_str()` function. Post-DST, you 
will likely also be able to write `Heap::from(foo)`.


This has no effect on constants since `~foo` is not allowed there anyway.

Patrick
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] Removing ~foo

2014-04-15 Thread Steve Klabnik
I can finally retire that bookmark to
https://mail.mozilla.org/pipermail/rust-dev/2013-April/003867.html !
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] Removing ~foo

2014-04-15 Thread Ziad Hatahet
On Tue, Apr 15, 2014 at 10:20 AM, Steve Klabnik st...@steveklabnik.comwrote:

 I can finally retire that bookmark to
 https://mail.mozilla.org/pipermail/rust-dev/2013-April/003867.html !



How will that change though? Won't we still have to call `.equiv()`?

Furthermore, wasn't the plan to use `box(string)` to create owned
pointers?

--
Ziad
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] Removing ~foo

2014-04-15 Thread SiegeLord

On 04/15/2014 01:12 PM, Patrick Walton wrote:

The new replacement for `~foo` will be `foo.to_owned()`. You can
also use the `fmt!()` macro or the `.to_str()` function. Post-DST, you
will likely also be able to write `Heap::from(foo)`.


Why not `box foo`? Is that scheduled to break?

-SL

___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] Removing ~foo

2014-04-15 Thread Corey Richardson
`box foo` would create a SomeBox'static str, as outlined in the
meeting notes:

box foo - Heap'static Str
foo.to_owned() - HeapStr (or ~Str)
Heap::from(foo) - HeapStr (or ~Str)
Rc::from(foo) - RcStr

On Tue, Apr 15, 2014 at 2:06 PM, SiegeLord slab...@aim.com wrote:
 On 04/15/2014 01:12 PM, Patrick Walton wrote:

 The new replacement for `~foo` will be `foo.to_owned()`. You can
 also use the `fmt!()` macro or the `.to_str()` function. Post-DST, you
 will likely also be able to write `Heap::from(foo)`.


 Why not `box foo`? Is that scheduled to break?

 -SL


 ___
 Rust-dev mailing list
 Rust-dev@mozilla.org
 https://mail.mozilla.org/listinfo/rust-dev



-- 
http://octayn.net/
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] Removing ~foo

2014-04-15 Thread Ziad Hatahet
So the new Vec and Str/StrBuf types are all reference types, correct?
What happens if we pass around a borrowed or owned pointer to one of these
types? Won't there be an extra level of indirection to get to the
underlying data pointer?

--
Ziad


On Tue, Apr 15, 2014 at 11:10 AM, Corey Richardson co...@octayn.net wrote:

 `box foo` would create a SomeBox'static str, as outlined in the
 meeting notes:

 box foo - Heap'static Str
 foo.to_owned() - HeapStr (or ~Str)
 Heap::from(foo) - HeapStr (or ~Str)
 Rc::from(foo) - RcStr

 On Tue, Apr 15, 2014 at 2:06 PM, SiegeLord slab...@aim.com wrote:
  On 04/15/2014 01:12 PM, Patrick Walton wrote:
 
  The new replacement for `~foo` will be `foo.to_owned()`. You can
  also use the `fmt!()` macro or the `.to_str()` function. Post-DST, you
  will likely also be able to write `Heap::from(foo)`.
 
 
  Why not `box foo`? Is that scheduled to break?
 
  -SL
 
 
  ___
  Rust-dev mailing list
  Rust-dev@mozilla.org
  https://mail.mozilla.org/listinfo/rust-dev



 --
 http://octayn.net/
 ___
 Rust-dev mailing list
 Rust-dev@mozilla.org
 https://mail.mozilla.org/listinfo/rust-dev

___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] Removing ~foo

2014-04-15 Thread Daniel Micay
On 15/04/14 02:25 PM, Ziad Hatahet wrote:
 So the new Vec and Str/StrBuf types are all reference types, correct?
 What happens if we pass around a borrowed or owned pointer to one of
 these types? Won't there be an extra level of indirection to get to the
 underlying data pointer?

There's close to no reason to store `VecT` or `StrBuf` in an owned
box, and very little reason to pass around a reference to them. You can
obtain a slice (either [T] or mut [T]) into `VecT` and the same goes
for strings.



signature.asc
Description: OpenPGP digital signature
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] Removing ~foo

2014-04-15 Thread Brian Anderson

On 04/15/2014 10:12 AM, Patrick Walton wrote:

Hi everyone,

I'd like to remove the `~foo` literal syntax for owned strings in both
expressions and patterns. After dynamically sized types, this syntax is
the last remnant of the strange parser behavior by which the parser does
something different for `~foo` and `~(foo)` (i.e. by which it looks
at the next token when it sees a sigil and does something different than
it would otherwise).

The new replacement for `~foo` will be `foo.to_owned()`. You can
also use the `fmt!()` macro or the `.to_str()` function. Post-DST, you
will likely also be able to write `Heap::from(foo)`.

This has no effect on constants since `~foo` is not allowed there anyway.



Thanks, Patrick. Full steam ahead. Let's get DST done.

___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] Removing ~foo

2014-04-15 Thread Ziad Hatahet
Would it be worth introducing an own!() macro for this purpose? I came
across this suggestion on the reddit thread:
http://www.reddit.com/r/rust/comments/2340zb/rustdev_removing_foo/

--
Ziad


On Tue, Apr 15, 2014 at 10:12 AM, Patrick Walton pcwal...@mozilla.comwrote:

 Hi everyone,

 I'd like to remove the `~foo` literal syntax for owned strings in both
 expressions and patterns. After dynamically sized types, this syntax is the
 last remnant of the strange parser behavior by which the parser does
 something different for `~foo` and `~(foo)` (i.e. by which it looks at
 the next token when it sees a sigil and does something different than it
 would otherwise).

 The new replacement for `~foo` will be `foo.to_owned()`. You can also
 use the `fmt!()` macro or the `.to_str()` function. Post-DST, you will
 likely also be able to write `Heap::from(foo)`.

 This has no effect on constants since `~foo` is not allowed there anyway.

 Patrick
 ___
 Rust-dev mailing list
 Rust-dev@mozilla.org
 https://mail.mozilla.org/listinfo/rust-dev

___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] Removing ~foo

2014-04-15 Thread Daniel Micay
On 15/04/14 04:28 PM, Ziad Hatahet wrote:
 Would it be worth introducing an own!() macro for this purpose? I came
 across this suggestion on the reddit
 thread: http://www.reddit.com/r/rust/comments/2340zb/rustdev_removing_foo/
 
 --
 Ziad

I think using the term own for that would greatly increase confusion.

An unboxed value is just as owned as one placed in an owned box. I don't
really think we need any sugar beyond `to_owned()` for allocating memory
dynamically and copying over a string.



signature.asc
Description: OpenPGP digital signature
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] Removing ~foo

2014-04-15 Thread comex
On Tue, Apr 15, 2014 at 1:12 PM, Patrick Walton pcwal...@mozilla.com wrote:
 Hi everyone,

 I'd like to remove the `~foo` literal syntax for owned strings in both
 expressions and patterns. After dynamically sized types, this syntax is the
 last remnant of the strange parser behavior by which the parser does
 something different for `~foo` and `~(foo)` (i.e. by which it looks at
 the next token when it sees a sigil and does something different than it
 would otherwise).

If I have x: [char, ..5], I can use ~*x to get an owned version
without a lot of typing.  Would it be too insane to have that work for
[char] or str with DST?
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev