从静态类型到动态类型 [英] From Static Typing to Dynamic Typing

查看:113
本文介绍了从静态类型到动态类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用静态类型语言(C / C ++,Java)。我一直在玩Clojure,我真的很喜欢。

I have always worked on statically typed languages (C/C++, Java). I have been playing with Clojure and I really like it.

我担心的一件事是说,我有一个窗口,需要3个模块作为参数,沿着方式的要求改变,我需要传递另一个模块到函数。我只是更改函数,编译器抱怨到处使用它。但在Clojure它不会抱怨直到函数被调用。我可以只做一个正则表达式搜索和替换,但它似乎有一个机会错过一个调用,它会被忽视,直到该函数实际上被调用。

One thing I am worried about is: say that I have a windows that takes 3 modules as arguments and along the way the requirements change and I need to pass another module to the function. I just change the function and the compiler complains everywhere I used it. But in Clojure it won't complain until the function is called. I can just do a regex search and replace but it seems there is a chance to miss a call and it will go unnoticed until that function is actually called. How do you guys deal with this?

推荐答案

这是自动测试/测试驱动开发更重要的原因之一动态类型语言。我没有使用Clojure(我大多使用Ruby),所以不幸的是我不能推荐一个特定的测试框架。

This is one of the reasons automated testing/test driven development is even more important in dynamically typed languages. I haven't used Clojure (I mostly use Ruby), so unfortunately I can't recommend a specific testing framework.

这篇关于从静态类型到动态类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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