TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

A whirlwind tour of object-oriented code in F# (2012)

153 点作者 adgasf将近 6 年前

20 条评论

danite将近 6 年前
I used to be a big Haskell programmer. While I still love the language, I've really come around to the idea that strictly evaluated functional languages like F# or OCaml are the best for programming in. You get the nice functional features but don't have the straightjacket of laziness forcing you into certain design decisions. It's really nice sometimes to be able to mix in impure, side effectful code without having to thread it through a monad. The OCaml family feels like a nice blend of good sound functional features with enough escape hatches to be productive in real world programs that might occasionally need arrays or mutable state or IO. Laziness by default also makes things like debugging or reasoning about performance frustratingly difficult. I do miss Haskell's typeclasses in these languages, though. My ideal language is basically Ocaml/F# but with Haskell's syntax and typeclasses.
评论 #19981988 未加载
评论 #19981597 未加载
评论 #19989121 未加载
评论 #19982776 未加载
sleibrock将近 6 年前
Years ago I was working a miserable job writing boilerplate template code where I had to sub in variables based on certain conditions, it was using a very bland language to look up data from our database and format the output. I wasn&#x27;t allowed to download any software onto my work computer despite having a technical background.<p>So what I did instead to make my life easier was write F# to create a kind of DSL and create the template lookup scripts for me. I did it all from the browser with repl.it, and I generated dozens of scripts and saved myself a lot of time in the process.<p>Now I mostly use Racket, but F# is where I kind of started out. It&#x27;s a fun dialect.
评论 #19981408 未加载
评论 #19984271 未加载
评论 #19982113 未加载
adgasf将近 6 年前
F# is a joy to use. After a certain time, many C# developers find themselves writing in a functional style. F# makes this the default, but lets you continue using all of your existing code.<p>Better yet, Linux and macOS support via .Net Core is excellent. F# on .Net Core is now a powerful alternative to Node.js.
评论 #19981247 未加载
评论 #19981912 未加载
评论 #19982131 未加载
评论 #19981233 未加载
rygxqpbsngav将近 6 年前
Been using F# on personal projects and C# at work. I noticed my C# coding gone high quality once I got into functional thinking. It is highly recommended for anyone to check&#x2F;learn F#. F# is my goto lang. now to competitive programming too. I believe F# and ML will make a great combo, but python is still leading.
rishav_sharan将近 6 年前
Unlike most commentors my experience with F# hasn&#x27;t been stellar. I feel the language itself is well designed and the community is great but there is just so much of it.<p>Any source code that i try to go through is sprinkled with so many new keywords, so many different way of combining stuff, that there seems to be so many syntactical stuff going on. It is really making me struggle.<p>It just feels like a language where the maintainers are going overboard with. And I am sure that once I understand it, I would love it, but the path to get there is so hard.<p>Pretty much no tutorials or articles are out there and reading sources for small projects is not viable for me either due to the keyword noise and too many ways to do something.<p>I did not feel anything like this when I taught myself python, ES6, lua, Crystal etc. F# just feels too big.
评论 #19984974 未加载
评论 #19983852 未加载
GiorgioG将近 6 年前
The problem is F# doesn&#x27;t get enough resources internally at Microsoft. How many times has VS shipped missing the latest version of F# tools? In terms of community, it&#x27;s tiny. If I want to do functional programming, F#&#x2F;.NET isn&#x27;t the strongest option. I have several books on F# and as much as I&#x27;d like to learn&#x2F;use it beyond toying around, I can&#x27;t help but feel like all it&#x27;s worth using for is tinkering (outside of the few shops that use F# extensively.)
评论 #19981335 未加载
评论 #19981590 未加载
评论 #19981401 未加载
评论 #19982460 未加载
melling将近 6 年前
Here’s a Tour of F# by Microsoft:<p><a href="https:&#x2F;&#x2F;docs.microsoft.com&#x2F;en-us&#x2F;dotnet&#x2F;fsharp&#x2F;tour" rel="nofollow">https:&#x2F;&#x2F;docs.microsoft.com&#x2F;en-us&#x2F;dotnet&#x2F;fsharp&#x2F;tour</a>
new4thaccount将近 6 年前
I just bought Scott&#x27;s book on Railway Oriented Domain Driven Design. So far so good. I am the domain expert though, so no revelation there.<p>The modeling of state machines using types and functions is pretty revolutionary to me for where I&#x27;m currently at development skill wise. Everything just seems so clean and elegant.
评论 #19981981 未加载
mikece将近 6 年前
While there&#x27;s nothing you can do in C# that cannot be done in F#, the reverse is not true. The biggest thing that comes to mind is to influence the direction of the other language (C#). I&#x27;ve heard it said many times that if you want to see what features will be in C# in the future, look at F#. Too many features to cite (though Linq is the biggest that comes to mind) were in production use in F# long before they arrived in C#.
评论 #19982314 未加载
评论 #19982058 未加载
nlawalker将近 6 年前
<i>&gt; Anything C# can do...</i><p>Yes, yes, you <i>can</i> do anything in F#, but what <i>should</i> you do?<p>My opinion is that that what F# is missing is a good set of idioms and a strongly opinionated set of guidelines. To my beginner&#x27;s eyes, every F# codebase I&#x27;ve seen feels like it&#x27;s written in a completely different language; it&#x27;s like the opposite of Python&#x27;s &quot;one right way to do everything&quot;.<p>I&#x27;ve heard that F# is great for domain-specific languages, but in most cases a DSL is the cardinal opposite of what I want. I want a <i>common</i> language that I can use to express a multitude of different concepts. It seems like all of the guidance out there about F# is about showing off features, being extremely clever, or using F# to teach functional concepts, not actually about <i>writing useful applications</i>.
评论 #20023935 未加载
joshsyn将近 6 年前
I started F# lately and found it absolutely amazing. I come from heavy C# programming, and always find myself reaching out to have sane default like immutable types.<p>But unfortunately there are still lot of libraries out there for F# which don&#x27;t support .net core fully. Especially db access ones.
macca321将近 6 年前
... and exhaustive matching: <a href="https:&#x2F;&#x2F;github.com&#x2F;mcintyre321&#x2F;OneOf" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mcintyre321&#x2F;OneOf</a><p>I&#x27;m not saying it&#x27;s as good as writing F#, or that C# shouldn&#x27;t include these features of course.
Nelkins将近 6 年前
If you want to try F#, here&#x27;s the full F# compiler in the browser run using WebAssembly. Very fun to play with: <a href="https:&#x2F;&#x2F;tryfsharp.fsbolero.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;tryfsharp.fsbolero.io&#x2F;</a>
评论 #19981495 未加载
bob1029将近 6 年前
I think several interesting points were brought up in this thread regarding the assumption of functional aspects presented in F# by C#. LINQ being the most popular example. I am currently lead to believe that a purely functional application development domain is potentially an overreach of theory in terms of building things that can interact with the real world in very complex and &#x27;functionally-leaky&#x27; ways.<p>My biased perspective as someone who hasn&#x27;t really used F# very much is this: Perhaps an imperative language such as C# 8.0, with a few high-value functional features sprinkled in, is actually the best of both worlds when viewed through the lens of someone who has to interface with really weird business systems. I use imperative techniques for handling remote calls, exception handling, etc. Then, when I need to work with my internal business logic or models, I can use more functional techniques.<p>Based on my own understanding and other comments presented here, C# does not seem to preclude the usage of functional approaches to solving problems if you have the discipline and experience to do so. C# also brings with it a host of other benefits in terms of tooling support and simply being able to find other developers who can understand your codebase.
评论 #19981980 未加载
评论 #19982095 未加载
dmitryminkovsky将近 6 年前
For all the love Microsoft has been getting these days, I still don’t get how I’m supposed to write C# or F# without Visual Studio and Windows. Am I missing something? VSCode doesn’t support these languages, right? I’m a person who spent a long time trying to write Java in Vim, but switched to IntelliJ and wouldn’t want to write C#&#x2F;F# without some comparable IDE.
评论 #19981379 未加载
评论 #19981427 未加载
评论 #19981366 未加载
评论 #19981478 未加载
评论 #19981444 未加载
评论 #19981387 未加载
macca321将近 6 年前
One line data types <a href="https:&#x2F;&#x2F;github.com&#x2F;mcintyre321&#x2F;ValueOf" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mcintyre321&#x2F;ValueOf</a>
holtalanm将近 6 年前
this is really interesting.<p>I&#x27;ve been meaning to dig my teeth into F# sometime soon because of its highly functional base.
pjmlp将近 6 年前
I missed the examples with EF, WPF, Windows Forms, UWP, WCF.
shitgoose将近 6 年前
OO in F#. there goes the language...
评论 #19981534 未加载
评论 #19981617 未加载
评论 #19981382 未加载
lol768将近 6 年前
It&#x27;s a pity the tooling is comparatively immature, with F# (or at least that was my experience last time I tried to develop with it). I think Rider is getting there, though.<p>To go into more detail, the initial implementation in Rider was limited to not much more than syntax highlighting. Inspections were fairly limited, ASP.NET MVC integration was not as featureful.<p>On the C# side, it&#x27;s much more developed and refined. Within Rider, it&#x27;s obviously been the main focus so I suppose it&#x27;s only natural it&#x27;s received more polish.
评论 #19984514 未加载