ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
steveno has joined #zig
emekoi has quit [Quit: Page closed]
steveno has quit [Quit: Leaving]
<c15ade4>
its cool how you can watch the livestreams a bit later
<c15ade4>
semi live stream
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<c15ade4>
andrewrk: just a warning, i think you made a slight mistake at the beginning
<c15ade4>
Im not sure you intended the camera to be active while the countdown was on
rlr has quit [Quit: quitting]
return0e has quit [Read error: Connection reset by peer]
return0e has joined #zig
wilsonk has joined #zig
<daurnimator>
Where are std lib docs?
<daurnimator>
andrewrk: watching your stream now
<daurnimator>
andrewrk: clone2 is just fork with extra flags.
<daurnimator>
andrewrk: newer platforms don't have a fork syscall. you're meant to use the clone2 syscall instead.
<andrewrk>
daurnimator, that's really good to know, thanks
<daurnimator>
andrewrk: there are many syscalls that have gained an extra flags argument as time goes on. newer arches don't get the old syscall without the flags argument.
<daurnimator>
which is essentially that a non-async function needs to be able to call an async function
<daurnimator>
--> what is zig's current status/thinking on that?
<andrewrk>
daurnimator, how would that work with needing to suspend? would functions secretly be generated as coroutines?
<andrewrk>
most coroutines need access to an event loop object
<daurnimator>
andrewrk: so there's a few approaches:
<andrewrk>
I have a lot of bones to pick with this red/blue function article
<daurnimator>
1. if you try and yield() and you're called from an non-async function. it throws an error instead.
<andrewrk>
also - this conversation is interesting to me but I have some household duties at the moment. I hope you stop by during the day soon when I can give you more attention
<daurnimator>
this can be helpful if you can write a function like so: async fn foo(x) { if (x > 42) { suspend wait(); } else { return compute() } }
<daurnimator>
i.e. a function that only *sometimes* needs to do async work
<daurnimator>
that can be helped along by a function `is_suspendable`
<daurnimator>
2. construct an event loop *inside* of the current function call so that the async function is resumed multiple times from the sync() call site.
<andrewrk>
I have a lot of thoughts on this
<daurnimator>
2. can be combined with 1.: fn foo() { looptype loop; if (@isSuspendable()) { loop = mainloop } else { loop = newLoop(); } loop.addJob(fooJob); if (!@isSuspendable()) { loop.runUntilEmpty(); } }
<daurnimator>
(sorry for pseudo-syntax. I don't know zig much yet so I'm sort of combining all sorts of things together)
<andrewrk>
check the logs tomorrow and I'll have a thoughtful response for you
<daurnimator>
andrewrk: k :)
<daurnimator>
andrewrk: our time zones don't match up very well
<diltsman>
Given this code: const vector_table align(4) section(".vector") = VectorTable.{.initial_sp_value = 0x20100000,.reset = _start};
<diltsman>
I get this in the binary: 82b00846 01910090
<diltsman>
Any ideas?
<diltsman>
This is the struct definition: const VectorTable = packed struct.{initial_sp_value: U32,reset: fn () void};
<diltsman>
Why wouldn't I see some bytes that look vaguely like 0x20100000?
_whitelogger has joined #zig
tolitius has quit [Client Quit]
tolitius has joined #zig
rlr has joined #zig
rlr has left #zig ["WeeChat 2.3"]
<andrewrk>
diltsman, that output looks surprising to me
<hryx>
andrewrk, just watched (and enjoyed) the stream video. I didn't know you're doing weekly streams!
return0e has quit [Remote host closed the connection]
<andrewrk>
I recommend: * Allocators & Memory Management * Compile Time Code Execution * "Hello World" x86 Kernel
<hryx>
rad. I'm looking forward to those
tolitius has quit [Quit: zzz...]
tolitius has joined #zig
tolitius has quit [Client Quit]
tolitius has joined #zig
tolitius has quit [Client Quit]
tolitius has joined #zig
tolitius has quit [Client Quit]
tolitius has joined #zig
tolitius has quit [Client Quit]
tolitius has joined #zig
tolitius has quit [Client Quit]
tolitius has joined #zig
tolitius has quit [Client Quit]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jjido has joined #zig
presiden has joined #zig
jjido has quit [Ping timeout: 245 seconds]
jjido has joined #zig
jjido has quit [Ping timeout: 246 seconds]
jjido has joined #zig
porky11 has joined #zig
very-mediocre has joined #zig
m4ge123 has quit [Read error: Connection reset by peer]
m4ge123 has joined #zig
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
return0e has quit [Remote host closed the connection]
return0e has joined #zig
davr0s has joined #zig
DutchGh0st has joined #zig
<DutchGh0st>
does the compiler run on arm?
<DutchGh0st>
I downloaded the LInux 0.3 compiler, on my raspberry, but it cant run it..
<nbjoerg>
pre-built is x86_64 only
<DutchGh0st>
mhh okey, how do I build for arm then?
<nbjoerg>
build from source?
<DutchGh0st>
I guess
<DutchGh0st>
mh, bad luck at first try: " llvm-c/Core.h: No such file or directory",
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<DutchGh0st>
I have gcc 8.2.0 and clang 7.0.0 installed, but I dont know how this all works ^^
jjido has quit [Ping timeout: 264 seconds]
davr0s has joined #zig
steveno has joined #zig
<diltsman>
andrewrk, it looks odd to me, too. The only other thing that the linker puts in that section is a while(true) loop for _start. It appears mostly correct (bn. 8000e in there twice...)
<diltsman>
Dumping .text seems to think that the symbol at 00080000 is <panic>, though I don't know where that is coming from.
<diltsman>
andrewrk, I had to export the vector_table symbol. I wouldn't think that would be necessary, since the .vector section is like this in the linker script: KEEP(*(.vector))
<MajorLag>
DutchGh0st, ArrayList(u8) is basically what you're describing.
<diltsman>
andrewrk, it seems to be working now. The issue was that the vector_table symbol was not being exported (not certain why I needed to declare it export). I declared it export, had to change the types of the vector table entries to be C ABI compatible, then recompiled. It had been placing the panic handler at the location of vector_table. Still not certain why I had to export it even though the section has KEEP in the linker script.
<daurnimator>
DutchGh0st: I'm used to languages with immutable strings, so I wouldn't even expect that as part of a string library!
<DutchGh0st>
Immutable Strings...mhh
<DutchGh0st>
I think extend() and push() are essential to a String
<DutchGh0st>
why? well, if the capacity is large enough, why would't you be able to just push and extend? creating a new string, allocating enough space AND then copying everything over seems really expensive
<daurnimator>
DutchGh0st: because with immutable strings you can reference count them. as well as storing other data along side such as hashes, utf8 validity, etc.
<DutchGh0st>
now, sure, I also need to do that, but a *good* implementation only needs to do that a 'couple of times to be able to hold huge number of characters
<DutchGh0st>
Just put reference counted struct around a mutable String
<DutchGh0st>
and provide acces to it using like "getRef()" or "getMut()", which would bump the refcount
<Hejsil>
DutchGh0st, Immutable string uses a different data structure from mutable ones, so they don't require a copy on append
<Hejsil>
Normally they do at least
<Hejsil>
"append"
<daurnimator>
DutchGh0st: immutable strings can also more easily use data in the data section of your executable etc.
<daurnimator>
anyway. different strokes for different folks
<Hejsil>
It really depends on the problem
<DutchGh0st>
oh it more keeps track of the little strings, but all those little strings may on different places in memory, Hejsil?
<Hejsil>
I'm not 100% sure on the datastructure. It tends to be some kind of tree of cache sized blocks i think
<daurnimator>
DutchGh0st: now you're talking about a rope...
<Hejsil>
But yea, you'll get memory in different places
<DutchGh0st>
heh ^^
<Hejsil>
But an allocator could fix a lot of cache issues with such a data structure
<DutchGh0st>
How did you read my mind haha
<DutchGh0st>
I just wanted to ask "but what if you Iterate, don't you get lots of cache misses"?
<Hejsil>
:)
<Hejsil>
Different tools for different problems. Sometimes you don't want shared strings, and the copy would cost more than the cache miss
<Hejsil>
shared mutable strings*
<daurnimator>
and now you're asking about gap buffers. possibly without realising it