Re: [rust-dev] [ANN] RACER integration for Sublime Text

2014-08-25 Thread Phil Dawes
Oops, forgot to CC the list. Gmail strikes again! On Tue, Aug 26, 2014 at 6:13 AM, Phil Dawes rustp...@phildawes.net wrote: This is awesome. A bunch of people have been asking for this so thanks very much for building it. I don't know much about sublime text - does it make sense to bundle

[rust-dev] resolving 'str'

2014-07-26 Thread Phil Dawes
Hello! I'm trying to make racer resolve 'str' types properly. I've read that the separation of type and value namespaces means you can refer both to the 'str' type and the 'str' module[1]. However I would have thought that the 'str' type lives in the type namespace, and according to the reference

[rust-dev] name resolution rule for enum variants?

2014-07-05 Thread Phil Dawes
Hello! I was surprised to find the following compile and run without any bother: #[deriving(Show)] pub enum MyEnum { Path } fn main() { let p = Path::new(/filepath/); let p2 = Path; println!({},p.as_str()); println!({},p2); } % ./run Some(/filepath) Path What is the name

Re: [rust-dev] name resolution rule for enum variants?

2014-07-05 Thread Phil Dawes
:44 PM, Patrick Walton pcwal...@mozilla.com wrote: On 7/5/14 1:43 PM, Phil Dawes wrote: Hello! I was surprised to find the following compile and run without any bother: #[deriving(Show)] pub enum MyEnum { Path } fn main() { let p = Path::new(/filepath/); let p2 = Path

[rust-dev] possible code dump bug (state machine iterator)

2014-04-18 Thread Phil Dawes
Hello everyone, I was trying to create an iterator that used a function pointer to alternate between different states, and ended up core dumping. I've pasted a version that generates the issue on my box (Ubuntu 12.04 LTS, rust-nightly pulled just now). Can anybody reproduce this on their

Re: [rust-dev] possible code dump bug (state machine iterator)

2014-04-18 Thread Phil Dawes
Fackler On Fri, Apr 18, 2014 at 8:30 AM, Ziad Hatahet hata...@gmail.com wrote: Confirm repro on an older rustc version. Ubuntu 13.10 running rustc 0.11-pre (ecc774f 2014-04-11 13:46:45 -0700). -- Ziad On Fri, Apr 18, 2014 at 4:38 AM, Phil Dawes rustp...@phildawes.netwrote: Hello everyone

Re: [rust-dev] Lightweight failure handling

2014-03-27 Thread Phil Dawes
that is absolutely incompatible. I would be happy for a more knowledgeable person to chime in on this point. -- Matthieu On Thu, Mar 27, 2014 at 3:51 AM, Phil Dawes rustp...@phildawes.netwrote: Hi Clark, Thanks for the clarification. To follow your example, there are multiple

[rust-dev] Lightweight failure handling

2014-03-26 Thread Phil Dawes
Hello everyone! I'm interested in using rust for latency sensitive applications. What's the cheapest way to achieve isolation in a native rt environment? I'd like to do something like: let result: ResultFoo, () = task::try(proc() { ... potentually failing code ... }); but as cheaply as

Re: [rust-dev] Lightweight failure handling

2014-03-26 Thread Phil Dawes
On Wed, Mar 26, 2014 at 9:44 PM, Clark Gaebel cg.wowus...@gmail.com wrote: Can't you put that outside your inner loop? Sorry Clark, you've lost me. Which inner loop? ___ Rust-dev mailing list Rust-dev@mozilla.org

Re: [rust-dev] Help needed writing idiomatic rust to pass sequences of strings around

2014-03-25 Thread Phil Dawes
it would theoretically be possible relates to subtyping/type variance.) Huon On 24/03/14 17:36, Phil Dawes wrote: To complete my understanding: is there a reason a 'sufficiently smart compiler' in the future couldn't do this conversion implicitly? I.e. if a function takes a borrowed reference

Re: [rust-dev] Help needed writing idiomatic rust to pass sequences of strings around

2014-03-25 Thread Phil Dawes
Oops, I sent that before I finished editing it. I meant struct StrSlice {start: u8, length: uint} On Tue, Mar 25, 2014 at 4:33 PM, Phil Dawes rustp...@phildawes.net wrote: Thanks Huon, that really cleared things up for me. Dum question: What's the reason for str being a special fat pointer

Re: [rust-dev] Help needed writing idiomatic rust to pass sequences of strings around

2014-03-24 Thread Phil Dawes
of scope)? Thanks, Phil On Sun, Mar 23, 2014 at 7:14 AM, Patrick Walton pcwal...@mozilla.comwrote: On 3/23/14 12:11 AM, Phil Dawes wrote: On Sun, Mar 23, 2014 at 2:04 AM, Patrick Walton pcwal...@mozilla.com mailto:pcwal...@mozilla.com wrote: Why not change the signature

Re: [rust-dev] Help needed writing idiomatic rust to pass sequences of strings around

2014-03-23 Thread Phil Dawes
Great, thanks Patrick + Huon On Sun, Mar 23, 2014 at 7:47 AM, Huon Wilson dbau...@gmail.com wrote: On 23/03/14 18:14, Patrick Walton wrote: On 3/23/14 12:11 AM, Phil Dawes wrote: On Sun, Mar 23, 2014 at 2:04 AM, Patrick Walton pcwal...@mozilla.com mailto:pcwal...@mozilla.com wrote

[rust-dev] Help needed writing idiomatic rust to pass sequences of strings around

2014-03-22 Thread Phil Dawes
Hello!, I'm learning rust and finding myself fighting the language a little and so I could do with a bit of help. In my code completion project I have a function which parses 'use' view items (using libsyntax) and currently returns a vector of vectors of strings representing fully qualified

[rust-dev] Idomatic option handling

2014-03-18 Thread Phil Dawes
Hello! I had my first github patch yesterday - Hatahet kindly cleaned up some code for me. I was using match to destructure the Optionuint output from str.find_str(), but then doing nothing with the None case. He wrote: 'The match expression for options is good for when you want to deal with

Re: [rust-dev] Autocompletion (was: Why we don't like glob use (use std::vec::*)?)

2014-03-13 Thread Phil Dawes
FWIW I've started working on autocomplete functionality for rust. https://github.com/phildawes/racer I'm persuing the 'scan the source code text, incrementally parsing relevant pieces' approach. I'm also learning the language so it's a bit slow going (and will require cleanup as I become more

[rust-dev] locating crate source for code completion

2014-03-05 Thread Phil Dawes
Hello everyone! I've started working on a project to add rust code-completion and assistance for editors + IDEs. https://github.com/phildawes/racer The approach I'm persuing is to scan the source code text, incrementally parsing relevant pieces (lines, blocks) to answer the query. I'm hoping to

[rust-dev] Possible bug? os::args() then split then print

2014-02-25 Thread Phil Dawes
Hello everyone, I might have found a bug. Ubuntu 12.04 LTS, rust master pulled a few hours ago. I've isolated my problem down to the following: fn main() { let arr : ~[str] = std::os::args()[1].split_str(::).collect(); std::io::println(first + arr[0]); std::io::println(first again

Re: [rust-dev] Possible bug? os::args() then split then print

2014-02-25 Thread Phil Dawes
, Phil Dawes rustp...@phildawes.netwrote: fn main() { let arr : ~[str] = std::os::args()[1].split_str(::).collect(); std::io::println(first + arr[0]); std::io::println(first again + arr[0]); } I am working on an older version of the compiler that fails to compile this code

Re: [rust-dev] reader.lines() swallows io errors

2014-02-19 Thread Phil Dawes
tku...@cmu.edu wrote: On Tue, Feb 18, 2014 at 11:52 PM, Phil Dawes rustp...@phildawes.netwrote: Is that not a big problem for production code? I think I'd prefer the default case to be to crash the task than deal with a logic bug. The existence of library functions that swallow errors

[rust-dev] reader.lines() swallows io errors

2014-02-18 Thread Phil Dawes
Hello everyone, I was cutting and pasting the following example from the std lib docs: http://static.rust-lang.org/doc/master/std/io/index.html Iterate over the lines of a file use std::io::BufferedReader; use std::io::File; let path = Path::new(message.txt); let mut file =

Re: [rust-dev] reader.lines() swallows io errors

2014-02-18 Thread Phil Dawes
, this behavior is intentional as it would be annoying for casual uses otherwise. 2014-02-18 17:16 GMT+09:00 Phil Dawes rustp...@phildawes.net: Hello everyone, I was cutting and pasting the following example from the std lib docs: http://static.rust-lang.org/doc/master/std/io/index.html