随笔分类 -  类型系统

摘要:动态即变化。 即表现与实现的分离。 即实现的结构可变。 即把信息和关系的确定从编译时放到运行时。 阅读全文
posted @ 2018-06-13 22:35 zzfx 阅读(83) 评论(0) 推荐(0) 编辑
摘要:范畴即为结构:包含要素和转化。 范畴为高阶类型。 函子为高阶函数。函子的输入为态射。函子为建立在态射基础上的高阶函数。函子用于保持范畴间映射的结构。态射用于范畴内部的转换。 群为运算规则的约束。 自函子是一类比较特殊的函子,它是一种将范畴映射到自身的函子 (A functor that maps a 阅读全文
posted @ 2018-06-08 18:27 zzfx 阅读(2460) 评论(0) 推荐(0) 编辑
摘要:大致介绍了幺半群(monoid)后,我们重新回顾最初引用wadler(haskell委员会成员,把monad引入haskell的家伙)的那句话: 现在我们来解读这句话中包含的另一个概念:自函子(Endofunctor),不过我们先需要一些铺垫: 首先,什么是函子(Functor)? 乍一看名字,以为 阅读全文
posted @ 2018-06-08 16:23 zzfx 阅读(492) 评论(0) 推荐(0) 编辑
摘要:, pronounced "type", is the kind of all data types seen as nullary type constructors, and also called proper types in this context. This normally incl 阅读全文
posted @ 2018-06-08 15:14 zzfx 阅读(239) 评论(0) 推荐(0) 编辑
摘要:首先我们从最基本的泛型来看: 现在我们对上面泛型中的类型参数再进一步,也是个泛型会如何呢? 可以看到,java中不支持类型参数也是泛型类型的情况,而scala支持。这是一个很重要的区别,scala在类型系统上要比java强大。我们现在简单对类型归纳一下,可以分为两类: 1)特定类型(proper t 阅读全文
posted @ 2018-06-08 14:52 zzfx 阅读(344) 评论(0) 推荐(0) 编辑
摘要:高阶函数和类型系统是函数式编程的两大基石。 缺少任何一个函数式编程都将寸步难行。 阅读全文
posted @ 2018-06-07 19:19 zzfx 阅读(82) 评论(0) 推荐(0) 编辑
摘要:多态有类型系统衍生。 有限类型、无限类型、确定类型。 Classifications Christopher Strachey (1967) introduced the concept of polymorphism informally into procedural programming l 阅读全文
posted @ 2018-06-07 16:47 zzfx 阅读(271) 评论(0) 推荐(0) 编辑
摘要:Type inference refers to the automatic detection of the data type of an expression in a programming language. Type inference is the ability to automat 阅读全文
posted @ 2018-06-07 16:12 zzfx 阅读(138) 评论(0) 推荐(0) 编辑
摘要:对泛型的类型添加约束,从而使泛型类型的变量具有某种通用操作。 再使用这些操作,参与到其它操作中。 In computer science, a type class is a type system construct that supports ad hoc polymorphism. This 阅读全文
posted @ 2018-06-07 15:21 zzfx 阅读(196) 评论(0) 推荐(0) 编辑
摘要:另外:前向声明中引入的类型为不完全类型(incomplete type),不完全类型只能以有限方式使用,只能用于定义指向该对象的指针和引用,只能用于声明使用该类型作为形参或返回类型的函数。 Incomplete types[edit] An incomplete type is a structur 阅读全文
posted @ 2018-03-29 19:00 zzfx 阅读(688) 评论(0) 推荐(0) 编辑
摘要:只声明却没有定义的类称为—————–不完全类型,不完全类型不能定义该类型的对象,只能用于定义指向该类型的指针及引用,或者用于声明(不是定义)使用该类型作为形参类型或返回类型的函数。 在创建类的对象之前,必须完整地定义该类。必须定义,而不是声明类,这样,编译器就会给类的对象预定相应的存储空间。同样的, 阅读全文
posted @ 2018-03-29 18:59 zzfx 阅读(671) 评论(0) 推荐(0) 编辑
摘要:与动态语言有关的概念:1、反射 2、运行时 3、编译器、静态。 所谓的动态语言指的是语言单元的结构、行为、类型可以在运行时发生改变的语言。 可以动态添加新的类型; Dynamic programming language, in computer science, is a class of hig 阅读全文
posted @ 2018-01-21 10:07 zzfx 阅读(381) 评论(0) 推荐(0) 编辑
摘要:In some languages, classes are only a compile-time feature (new classes cannot be declared at runtime), while in other languages classes are first-cla 阅读全文
posted @ 2018-01-20 22:45 zzfx 阅读(143) 评论(0) 推荐(0) 编辑
摘要:Type system[edit] Main articles: Data type, Type system, and Type safety A type system defines how a programming language classifies values and expres 阅读全文
posted @ 2018-01-18 15:54 zzfx 阅读(302) 评论(0) 推荐(0) 编辑
摘要:类型系统的属性: 1、结构属性; 2、规则属性;类型系统定义了一套规则(内部数据的访问规则、函数的访问规则、类型的比较与转化规则),以供编译和运行时进行检查。 In programming languages, a type system is a set of rules that assigns 阅读全文
posted @ 2018-01-18 15:38 zzfx 阅读(250) 评论(0) 推荐(0) 编辑
摘要:动态语言:修改结构; 动态类型:运行时类型检查; 编译语言:机器码、解释器; 强类型:类型不可变。 编译型语言和解释型语言 1、编译型语言 需通过编译器(compiler)将源代码编译成机器码,之后才能执行的语言。一般需经过编译(compile)、链接(linker)这两个步骤。编译是把源代码编译成 阅读全文
posted @ 2018-01-18 15:06 zzfx 阅读(605) 评论(0) 推荐(0) 编辑
摘要:Normally, in a typed language, the dispatch mechanism will be performed based on the type of the arguments (most commonly based on the type of the rec 阅读全文
posted @ 2018-01-18 12:40 zzfx 阅读(291) 评论(0) 推荐(0) 编辑
摘要:绑定:建立联系; 分发:作出选择。 https://en.wikipedia.org/wiki/Dynamic_dispatch https://en.wikipedia.org/wiki/Late_binding Dynamic dispatch is different from late bi 阅读全文
posted @ 2018-01-17 21:43 zzfx 阅读(176) 评论(0) 推荐(0) 编辑
摘要:作者:amalgamation链接:https://www.zhihu.com/question/19918532/answer/21647195来源:知乎著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 系统的一些概念,众说纷纭,使用上也比较乱。有些东西,甚至不好严格定义。以下 阅读全文
posted @ 2017-08-10 11:08 zzfx 阅读(1273) 评论(0) 推荐(0) 编辑
摘要:https://developer.apple.com/library/content/documentation/General/Conceptual/DevPedia-CocoaCore/DynamicTyping.html#//apple_ref/doc/uid/TP40008195-CH62 阅读全文
posted @ 2017-08-09 23:05 zzfx 阅读(274) 评论(0) 推荐(0) 编辑