<andrewrk>
the idea is to move the logic from lib/std/build.zig regarding looking up system library directories, and move it to the self-hosted compiler, and then expose it to the stage1 compiler
<andrewrk>
daurnimator, for GSoC, a nice strategy might be to make the project proposals be limited in ambitiousness; if the student finishes an "easy" task, we have plenty more for them to choose from to fill the rest of their time
<andrewrk>
so basically we would be able to go through the Contributor Friendly issues and nearly any of them could be a project proposal
<daurnimator>
andrewrk: generally you want something of defined scope; otherwise you can't really say they succeeded or failed
<andrewrk>
yes I think we are agreeing
<andrewrk>
my point is that they can "succeed" halfway through the summer; which will probably in practice motivate them to take on another bite-sized task
<andrewrk>
everybody wins
PC9801 has joined #zig
<PC9801>
anyone have a moment to help debug why my wc clone is slow? :)
<PC9801>
when compiled with --release-safe --strip it still seems quite slow - i'm sure its a logic problem
<andrewrk>
--release-safe to compare with how safe Haskell and D are, yeah?
<andrewrk>
does the D implementation have the main function "trusted"? (or however that works)
<PC9801>
no idea, I saw the D and haskell posts and just thought I'd give translating it to zig a go to practice
<andrewrk>
oh, ok, I really need to rename this because everybody does this, std.io.readLine & related APIs are actually supposed to be like a terminal UI
<andrewrk>
like gnu readline
<PC9801>
ahh
<andrewrk>
they don't have such features yet, but that is the direction they are going. you probably just want stream.readUntilDelimiter
<andrewrk>
readUntilDelimiterOrEof
<andrewrk>
you should probably also use a buffered input stream
<andrewrk>
zig is kinda "raw", you tend to only get what you ask for
<PC9801>
thank you, I'll play around with it some more with that info
<andrewrk>
in summary: ReleaseSafe has runtime safety checks. ReleaseFast assumes Undefined Behavior will never happen, and uses that to optimize
<diltsman>
I'm looking at issue 4194 about the multichar character literal. I assume that is in the C header translation phase, correct?
<andrewrk>
you can override this setting at any scope, but the global setting sets the "default"
<andrewrk>
diltsman, correct. zig code uses clang's API and outputs zig source code
<diltsman>
Is that in the CMake generated zig_cpp project?
<andrewrk>
diltsman, translate-c is now 100% self-hosted!
<andrewrk>
src-self-hosted/translate_c.zig
<andrewrk>
tests are in test/translate_c.zig and test/run_translated_c.zig
<diltsman>
So, is that part of the CMAke generated projects?
<andrewrk>
maybe "100%" is misleading. there's still a C API wrapper on top of clang's C++ API. I'm sorry, I don't understand your question about cmake
<diltsman>
The directions to compile Zig on Windows say to use CMake to generate some projects to do the build. I'm trying to figure out if those generated Visual Studio projects have the source files that I need to edit.
<diltsman>
Looks like the change should be in transCharLiteral.
<andrewrk>
in order to work on translate-c, the relevant source files are: src/zig_clang.cpp, src/zig_clang.h, src-self-hosted/translate_c.zig, src-self-hosted/clang.zig
<daurnimator>
andrewrk: is LLVM able to take advantage of `catch unreachable` for optimization?
<andrewrk>
PC9801, it looks fine to me. do you want a diff of how to make it more idiomatic?
<PC9801>
andrewrk, that would be excellent to help me learn
<diltsman>
If I'm reading this right, transCharLiteral looks like it already generates an integer node for multi-character character constants. It try's transCreateNodeInt if the value of the character literal is >255...
<daurnimator>
i.e. if I have: `fn foo() !void { if(x >= 5) return error.NotGood; for (array[0..x]) |c| { thing(c); } }; fn bar() void { foo() catch unreachable; }` --> in release-fast mode, could it skip the x >= 5 check?
naltun has joined #zig
<andrewrk>
daurnimator, yes zig emits a br with unreachable in release-fast mode, so it communicates to llvm that we have made the not-taken-branch undefined behavior
<PC9801>
andrewrk, cheers, thanks for the advice :)
<andrewrk>
PC9801, also... want to try using evented I/O for parallel resource usage of multiple input files? :D
<PC9801>
sure, where do i start?
<andrewrk>
we're still working on how a lot of this works, but so far input is already working, so this use case is covered
<andrewrk>
it's a 1-liner
dimenus has joined #zig
Thalheim has joined #zig
<andrewrk>
pub const io_mode = .evented;
<andrewrk>
but give me a minute to show how to make it parallel using async/await
<PC9801>
ok
<dimenus>
is it possible to specify alignment on the first dimension of a two dimenensional array? Running into issues with arrays in uniform blocks with GLSL
<dimenus>
Basically I need [2]f32 aligned on a 16 byte boundary
<shakesoda>
dimenus: the easy way is probably just to specify everything in chunks of [4]f32
<shakesoda>
also, i don't know, but this is the solution i usually use to solve my GL alignment troubles
<pmwhite>
andrewrk: does the issue count on GitHub ever keep you awake at night? It never seems like it goes down. I assume a lot of those are proposals and long-term things that you don't need to worry about now, but it still has got to feel like the goal posts are moving faster than you're moving toward them.
<andrewrk>
pmwhite, the issue count for 0.6.0 is a bit over-budget currently, but that's a more realistic idea of what is actually "open"
dddddd has quit [Ping timeout: 272 seconds]
<andrewrk>
according to my schedule 0.6.0 milestone should be at 276 issues
<daurnimator>
the previous line explicitly checks the active field
PC9801 has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
<andrewrk>
daurnimator, are you able to reproduce it locally?
<daurnimator>
Tests passed locally last night. I'm at work right now so can't check
<andrewrk>
I can help debug this if it's tricky
<daurnimator>
Is what I have on line 1671 in the PR the correct way to assert which is the currently active union field
<daurnimator>
?
<andrewrk>
without looking into it more, i'm confused the same as you are
<diltsman>
Time for bed. I will hopefully be able to finish this multicharacter char literal tomorrow.
<andrewrk>
good night diltsman
Joey152 has quit [Remote host closed the connection]
<mikdusan>
>I do think it would be nice to figure out some convenient way to make the easiest way to write data to a terminal, to properly terminal escape
<mikdusan>
text, but also support intentional terminal escapesyes
<mikdusan>
I have a wip formatter that mixes str formatting with tty controls been gathering dust for 5 months. just got it working with master again:
<daurnimator>
andrewrk: are you around? I'd like to try and solve https://github.com/ziglang/zig/issues/4289 but don't know how.... I see you put contributor friendly on it
riba has quit [Ping timeout: 240 seconds]
qazo has quit [Ping timeout: 265 seconds]
sirnaysayer has quit [Ping timeout: 265 seconds]
return0e has joined #zig
_Vi has quit [Ping timeout: 252 seconds]
bheads has quit [Quit: bheads]
forgot-p1ssword has quit [Ping timeout: 268 seconds]
forgot-password has joined #zig
<forgot-password>
andrewrk: Okay, I just built the compiler with the `-x c` flag removed and it still doesn't compile properly
forgot-password has quit [Ping timeout: 260 seconds]
knebulae has joined #zig
dddddd has joined #zig
bheads has joined #zig
bheads has quit [Quit: bheads]
bheads has joined #zig
PC9801 has joined #zig
dimenus has joined #zig
frmdstryr has quit [Remote host closed the connection]
<mq32>
if i see that right, the whole thing *could* be "const a = alignment orelse @alignOf(T);"
<dimenus>
ah, yeah i just misread that
<dimenus>
so maybe it's an issue with the backing allocator
<dimenus>
thanks
<fengb>
The build system needs cookbook style docs
<mq32>
fengb, wait for my next day sick :D
<dimenus>
mq32: am i just misunderstanding alignment? is the alignment for the entire allocation or the elements in it?
<dimenus>
i should just make [4]f32 wrappers lol
<fengb>
The allocation
BaroqueLarouche has joined #zig
<fengb>
If it's for elements, they need to be aligned so probably wrapped into a struct of sorts
<mq32>
it's for the entire allocation, as array elements have intrinsic alignment
<dimenus>
thanks guys, sorry for the stupid questions
<dimenus>
wrapping in a struct works as planned
<fengb>
Are you looking for align 16? @Vector(4, f32) has that naturally >_>
<dimenus>
Vec2 and i32 / f32
<dimenus>
i'm adding post processing effects to the breakout clone and the first big snag i ran into with zig was uploading uniforms that weren't aligned properly
<dimenus>
world matricies and the like are naturally aligned enough to not cause issues
<dimenus>
and in vulkan, push constants are align(4) not align(16)
<dimenus>
so those were easy too
<fengb>
Wait... you also code in odin. Heathen! :P
<dimenus>
indeed :)
<dimenus>
i hit a brick wall in Odin with the whole large static struct taking forever to compile thing
<dimenus>
then i switched to linux and at the time he hadn't implemented the System V ABI properly
<dimenus>
i plan on looking at it again soon
<dimenus>
Modeling windows COM components in Odin was so easy, i'm amazed at how well that worked
mahmudov has joined #zig
Sahnvour_ has quit [Ping timeout: 268 seconds]
Sahnvour_ has joined #zig
forgot-password has joined #zig
<andrewrk>
daurnimator, it's a matter of figuring out how to use the clang API
<andrewrk>
Snektron, sorry that was misleading. what is self-hosted is the usage fo the clang API. it's still using clang
<companion_cube>
I wonder if someone will write a GC for Zig
<companion_cube>
comptime generating struct layout info or something
metaleap has joined #zig
Cloudef has quit [Read error: Connection reset by peer]
nofmal has joined #zig
<nofmal>
hello, has termios been implemented in the standard library?
<andrewrk>
nofmal, not yet
Cloudef has joined #zig
Akuli has joined #zig
<nofmal>
in that case may i implement it myself?
<andrewrk>
of course :)
<andrewrk>
how does it work?
<fengb>
andrewrk: should there be a way to hook into test teardown? I'm not sure how else to implement a default test allocator
<fengb>
Just a FBA that either resets itself or counts leaks after a test
<andrewrk>
fengb, my suggestion is to give up on the idea that a zig `test` entry point has to correspond to exactly 1 conceptual test
<fengb>
I suppose we can manually expose a function to be deferred: `test "" { defer std.testing.allocatorCheckLeaks() }`
<andrewrk>
test "all the xyz tests" { foo.setUp(); foo.doTest("blah"); foo.tearDown(); }
<nofmal>
andrewrk: well i've tried to implement tcgetattr() and tcsetattr() only atm
<nofmal>
it works by making a call to linux.syscall
<nofmal>
something like this: `os.linux.syscall3(os.linux.SYS_ioctl, @bitCast(usize, @as(isize, handle)), os.linux.TCGETS, @ptrToInt(&struct_termios))`
<fengb>
I mean for stdlib, it’d be nice to have a default allocator that “just works”. But I suppose it’s not bad to wire in a line a boilerplate
<andrewrk>
fengb, for testing? or in general?
<fengb>
Just for testing
<fengb>
So people stop using page_allocator or debug.allocator :P
<andrewrk>
ah. yeah I think it would make sense for the default test runner to set up an allocator intended to be used in testing, and check for leaks in between tests
<fengb>
I didn't see any runner code in std. Does it live in C++?
<metaleap>
"So people stop using page_allocator" --- for newbs: is there sth to be concerned about with page_allocator? i heard more than once subtle overtones that it's "fine for demo throwaways but not one's Serious Real-World code"
<metaleap>
(i mean yeah it makes syscalls but what else you're gonna do to scale to often unbounded users' random workloads)
<companion_cube>
it's not efficient for small allocations, is it?
<andrewrk>
fengb, lib/std/special/test_runner.zig
<mq32>
metaleap: page_allocator just allocates/unallocates memory pages, so it has a really high fragmentation. it has a granularity of 4096 byte, so if you allocate 2 byte, you actually get memory for 4096 byte. 4097 byte allocations will yield 8192 byte and so on
<mq32>
metaleap: also mapping/unmapping memory is a really slow process compared to "let's increment this pointer by 15"
<metaleap>
mq32: thq, so the only other substantial alternative is fixed-buf allocs right? (wherever one can estimate a bound, that is)
<mq32>
right now, i would recommend using the C allocator for "real world applications"
<mq32>
you're gonna link libc in most cases anyway, so using the c_allocator doesn't hurt
<metaleap>
huh, that one i didnt consider when scanning stdlib. ignoring everything starting with "c" :D
<mq32>
it makes arbitrarily sized allocations in a fixed buffer possible, so it's much more generic than the fixed buffer allocator, but i have to say: it's not a good allocator :D
<metaleap>
andrewrk: hence the question --- it mentions fba and page, so the former is limited to staticallyknown bounds and the latter is "relatively expensive" I now gather (libc not applicable over here)
<metaleap>
mq32: curious! will keep in mind. whats bad about it
<dimenus>
andrewrk: have you ported libsoundio to zig at all?
<mq32>
> whats bad about it
<mq32>
it has no tests, i have noticed that "it works" and i have literally haven't slept in the whole development process *laughing*
<mq32>
over-night-hack
<fengb>
andrewrk: I'm blind >_<
<mq32>
but it could actually be a nice base for a small scale allocator
<companion_cube>
metaleap: what makes you have no libc, by curiosity?
<andrewrk>
dimenus, no, but porting the build to zig build would make it easier to make windows binaries and put them on the site...
<fengb>
Most of my usecases have been an arena backed with page_allocator, although backing with a general purpose allocator would probably be better
<dimenus>
andrewrk: I'm getting to the point where I need to add audio to my breakout clone, wondering if it's worth starting a sound library
<dimenus>
or porting yours to zig
<metaleap>
just want to avoid both that dep and deps that dep on it.. yeah if i were doing real-world things i might need opengl or libpng or postgresql or sqlite but for now... i seem to get by interfacing with the outside world via []u8
<companion_cube>
that's really fascinating to see that Zig makes arena allocators so easy they're the default go-to
<mq32>
OpenGL doesn't need libc except for dlopen right now :)
<mq32>
well, but making a window needs SDL
<mq32>
until zig-window is ready :)
<fengb>
Arenas solve memory lifetimes really well, and the fact that it's fast and easy is just a side benefit :P
<metaleap>
the "problems" with page_alloc wouldnt seem so bad if pages were say 4MB instead of 4KB. "gimme some fat chunk to chew on and i wont be back so soon". suppose custom-size requests are not supported by relevant os kernels?
<metaleap>
main thing i love about arenas is that they're like a "private micro GC". allocate at will, just know the choice-points in program flow where a bag of garbage can be ditched all at once
<fengb>
metaleap: you can request more but something still needs to manage it. Most general purpose allocators would use the page_allocator as the backing, but it'd do internal bookkeeping to make it faster and more efficient
<andrewrk>
dimenus, you're trying to avoid a libc dependency?
<fengb>
Using it directly is both slow and wasteful
<dimenus>
andrewrk: just looking for more things to move to zig while i have the opportunity
<andrewrk>
dimenus, I have similar goals, but that is difficult to accomplish on linux. graphics and sound each provide an obstacle
<metaleap>
fengb: i see, yeah i reckon it's all in the custom bookkeeping to keep things smooth, will be interesting to see that space evolving in stdlib
<companion_cube>
so, again, no GC in userland planned? 🙃
<andrewrk>
dimenus, as an example, pulseaudio doesn't have a real protocol. you are kinda forced to use the c library client as the protocol
<dimenus>
andrewrk: ah got it, i'll link with the c lib for now then. what obstacles are you referring to?
<dimenus>
are we going to get a zig abi at some point?
<fengb>
I think it’s a Zig rite of passage to write a toy general purpose allocator :P
<companion_cube>
fengb: I was more thinking about having a `GcPointer(T)` that points to arena+offset, or something
<companion_cube>
for a precise GC
<metaleap>
fengb: saw it earlier! so "general" means not just wasm then?
<metaleap>
might take a lookie. but gonna multithread soon enough tho
<mq32>
metaleap, just use one allocator per thread :D
<metaleap>
true lol
<fengb>
Yeah it should be usable anywhere. It’s just focused on browser characteristics so things like wasting memory aren’t as important as smaller binaries
<metaleap>
that 64k quip heh
<mq32>
fengb: i think i should package my allocator as well and provide it with an option to grow heap size
return0e has quit [Remote host closed the connection]
<companion_cube>
fengb: that's the kind of thinking that makes browsers memory hogs 😜
<andrewrk>
the first `const` describes whether or not you can reassign tPtr
<andrewrk>
sean1, you could also change `var t` to `const t`
<andrewrk>
then &t will give you *const Test
Snetry has joined #zig
<sean1>
make sense. I'm just testing out some features before I commit to try and port some c code over. Some of the warts that I dislike in c and how they would be handled in zig
<andrewrk>
you can also play with `zig translate-c` :)
<andrewrk>
although it won't generate idiomatic zig code, of course. it will match the C semantics exactly
<sean1>
yeah I was gonna look at giving that a shot to see what it does with my code.
<sean1>
on issue I noticed and not sure if it is by design but if I use tabs the code doesn't compile
<sirnaysayer>
andrewrk: I'm looking to set the is_dynamic flag in the build.zig file. Typically this is done with -dynamic but scowering the build code I'm not seeing the possibility
<sirnaysayer>
then it exports a dll
<sean1>
yeah I saw zig fmt as well since I tried the vim plugin but I'm a stickler with braces and like them on thier own line
riba has joined #zig
<andrewrk>
sirnaysayer, you're using addSharedLibrary? what is happening, and what do you want to happen instead?
<sirnaysayer>
addSharedLibrary exports a .lib for me.
<andrewrk>
sean1, just conform :P I use tabs when I write Go
<andrewrk>
sirnaysayer, ah, ok. that sounds like a bug. let me take a look
<sean1>
I don't mind not using tabs but brace on the same line are harder for me to read. For now I just set vim to insert spaces instead of tabs and I'm fine. The faq answer makes sense
<fengb>
You can insert an empty comment at the end of the previous line. fmt will then mangle the next brace :P
<sean1>
hah. interesting.
<andrewrk>
sirnaysayer, I just tried and got a dll
<andrewrk>
I did `zig init-lib` and then changed addStaticLibrary to addSharedLibrary
<sirnaysayer>
Ok, Ill try that out, thanks for looking at it. You're incredibly helpful.
<andrewrk>
I'm using latest master (4fad162)
marmotin_ has quit [Remote host closed the connection]
riba has quit [Ping timeout: 268 seconds]
naltun has joined #zig
metaleap has joined #zig
metaleap has quit [Quit: Leaving]
metaleap has joined #zig
naltun has quit [Ping timeout: 260 seconds]
<sean1>
I gotta say. I'm very impressed with the c ffi or rather lack there of.
<metaleap>
guys, calling an `fn (u: MyUnionType)` with a `MyUnionType { .MyTag = <runtime-value> }` literal --- at compile-time the tag is fully known, BUT:
<metaleap>
how to get at it?
<metaleap>
now i can do `const idx = @enumToInt(std.meta.activeTag(u));`
<metaleap>
but then using it like `@memberName(T, idx)` gives unable to evaluate constant expression
<metaleap>
and `@compileLog(idx)` prints `| (runtime value)`
voldyman has joined #zig
<andrewrk>
sean1, @cImport will even translate inline functions :)
<metaleap>
(fearing there's no split in comptime/runtime known-ness between the tag and the payload.. but hoping i'm wrong :D i had a really ritzy API design devised on that hope hehe)
<andrewrk>
(but note translate-c is not complete yet)
<andrewrk>
metaleap, @memberName is deprecated
<andrewrk>
to get the tag of a tagged union, coerce the type to its tag type
<andrewrk>
@as(@TagType(MyUnionType), u)
<andrewrk>
zig doesn't have the ability to accept a tagged union as a parameter, where the tag is comptime known, but the payload is runtime known
<andrewrk>
I suggest to have an additional comptime parameter with the tag type
<metaleap>
thx for the heads-up. so this gives the known-at-comptime tag (even if runtime payload), at comptime? gotta try
<andrewrk>
SyrupThinker, nice work on the code model PR
<andrewrk>
merged
Akuli has quit [Quit: Leaving]
<metaleap>
andrewrk thx again .. still no dice if my fn-call arg is a .{} literal with statically-knowable (aka hardcoded) tag but runtime payload. turns the whole expr into a `(runtime value)` when attempting to scrutinize at comptime. with hardcoded (statically-fully-known) payload values it works of course
<andrewrk>
metaleap, zig doesn't have the ability to accept a tagged union as a parameter, where the tag is comptime known, but the payload is runtime known
<andrewrk>
I suggest to have an additional comptime parameter with the tag type
<metaleap>
will go in that direction, much appreciated & obliged!
frmdstryr has joined #zig
<metaleap>
andrewrk: i'm amazed, this approach now compiles & works without any loss in smoothness for the caller, nor any extra verbosity. after the honeymoon high, i still love this phenomenal lang. brings a subtle joy of work back that was lost 20 years ago moving away from good ole dos pascal to C#. kudos to you & all who poured so much effort into this. looking forward to the self-hosted compiler so non-C guys like me can contribute more proactively/autonomousl
<metaleap>
y/at-all. now back to my codez.. :D
jessermeyer has joined #zig
<jessermeyer>
What is the encouraged way to send a zig string to a C api expecting a c string?
<jessermeyer>
Auto coercing doesn't seem to work in my favor here. error: expected type '[*c]c_ushort', found '*const [11:0]u8'
<andrewrk>
:)
<andrewrk>
I opened a handful of contributor friendly issues last night - things that can move from stage1 to self-hosted
<andrewrk>
jessermeyer, I'm guessing that C API wants UTF-16LE
<andrewrk>
std.unicode may help you here, but you're going to now have to deal with managing memory
<andrewrk>
well if it's a string literal, zig can convert string literals to UTF-16 LE without any memory management trouble
<andrewrk>
I don't think we have a function for that yet though
<andrewrk>
that would be a nice addition to std
<tgschultz>
I used to have one. It's probably outdated now.
<jessermeyer>
LPCWSTR
<jessermeyer>
Which is just a c string.
<andrewrk>
usage would be something like: const W = std.unicode.utf16leStringLiteral; FooWindowsFunc(W("string literal"))
<andrewrk>
jessermeyer, the W in LPCWSTR stands for "wide"
waleee-cl has quit [Quit: Connection closed for inactivity]
<mq32>
random thought: is a .NET/JVM backend in the scope of zig?
<mq32>
that would be pretty awesome because right now i have to write some of my libraries twice. One for native environments and one for .NET envs
<BaroqueLarouche>
P/Invoke is not an option ?
<andrewrk>
mq32, yes
<mq32>
it would be an alternative at least
<mq32>
but i would **love** to see a language that can both emit CIL and native code
<andrewrk>
I think zig is uniquely suited to generate code for vastly different environments
<mq32>
andrewrk, yeah, right. that's what sparked the idea
<mq32>
because we can already generate code für BPF
<mq32>
which is also a quite unity environment
<mq32>
it doesn't hurt when you have a garbage collector while using "manual memory management"
dimenus has quit [Quit: Leaving]
<mq32>
a free would just be "set the pointer to null and let the GC to the work"
<companion_cube>
that coudl actually help to find double free
<companion_cube>
(assert it's not already null in free)
<Snektron>
mq32, is c ffi not an option in C#?
<mq32>
Snektron, that's P/Invoke and is one of the best FFIs i've ever seen
<Snektron>
ah
<mq32>
you can model pretty much everything in P/Invoke that is foreign code
<mq32>
even the crazy windows stuff like BSTR and any COM interface
jessermeyer has quit [Remote host closed the connection]
<mq32>
i think it's not smart to start working on a CIL backend before 1.0/Selfhosting
<andrewrk>
yeah and the first step will be making zasm able to emit CIL or JVM bytecode
<andrewrk>
there is probably already an assembly syntax for these things, if not, it would mean inventing one
<mq32>
yep, there is one
<Snektron>
So would zasm be a replacement for zig ir?
<Snektron>
or would it be another stage
<andrewrk>
it's an assembler and linker
<Snektron>
or even an llvm-backend
<mq32>
Snektron, no, it's a second stage that will generate code. zig will emit assembler and zasm will assemble/link that code
<mq32>
you can actually create CIL projects in MonoDevelop and write hand-written "assembler" for .NET
<Snektron>
wait so zig -> ir -> llvm -> zasm -> machine code
<mikdusan>
zig -> ir -> zasm -> machine-code
<Snektron>
ah
<andrewrk>
it might not literally turn into assembly, but the code that lowers zig ir into machine code will need to use a lot of the same APIs that an assembler needs
<mq32>
fengb, because the buffer may not be resized
<mq32>
but it uses the array list internally to back the data
<mq32>
so readLineFrom filles the buffer with data
<mq32>
but as this may never be more than slice.len bytes, you are never required to reallocate memory in the buffer
<mq32>
as the buffer is backed by slice[]
<mq32>
so you either get error.OutOfMemory when your input slice is too small to fit a whole line or it succeeds
<fengb>
Hmm okay
<metaleap>
is that comment linked above outdated? "We cannot use Buffer.fromOwnedSlice, as it wants to append a null byte after taking ownership, which would always require an allocation." but i'm not seeing anything like that in Buffer.toOwnedSlice (it merely alloc.shrink()s and initNull()s which dont seem to alloc)
<metaleap>
aahh scratch that, "from" vs "to"
<metaleap>
too late
<daurnimator>
There's a few uses of `std.Buffer` in the standard library that should be changed/removed (e.g. io.readLine)
<frmdstryr>
Is there any way to make "error unable to inline" just a warning?
<frmdstryr>
For some reason it works fine when I build but errors when trying to test
<daurnimator>
fengb: why not make testing_allocator actually leak_allocator?
<daurnimator>
as in, testing.leak_allocator is a silly name: just call it testing.allocator
<fengb>
I was considering swapping the two names. Having one that doesn’t detect leaks can still be useful for the lazy
<daurnimator>
fengb: I disagree.... you should only get to avoid leak detection if you *need* to, and maybe they get to do it themselves.