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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Pattern Matching in a Dynamic OOP Language

14 点作者 danecjensen超过 14 年前

1 comment

riffraff超过 14 年前
I think the author may be interested in looking at user defined/dynamic patterns/extensible matchers or whatever the name is, as seen in F# and Scala<p>Basically where you can define your own pattern rule as a simple method in a class, and later use it for destructuring and matching, e.g.<p><pre><code> var Http= new Regex(stuff with (protocol)(domain)(path)) var Http(protocol,domain,path) = "http://foo.com/bar" # variables protocol="http",domain="foo.com", path="/bar" assigned </code></pre> Which may be there in the language already, but I have not seen it mantioned
评论 #2116713 未加载