- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试编译以下代码:
type
TPerson = object of TObject
name*: string
age: int
TStudent = object of TPerson
id: int
var
student: TStudent
person: TPerson
student = TStudent(name: "Anton", age: 5, id: 2)
Error: undeclared field: 'id'
id
没有声明?代码示例直接来自教程。语言中的某些内容是否在教程中没有反射(reflect)出来?
student = TStudent(name: "Anton")
echo student.name
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
最佳答案
恐怕您使用的可能是 Nimrod 的最后一个稳定版本(版本 0.9.2 于 2013 年 5 月发布)或旧的 git checkout,您强调的是编译器中的错误。现在使用 git 版本 https://github.com/Araq/Nimrod/commit/75ca6eb34fbc983d88961664fd1cfce5f8b44abf您的第一个和最后一个示例都可以正常工作。在过去的几个月中,已经修复了与语言中的对象继承相关的几个错误( issue 179 、 issue 520 、 issue 575 和 issue 563 )。
如果您决定为自己构建一个 git 版本(它一点也不可怕,尽管有时语言中存在回归)请 use the build instructions from the git因为网站可能还没有更新。
关于inheritance - 编译 Nimrod 程序的继承类型中的未声明字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19736951/
我找到了 this GitHub 上的项目;它是为“nimrod 矩阵”返回的唯一搜索词。我取了它的基本部分并对其进行了一些更改,使其编译没有错误,然后我添加了最后两行以构建一个简单的矩阵,然后输出一
我尝试编译以下代码: type TPerson = object of TObject name*: string age: int TStudent = object of
正在经历the second part of Nimrod's tutorial我已经到了解释宏的部分了。文档说它们在编译时运行,所以我想我可以对字符串进行一些解析来创建自己的领域特定语言。但是,没有
是否可以在 Nimrod 中使用函数指针? 我尝试过的是: type fptr = (proc(int):int) proc f(x:int): int = result = x+1 var my
我在安装 babel 时遇到问题. 首先我从github下载了所有东西, connor@vader:~$ git clone https://github.com/nimrod-code/babel.
我刚刚发现 Nimrod 并且有一个基本问题(在文档中找不到答案)。 你如何使用按位运算?我有以下代码,其中 x 定义为 int : if x and 1: 这不编译: Error: type mis
我在玩弄nim (在撰写本文时仍称为 nimrod),通过用该语言编写 Brainfuck 解释器。没有实现循环,我有: import os, unsigned const RamSize = 200
我想从 nim 代码创建一个 dll。但是除了“NimMainInner”之外,我没有注册其他一些导出。即使我尝试这个简单的例子它也不起作用: proc Hellow(): cint {.export
我是一名优秀的程序员,十分优秀!