Hey

Ahh that makes sense!

Thanks


On 13 November 2013 15:54, Scott Lawrence <[email protected]> wrote:

> I would think that `test()` (the function) is in scope for the duration of
> `let test =`, and then the new definition masks the old one. Similarly,
>
> let x = 2;
> let x = x + 2;
>
> If you change the last line to /call/ test(), you should get an error.
>
>
> On Wed, 13 Nov 2013, Philip Herron wrote:
>
>  Hey all
>>
>> I am still learning but i just tried something which i expected to give an
>> error but works:
>>
>> fn test () -> int {
>>  1
>> }
>>
>> fn main () {
>>  let test = test ();
>>  println (format! ("{}", test));
>> }
>>
>> I guess on compilation the names are mangled against their types or
>> something so you can differentiate between test the function and test the
>> variable. Not sure would be nice to get some clarification what this
>> behavior is.
>>
>> Thanks
>>
>> --Phil
>>
>>
> --
> Scott Lawrence
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to