Which reserved keyword in the F# language spec sho

2020-06-16 02:58发布

Now the FSharp v1 has gone into Beta it's time to ask about vNext.

The FSharp language spec defines the following reserved keywords:

atomic break checked component const constraint constructor    
continue eager fixed fori functor include    
method mixin object parallel params process protected pure    
sealed tailcall trait virtual volatile 

which of these would you like to see implemented and why?

One keyword per answer please.

标签: f#
5条回答
虎瘦雄心在
2楼-- · 2020-06-16 03:36

I'm somehow not able to follow your link, but in case atomic applies to builtin software transactional memory, this is my favorite.

查看更多
叛逆
3楼-- · 2020-06-16 03:37

trait, assuming trait is something like Scala traits.

查看更多
Lonely孤独者°
4楼-- · 2020-06-16 03:40

Good question but hard to answer. You can't guess exactly the purpose of each reserved keyword, right?

From my perspective, I could see some useful use cases for fixed (fixed size buffers).

查看更多
叛逆
5楼-- · 2020-06-16 03:42

I'd vote for eager, if it meant that evaluation was lazy by default (like in Haskell, but unlike current F#).

查看更多
在下西门庆
6楼-- · 2020-06-16 03:46

My vote is for tailcall.

If I understand the intention correctly this would be a keyword to mark recursive functions the author would intend to be tail recursive. If for whatever reason the compiler cannot comply, a diagnostic message can be of great help.

As it stands now if you fail to structure your recursive function properly the first time you will be informed about this is the StackOverflow exception (No pan intended)

查看更多
登录 后发表回答