I suggest we ...

Automatic lazy wrapping of argument

Add such that arguments are automatically wrapped in the lazy expression, if set as the type.

for instance:
let (-->) q (p : Lazy<bool>) = not q || (p.Force())

right now i have to write:
false --> lazy (1/0 = 0)

why not make lazy automatic so it becomes:
false --> 1/0 = 0 : True instead of Divide by Zero exception

(while you are at it add a force operator)

8 votes
Vote
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
Anonymous shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

1 comment

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...
  • Don Syme commented  ·   ·  Flag as inappropriate

    We considered this for F# 1.0. In the end we decided against it, partly because of code-readability reasons, and partly because "Lazy" values are not free in F# - they cost a closure and an allocation.

    I don't think we will revisit the decision at this stage.

F# Language

Feedback and Knowledge Base