查找讨论
全部讨论
Workers stuck on the results send after the context is canceled
Ran into a simple thing and spent longer on it than I'd like. A pool of eight workers reads tasks from jobs and writes result…
A slow gfortran loop that copied an array section on every call
A loop over the rows of a matrix, calling a subroutine with the row a(i, :) on every iteration. Right answer, embarrassing sp…
Eight queue slots can still leave 88 goroutines waiting
A buffered channel bounds the jobs sitting in it. It does nothing about the goroutines blocked trying to send. Say a server g…
Ported a short MATLAB script to R and one result came back as a matrix
Trying to redo a short MATLAB script in R, and I've barely touched MATLAB before. Most of it came over fine, except for a sin…
Same Int, two targets, two answers
Found this while running the same Gleam module on both targets, and it's a runtime fact more than a language one. gleam run p…
na.rm = TRUE on a group that is all NA
Per-group totals with tapply(x, g, sum, na.rm = TRUE), and one group came back as 0. Every value in that group is NA. Not a s…
`String::from_utf8` 失败时会把字节还给你
消耗型 API 得决定失败时那个值怎么处理。String::from_utf8 按值接收 Vec<u8>,失败时由错误持有它。 它会打印 bad byte at 2, 4 bytes back。没有拷贝,调用方在一个值里同时拿回缓冲区和出错的偏移。m…
D's pure lets a function write through its arguments
D's pure is weaker than the word suggests, and I only noticed because an evaluator experiment wanted to cache calls. pure in…
Assigning realloc back to the only pointer leaks on failure
*buffer = realloc(*buffer, n) turns up in a lot of growth helpers, and it is wrong in a specific way. If the allocation fails…
Marking the filter async did nothing for the freeze
Search filters a list of around forty thousand rows, and the UI freezes for a moment on every query. I figured async was the…
foldl composes fine and leaks anyway
foldl (+) 0 over a long list is the smallest space leak I know, and it's a composition problem more than an arithmetic one. E…
CTFE happens where the declaration asks for it
Had D's CTFE pictured wrong for a while. I assumed that once a function is fit for compile time evaluation, the compiler woul…
Annotation or satisfies for a config object
For config objects I've mostly moved from const config: Config = {...} to {...} satisfies Config. With the annotation, config…
Launching the consumer on a stopped event
Got a question about a supervisor rule that treats a stopped process as a finished one, and a tiny repro makes the problem ob…
悬垂指针的警告消失了,指针还在
通过一个包装层把名字传给 C++ 库,第一版只有一行,CString::new(name).unwrap().as_ptr()。rustc 马上就警告说,临时的 CString 在语句结束时就销毁了,指针会悬垂。行,有道理。于是我把它挪进一个小函数,…
My function returns an array when all I asked for was a path
Writing a PowerShell function from scratch for once (rather than squinting at someone else's), and it misbehaves in a way I c…
Braces around expr decide what the bytecode compiler sees
Unbraced expr is the one Tcl habit I'd ban if I could! It looks like a style nit and it isn't. The braced line prints 0. The…
先有记号,后有机器
APL 先是一种记号,然后才是程序。Iverson 在纸上用它描述算法,1962 年那本 A Programming Language 背后并没有可运行的实现。APL\360 是那个十年晚些时候才出现的。 这个先后顺序解释了很多事。从右到左求值,没有…
同样的 sink 调用,这一行是拷贝,下一行就是移动
Nim 2 是按调用点决定拷贝还是移动的,不是按 proc。 同一个参数,同一个 proc。第一次调用会拷贝,因为后面还要用 a。第二次就移动了。调用点上没有任何东西告诉你是哪种。nim c --expandArc:main 会打印改写后的函数体,两…
Pharo 的代码到底存在哪
用了很久 Ruby,最近来玩 Pharo,卡在一个对习惯文件的人来说有点丢人的基础问题上。我在系统浏览器里建了个类,保存了几个方法,磁盘上哪里都没有出现 .st 文件。保存镜像,重新打开,方法都还在(从 Ruby 过来,用 ls 却看不到源码文件,多…