[RFC FS-1149 Discussion] - Support CallerArgumentExpression #797
ijklam
started this conversation in
Language and core library RFC discussions
Replies: 2 comments 3 replies
-
What about the computation expression situations? Is this okay? open System.Runtime.CompilerServices
type Builder() =
member self.Bind(
x, f,
[<CallerArgumentExpression "x">] ?exp : string,
[<CallerArgumentExpression "f">] ?exp2 : string) =
(f x, $"f={exp2.Value}, x={exp.Value}")
member self.Return(x, [<CallerArgumentExpression "x">] ?exp : string) =
(x, $"x={exp.Value}")
let b = Builder()
b { do! () } // (((), "x=do!"), "f=do!, x=()")
b { let! a = 123 in return a } // ((123, "x=a"), "f=return a, x=123")
b {
let! a = 123
let! b = 456
return a + b
} (*
(((579, "x=a + b"), "f=return a + b, x=456"),
"f=let! b = 456
return a + b, x=123")
*) |
Beta Was this translation helpful? Give feedback.
1 reply
-
Should we retain the original newline mark or make it all A.assertEqual("\"abc\"\r\n#line 1\r\n : string", Operators.DefaultArg(FSharpOption<string>.Some("\"abc\"\n#line 1\n : string"), "no value"));
A.assertEqual("(+) 1\r\n#line 1\r\n 123", Operators.DefaultArg(FSharpOption<string>.Some("(+) 1\n#line 1\n 123"), "no value")); |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is a discussion about RFC-1149 Supporting
CallerArgumentExpression
Beta Was this translation helpful? Give feedback.
All reactions