-
-
Save bstrie/3882357 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn mk_appender(suffix: ~str) -> @fn(~str) -> ~str { | |
return @fn(s: ~str) -> ~str { s + suffix }; // error: mismatched types: expected `fn@(~str) -> ~str` but found `@fn&(~str) -> ~str` (expected fn but found @-ptr) | |
} | |
fn main() { | |
let shout = mk_appender(~"!"); | |
io::println(shout(~"hey ho, let's go")); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn mk_appender(suffix: ~str) -> fn@(~str) -> ~str { | |
return fn@(s: ~str) -> ~str { s + suffix }; | |
} | |
fn main() { | |
let shout = mk_appender(~"!"); | |
io::println(shout(~"hey ho, let's go")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment