对您来说,编程语言最重要的属性是什么?

发布于 2024-09-12 06:02:54 字数 328 浏览 1 评论 0原文

对我来说,它是:强类型

维基百科

“强类型”意味着编程语言对允许发生的混合设置了严格的限制,防止以被认为无效的方式使用数据的源代码的编译或运行

为什么它很重要?因为我更喜欢编译错误而不是运行时错误

我想最好提供一些信息和一些重要的原因。

For me it is : strong type

Wikipedia:

"strong typing" implies that the programming language places severe restrictions on the intermixing that is permitted to occur, preventing the compiling or running of source code which uses data in what is considered to be an invalid way

Why it is important? Because I love compile error much more than runtime error.

I guess it is better to supply some information and some reasons why it is important.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

凝望流年 2024-09-19 06:02:54

表现力。

也就是说,它可以轻松表达设计和想法,并且不需要技术解决方法即可使设计发挥作用。

Expressiveness.

That is, it makes it easy to express the design and ideas and does not require technical workarounds to make a design work.

未蓝澄海的烟 2024-09-19 06:02:54

它完成了工作。我认为熟悉一种以上语言是件好事。尽管我很喜欢 C#,但我并不认为它在所有方面都是最好的。所以对我来说,我只是看看手头的任务和一些要求,然后尝试选择最匹配的语言。

It gets the job done. I think it's good to be familiar with more than one language. As much as I enjoy C# I don't think it is the best at everything. So for me I just look at the task at hand and what are some of the requirements and then try to choose a language that best matches.

〆一缕阳光ご 2024-09-19 06:02:54

1) 强类型以及支持它的功能

C#/Java v1.0 是强类型语言,但有时您必须打破静态类型,因为根本没有足够的表现力来执行某些操作并将其静态类型化(即,例如,当从无类型集合中提取对象时,您需要强制转换)。

当然,泛型大大改善了这种情况,并且在支持高阶泛型的语言(如 Scala)中,事情变得更加愉快。

2) 简洁。如果这是显而易见的,我不需要写它。类型推断是一个很好的工具。

3) 一个很棒的图书馆。如果经常需要的话,我应该不需要写它。

1) Strong typing and features that support it.

C#/Java v1.0 were strongly typed languages, but sometimes you had to break static typing because there was simply not enough expressiveness to do some stuff and have it statically typed (i.e. you needed casts, when pulling objects from an untyped collection for example).

Generics of course improve the situation a lot and things get even merrier in languages that support higher order generics (like Scala).

2) Conciseness. If it's obvious, I shouldn't need to write it. Type inference is a great tool for this.

3) A great library. If it's often needed, I shouldn't need to write it.

倾其所爱 2024-09-19 06:02:54

支持一流(又名高阶)函数

Support first-class (aka higher-order) functions

孤独陪着我 2024-09-19 06:02:54

重要的是,代码看起来像伪代码,因为它易于阅读和编写。对此没有客观的衡量标准,因为随着时间的推移,语言和程序员往往会向彼此倾斜。

It is important that the code look like pseudo-code, in that it is easy to read and write. There is no objective measure for this, because over time the language and the programmer tend to bend towards each other.

优雅的叶子 2024-09-19 06:02:54

简洁但明确的语法。

Visual Basic:很清楚发生了什么,但非常冗长。

Perl:非常简洁,但是随意敲击键盘会得到更清晰的程序。

C#:恰到好处:D

Concise, but unambiguous syntax.

Visual Basic: It's clear what's going on, but it's very verbose.

Perl: It's quite concise, but you'd get clearer programs by banging on your keyboard randomly.

C#: Just right :D

停顿的约定 2024-09-19 06:02:54

以允许在良好测试后快速部署的方式提供支持。

Supported in such a manner that it allow for rapid deployment after good testing.

橘虞初梦 2024-09-19 06:02:54

我无法忍受纯粹显式的、主格的、静态类型,即Java 风格。我觉得我只能使用至少提供以下功能之一的语言进行有效编程:

  1. 类似于 Python、PHP、Perl、Ruby 的鸭子类型。

  2. 一个好的模板系统,支持可变参数、静态 if 等(如 D 的模板系统)以及至少一些类型传播(如 C# 的 var 关键字或 D 的 auto关键词)。我已经使用 D 一段时间了,它的模板系统足够好,我经常将其称为“编译时鸭子类型”。

如果没有其中至少一个,我常常感觉自己被困在一件完整的直筒夹克里。

I can't stand purely explicit, nominative, static typing, i.e. Java-style. I feel like I can only program effectively in languages that offer at least one of the following:

  1. Duck typing similar to Python, PHP, Perl, Ruby.

  2. A good template system that supports variadics, static if, etc. (like D's template system) plus at least some type propagation (like C#'s var keyword or D's auto keyword). I've been using D for a while and its template system is good enough that I often refer to it as "compile-time duck typing".

Without at least one of these I often feel like I'm caught in a complete straight jacket.

预谋 2024-09-19 06:02:54

图灵完备有帮助。

Being Turing-complete helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文