上一页 1 ··· 124 125 126 127 128 129 130 131 132 ··· 259 下一页
摘要: 原文 作者:亚当. mixin()带串,解析串为ast节点. foo()是类似FunctionCall { args: [] }这样的ast节点.而if(foo) {}类似IfStatement { condition: Expression { arg: Variable { name: foo 阅读全文
posted @ 2021-09-16 10:19 zjh6 阅读(20) 评论(0) 推荐(0)
摘要: // dmd -c -m32 test.d -defaultlib= // ld test.o -o test -nostdlib -m elf_i386 void write(in char[] msg) { auto p = msg.ptr; auto l = msg.length; asm { 阅读全文
posted @ 2021-09-15 23:29 zjh6 阅读(43) 评论(0) 推荐(0)
摘要: //!dmd -betterC % //编译.创建了类的静态`缓冲区`. __gshared Foo[] foos = () { Foo[] ret; ret.length = 10; foreach(i, ref foo; ret) { foo = new Foo(i); }//用CTFE的全局数 阅读全文
posted @ 2021-09-15 23:23 zjh6 阅读(14) 评论(0) 推荐(0)
摘要: 鼓励人们,去尝试一下.干就完了. 能用D写一个内核吗?能. 接口中,不能有虚函数,因为你不知道有多少槽. 一旦重载新(模板函数)运算符,如何放进类中?答案很简单:只需转发它给虚函数,你就有了这些命名函数.理念:实用为主. 在D中搞内核,处理器中跑的每行代码都是你的,这很酷. 我们需要先编译个你好!. 阅读全文
posted @ 2021-09-15 22:17 zjh6 阅读(19) 评论(0) 推荐(0)
摘要: 原文 作者:HS Teoh 组件式编程:易写,易读,易重用来实现复杂算法. 复杂性来源:结构冲突与循环.结构冲突:程序和数据结构不匹配. 组件编程 关键点是代码应对应数据结构.惰性求值序列和流来类比管道来处理数据. 研究格式化日历 由于日历与输出结构不匹配,因为一行输出可能是2个/3个月. 用组件编 阅读全文
posted @ 2021-09-15 17:08 zjh6 阅读(39) 评论(0) 推荐(0)
摘要: /*D日历用带区间的组件式编程,来简化复杂任务为可管理片段示例.任务是,给定`年`,生成代表该年日历的行.展示如何清晰易读读写易重用复杂组件.*/ 导入 标.算法; 导入 标.转换; 导入 标.日期时间; 导入 标.函数; 导入 标.区间; 导入 标.标io:写行,写格式行,标错误; 导入 标.串; 阅读全文
posted @ 2021-09-15 16:46 zjh6 阅读(18) 评论(0) 推荐(0)
摘要: 原文地址 #include <iostream> struct Bad { }; struct B { }; struct A { Bad operator,(B b) { return Bad(); } }; struct D { }; struct Ugly { D operator>(Bad 阅读全文
posted @ 2021-09-15 08:51 zjh6 阅读(12) 评论(0) 推荐(0)
摘要: call histdel("cmd","^.$") 删除命令中的单个符命令. 阅读全文
posted @ 2021-09-14 20:43 zjh6 阅读(12) 评论(0) 推荐(0)
摘要: fun! Tmr(c,n,m) "头默认,c为参数,要分开的.m为头默认,如默认为^ "n为最多多少.m为缺1个是,头改为多少 let l=split(a:c) let ll=len(l) if ll==a:n return l endif call assert_true(ll==a:n-1) r 阅读全文
posted @ 2021-09-14 19:36 zjh6 阅读(13) 评论(0) 推荐(0)
摘要: fun! Hth(a) "后替换a,aa不用每一行,每一行太慢 "s为串,匹配串之后替换.c,d为新串,旧串. "这主要是用来弥补g/../的缺陷的. "后替换是全局的. let[s,c,d]=split(a:a) let j=Zhh() "总行数 for i in range(1,j+1) "这里 阅读全文
posted @ 2021-09-14 17:00 zjh6 阅读(32) 评论(0) 推荐(0)
上一页 1 ··· 124 125 126 127 128 129 130 131 132 ··· 259 下一页