在Erlang中实现接口

编程入门 行业动态 更新时间:2024-10-27 20:35:52
本文介绍了在Erlang中实现接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何在erlang中实现接口?模块的结构是什么或者如何设置?

How does one implement an interface in erlang? What is the structure of the modules or how is it setup?

我有一个分层架构,想要实现每个层的接口。允许需要下层的层来处理一些任务来访问或调用这些任务。

I have a layered architecture and want to implement the interfaces in each layer. Allowing the layer which requires the below layer to handle some task to access or call for these tasks.

这个接口模块的功能如何看待?

How would this interface module look in terms of functionality?

推荐答案

An interface in the sense of a Java interface or an ML module signature does not exist in the dynamically typed Erlang world. You will have to document the behavior in a comment or provide a -spec contract for the dialyzer to look at.

一般来说,处理语言的最佳方法是不要假设你可以将你现有的知识映射到它中,除非你碰巧知道一个概念中接近的语言。 Erlang附近的语言是Prolog和Scheme。更远的是Python和Ruby,但是他们对OOP设计的依赖使他们进入了视野。任何静态类型,Ocaml,Haskell,Java,C#,C ++等都绝对超出了视野。

In general, the best way to approach a language is by not presuming you can map your existing knowledge too much into it, unless you happen to know a language that is "close" in concepts. Languages close to Erlang are Prolog and Scheme. Farther out comes Python and Ruby, but their reliance on an OOP design puts them into the horizon. Anything statically typed, Ocaml, Haskell, Java, C#, C++ and so on are definitely beyond the horizon.

更多推荐

在Erlang中实现接口

本文发布于:2023-11-16 13:32:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1604738.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:接口   Erlang

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!