On Sat, 4 Feb 2012, Patrick Walton wrote:

On 02/04/2012 06:21 AM, Arne Döring wrote:
The second suggestion is concerning tho #fmt macro. #fmt works like
printf, but its string is parsed at compile time, so that errors might
be thrown when the string is incorrect. So when you unwind this format
string at compile time, you know also all variable names and their
types from scope. So it might be more natural to directly import
variable names from the scope inside of the String, like it is done in
many scripting languages. This is also done in tho Programming
language Nemerle.

Well, #fmt is a macro, and I would generally be opposed to macros implicitly capturing the local variables in scope -- that's unhygienic.

Personally I do not see the difference between
  #fmt("%s", some_str)
and
  #fmt("$some_str");
as far as hygiene is concerned. In both cases the variable is provided by the user of the macro, it is just in the later case the variable happens to be embedded within a string.
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to