On Sat, Feb 1, 2014 at 5:54 PM, Kevin Ballard <[email protected]> wrote:
> On Feb 1, 2014, at 2:39 PM, Corey Richardson <[email protected]> wrote:
>
>> The immediate, and most pragmatic, problem is that in today's Rust one cannot
>> easily search for implementations of a trait. Why? `grep 'impl Clone'` is
>> itself not sufficient, since many types have parametric polymorphism. Now I
>> need to come up with some sort of regex that can handle this. An easy
>> first-attempt is `grep 'impl(<.*?>)? Clone'` but that is quite inconvenient 
>> to
>> type and remember. (Here I ignore the issue of tooling, as I do not find the
>> argument of "But a tool can do it!" valid in language design.)
>
> Putting your other arguments aside, I am not convinced by the grep argument.
> With the syntax as it is today, I use `grep 'impl.*Clone'` if I want to find 
> Clone
> impls. Yes, it can match more than just Clone impls. But that's true too even 
> with this
> change. At the very least, any sort of multiline comment or string can 
> contain text that
> matches even the most rigorously specified grep. The only way to truly 
> guarantee you're
> only matching real impls is to actually parse the file with a real parser.
>

Sure. I find the monomorphization and formatting arguments to be more
compelling, personally, but I was initially motivated by a failed
grep.

grep can't find derived implementations, either.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to