什么是“表达问题”? [英] What is the 'expression problem'?

查看:112
本文介绍了什么是“表达问题”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对这是什么有一个粗略的想法,但如果有人解释了他们认为简洁直观的表达问题,我很乐意听到它。

解决方案

观看本讲座

这个想法是你的程序是数据类型和操作的组合超过它。该问题需要一个实现,该实现允许添加新类型和新操作的案例,而不需要重新编译旧模块并保持静态类型安全(不需要强制转换或运行时类型检查)。

有趣的是,在函数式编程语言中很容易添加新的操作,但很难将事例添加到数据类型中。而以OO语言来说,这是相反的。这是两种编程模式之间的重大概念差异之一。


I have a rough idea about what this is but if someone has an explanation of the 'expression problem' that they think is succinct and intuitive I would love to hear it.

解决方案

Watch this lecture.

The idea is that your program is a combination of a datatype and operations over it. The problem asks for an implementation that allows to add new cases of the type and new operations without the need for recompilation of the old modules and keeping static type safety(no casts or runtime type checks).

It's interesting to notice that in functional programming languages it's easy to add new operations, but hard to add cases to the datatype. While in an OO language it's the other way round. This is one of the big conceptual differences between the two programming paradigms.

这篇关于什么是“表达问题”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆