V2EX  ›  英汉词典

Type Deduction

释义 Definition

类型推导:编译器(或解释器)根据表达式、初始化值、函数返回值等上下文,自动推断变量、参数或表达式的类型,从而减少显式写类型的需要。(在不同语言中也常与 type inference 接近;少数语境下两者会有细微区分。)

发音 Pronunciation (IPA)

/taɪp dɪˈdʌkʃən/

例句 Examples

The compiler performs type deduction for auto variables.
编译器会对使用 auto 的变量进行类型推导。

In template-heavy code, subtle rules of type deduction can change whether a parameter becomes a reference, a const-qualified type, or a decayed value type.
在大量使用模板的代码中,类型推导的细微规则会影响参数最终是引用类型、带 const 限定的类型,还是发生退化后的值类型。

词源 Etymology

type 来自希腊语 typos,有“印记、模型、类型”的含义;deduction 来自拉丁语 deducere(引导、推导)。合起来表示“通过规则把(数据/表达式)所对应的类型推出来”,现代多用于编程语言与编译器语境。

相关词 Related Words

文学与著作中的用例 Literary Works

  • The C++ Programming Language(Bjarne Stroustrup)
  • *Effective Modern C++*(Scott Meyers)
  • C++ Templates: The Complete Guide(David Vandevoorde, Nicolai M. Josuttis 等)
  • Types and Programming Languages(Benjamin C. Pierce)
  • The Rust Programming Language(Steve Klabnik, Carol Nichols)
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1044 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 17ms · UTC 17:09 · PVG 01:09 · LAX 09:09 · JFK 12:09
♥ Do have faith in what you're doing.