<daurnimator>
andrewrk: the context was talking about "sometimes async" functions. plenty of dynamic languaes don't+can't have that.
<andrewrk>
I didn't mean to take away from lua or what you showed me, sorry for forgetting to give it a hat tip
<andrewrk>
but it's quite different - in lua there doesn't have to be a difference between async/non-async functions since the runtime is doing JIT. in zig the semantic analysis has to figure these things out statically
<andrewrk>
you certainly cannot use pre-allocated memory for async functions in lua
<scientes>
andrewrk, yes I know, what are you trying to show me?
<scientes>
add rax, 12
<daurnimator>
andrewrk: its not about the JIT at all; but yes, the whole @Frame thing is novel in zig due to lack of a garbage collector.
* scientes
wishes it was easy to dump GIMPLE
<daurnimator>
(which is a great thing!)
ltriant has quit [Ping timeout: 276 seconds]
<scientes>
that is just adding to the stack pointer
<andrewrk>
scientes, nothing- this is just a godbolt link demonstrating what you said earlier, that gcc supports this and clang does not. since you lost your example I provided one
<scientes>
ahh ok
<scientes>
looks like gcc-8 also supports it
<andrewrk>
not even clang trunk supports it
<scientes>
added in gcc-5
<andrewrk>
I'm trying to get a straight answer from llvm devs whether pointer casting a vector pointer to an array pointer is sound
<scientes>
i was talking to jdoeffert and he said to use GEP on vectors
<scientes>
andrewrk, no it is not, as the padding is different
<scientes>
(specifically vectors do not have any padding)
<scientes>
like it should work on a vector of u24
<andrewrk>
oh I see
<andrewrk>
I think a safe path forward, for now, will be having pointers to vector elements in zig give these less convenient types (as in my pull request #3575) and then a later improvement can potentially make it return a better type, maybe conditionally on whether the int is power of 2
<daurnimator>
andrewrk: re: event lock code: what would you think of replacing it with an intrusive linked list of threads waiting? (that's what we do in cqueues)
<andrewrk>
just making sure, by "threads" you mean suspended function frames, yes?
<daurnimator>
threads here I sort of mean "fat frame pointer"
<andrewrk>
what makes it fat?
<scientes>
andrewrk, my approach was to just throw an error if the type wasn't a power of 8 bits
<daurnimator>
andrewrk: also if you ever want to expose somethign on stream again, I'd consider e.g. ngrok. so you don't have to show your actual IP.
<andrewrk>
nice, I wasn't aware of that, thanks
Ichorio_ has joined #zig
<daurnimator>
andrewrk: oh heh. you discovered SIGPIPE on write :)
Jezza__ has quit [Ping timeout: 245 seconds]
<daurnimator>
andrewrk: 1. sendmsg has a MSG_NOSIGNAL sometimes. 2. OSX has e.g. SO_NOSIGPIPE. also F_SETNOSIGPIPE. also O_NOSIGPIPE, 3. for POSIX, you need to use pthread_sigmask around each write call
rjtobin has quit [Quit: Leaving]
<daurnimator>
andrewrk: also watch out for letting people write to your terminal..... most terminal emulators have bugs that can potentialy allow for code execution.
<andrewrk>
thanks
<daurnimator>
simple solution would be to strip or escape control characters
ltriant has joined #zig
ltriant has quit [Ping timeout: 265 seconds]
muffindrake has quit [Ping timeout: 245 seconds]
muffindrake has joined #zig
<scientes>
well the recent one was tmux emulation
<scientes>
tmux integration***
<scientes>
oh yeah I see, that is all done with control characters
<wilsonk>
Let me know if I totally messed something up please.
<wilsonk>
That is the unofficial storefront (with Andrews blessing). All profits will be going to support Andrew and Ziglang development (ie. my time/effort will not be compensated). Just so everyone is aware
<daurnimator>
wilsonk: any reason it's unofficial instead of official?
<wilsonk>
I think because I am running it...but you would have to ask Andrew. Probably can't be 'official' unless he is charge of it (or eventually the non-profit he has talked about, I would guess).
<daurnimator>
wilsonk: I want a premium hoodie with the ziguana on front and ZIG on the back :)
<wilsonk>
Yeah, my wife said something similar but the designer only let me add to the front. Not sure if it would cost a bunch more to have printing on front and back?? One of the mugs has both designs...and I think I could have modified the leggings to have two designs, but I couldn't see how to do it for the shirts/hoodies.
<daurnimator>
andrewrk: or alternatively to SPI; I had a chat to Karen the other week and you could pick the SFC
<wilsonk>
daurnimator: Oh, duh nevermind. I must have just missed it before. I can see how to do it and will add hoodies and shirts with both designs front and back.
return0e_ has joined #zig
return0e has quit [Ping timeout: 240 seconds]
<daurnimator>
andrewrk: FWIW SPI take 5% and are pretty bare-bones; while SFC take 10% and are more fully featured.
chemist69 has quit [Ping timeout: 264 seconds]
chemist69 has joined #zig
<daurnimator>
wilsonk: now the preview for the back of the hoodie is 404!
<wilsonk>
Might be because I am still working on it. I will let you know when I get finished
<daurnimator>
wilsonk: k
ltriant has joined #zig
mahmudov has quit [Remote host closed the connection]
ltriant has quit [Ping timeout: 246 seconds]
<wilsonk>
daurnimator: maybe give it another try now
<wilsonk>
All the two sided designs are at the bottom of the page right now under Zig-Ziguana Merch. I guess I will probably leave them there since they are more a little more expensive (only $2-4 more...though I think the leggings/socks are the same price somehow?? Same profit margin so I don't understand that but...whatever I guess)
leeward has quit [Quit: Leaving]
<daurnimator>
wilsonk: no more light grey option?
<wilsonk>
Let me check. They each have their own color pallet to choose from and I can't do custom colors (it should have auto-picked the same colors but maybe it missed that one).
doublex_ has joined #zig
doublex has quit [Ping timeout: 245 seconds]
bhansconnect has quit [Remote host closed the connection]
<wilsonk>
daurnimator: ok, I added the two design hoodie again with all available colors (including light grey). Hopefully that looks correct now
<daurnimator>
wilsonk: FYI there's now several products in the store "zig" "ziguana" "zig-ziguana" "zig-ziguana updated"
SrMordred has quit [Remote host closed the connection]
<wilsonk>
Yeah, I sort of wanted to have some way to distinguish them because the first "zig" designs only have the zig logo on the front, then the "ziguana" designs have just the ziguana on the front and the last two have both front and back (and this way I can delete specific design layouts in batches). One can also shop by category that way
<daurnimator>
wilsonk: the last 2 seem to be essentially duplicates aside from missing colours?
<wilsonk>
Yeah, I don't know if I can remove just one item at a time or if it has to be the whole batch. I will look into it to see if I can just remove the duplicate that doesn't have all the colors (I am new to this and removing these things isn't immediately obvious on that site)...I can't even see how to modify the items. Teespring seems to "publish" what you have designed and there may be no way to edit without re-designing the whole lot
<daurnimator>
wilsonk: sadly... things seem to add up super quickly. by time I get to checkout a single hoodie is $90 :(
<wilsonk>
Yikes that seems high, shipping seems to be more than I thought for anything outside the US and you picked the most expensive item also. (I even cut the recommended profit margin on almost every single item, including that one!). Custom designs are expensive apparently...but I did buy a t-shirt from another project and this is exactly in line with that pricing.
<wilsonk>
Are you in Europe? All pricing is slightly higher there also (with Canada second highest, then the US). The site says it ships from Europe so I am not totally sure why the pricing and shipping seem to be a little higher (exchange rates perhaps)
<daurnimator>
wilsonk: .au
<daurnimator>
we could probably drop one colour by making the iguana's eye the same colour as the boots
<daurnimator>
most only printing stores charge by number of colours
<daurnimator>
s/only/online/
<daurnimator>
Could also make the entire helmet transparent to drop a colour...
<daurnimator>
(or two colours really: the helmet makes the head a differenter green!)
<daurnimator>
Then we'd have: green, yellow, orange, black, grey..... hmm. still over the industry standard 3 colours in a design
<wilsonk>
Hmm, yeah I see what you are saying but I don't think it is making a difference here because I can see that the "zig" merchandise (which only has the two colors) is exactly the same price as the "ziguana" merch ( and the profit margins are within pennies of each other or exactly the same).
<wilsonk>
Yeah, that might be an option also. I like that you can add stuff to the arms on that site also. I can look at adding something there, I suppose. Did you try to check out that item to get a total price? Looks like $57.20 Australian dollars here (plus shipping, taxes and duty/vat, I would guess).
<daurnimator>
wilsonk: same price here. AU prices include taxes etc. Wasn't able to get shipping though without entering details
<daurnimator>
AU$9.35 for local standard shipping on just that single item. or free for pickup (they're like a 30 min drive from me....)
<wilsonk>
Oh, yeah I would think that would be cheaper for you for sure, especially if taxes are included and shipping is in country...but more expensive for others, is all.
<daurnimator>
wilsonk: huh. $16 for international shipping
<wilsonk>
Not too bad
<daurnimator>
oh interesting; it goes down to $52 for international. (must remove local taxes...)
<wilsonk>
Ah, cool because we will have to pay those on import here anyways
brodeuralexis has joined #zig
<andrewrk>
alright... CI should be stable again
gsomix has joined #zig
<gsomix>
hey, everyone
<wilsonk>
hey
<gsomix>
I want to build tetris game by andrewrk in Windows. how should I deliver libraries (libepoxy and glfw) to my system?
ltriant has joined #zig
<daurnimator>
gsomix: 1. your host system? or the destination system? 2. do you want to statically link? or dynamic?
<gsomix>
both Windows. it seems statically link as described in build script
telemach has quit [Remote host closed the connection]
return0e has joined #zig
return0e_ has quit [Ping timeout: 268 seconds]
m4ge123 has left #zig [#zig]
ltriant has joined #zig
ltriant has quit [Ping timeout: 268 seconds]
brodeuralexis has quit [Ping timeout: 260 seconds]
allan0 has joined #zig
rj00 has quit [Quit: WeeChat 2.6]
return0e has quit [Read error: Connection reset by peer]
return0e has joined #zig
hesamr has joined #zig
ltriant has joined #zig
ltriant has quit [Ping timeout: 240 seconds]
kllr_sbstn has joined #zig
hesamr has quit [Remote host closed the connection]
kllr_sbstn has quit [Quit: WeeChat 2.6]
ky1ko has quit [Ping timeout: 240 seconds]
ky1ko has joined #zig
dch has joined #zig
forgot-password has joined #zig
<forgot-password>
Hey guys, I was wondering if anybody has done some embedded programming with Zig?
ltriant has joined #zig
* mq32
waves his hand a bit
<mq32>
i didn't get much though as i ran into compiler bugs at the time (was some months ago)
<mq32>
should give it a shot again
ltriant has quit [Ping timeout: 268 seconds]
<forgot-password>
What exactly did you do? I'm looking into trying to get some zig code running on my arduino for a start.
<mq32>
arduino with AVR or cortex m-3?
<mq32>
(arm)
<mq32>
i tried to run code on a cortex-m3 (ARM)
<mq32>
For AVR you will be on your own i think
<mq32>
i can try helping with "generic knowledge", but don't have hardware on me to test it
<forgot-password>
I have an older Arduino Uno, I'm pretty sure it's just AVR
<mq32>
Arduino Uno is AVR
<mq32>
for a start i would get the datasheet for the µC and the CPU arch
<mq32>
afaik you need some inline assembler on the beginning of the flash that will do interrupt handling
<forgot-password>
How do I even flash the arduino then? First of all I'll have to set my target arch to avr, right?
<forgot-password>
Do you know of any tools to get the generated binary into the flash? I've heard of avrdude, but haven't looked into it much.
<forgot-password>
Will do some research, thanks for your help so far :)
<mq32>
avrdude is quite good
<mq32>
documented and has a very verbose mode (-vvv)
<mq32>
so good to debug
<mq32>
the arduino has an ISP bootloader that will fake an STK500 interface, so you need to use avrdude with stk500v2
marijnfs has joined #zig
<forgot-password>
Is it a default bootloader that I can just install via the arduino ide?
<mq32>
it is already installed on every arduino you buy
<mq32>
otherwise you need some *real* ISP programmer like AvrISP or STK500
<forgot-password>
Thank you very much. Hopefully I get to play around with it this evening :)
<mq32>
:)
<mq32>
i'm tempted to play around with more embedded HW, but i should focus on my current project :D
<forgot-password>
It's unsurprisingly a lot easier to pile that stuff up than get it done :p
<mq32>
haha, true that
sossy has joined #zig
Ichorio_ has quit [Ping timeout: 264 seconds]
<bgiannan>
On a old macOS (Sierra) i'm getting a '_futimens not found' error. Any clue why this is happening. It's working fine one High Sierra/Catalina
forgot-password has quit [Quit: leaving]
gsomix has quit [Quit: Leaving]
<daurnimator>
bgiannan: seems like that's expected: sierra didn't include support for futimens
<bgiannan>
is zig on sierra not supported then?
<daurnimator>
bgiannan: correct; see zig homepage: macOS 10.13+
<bgiannan>
huh, i guess i'll try and upgrade my old laptop then
dimenus|work has joined #zig
<daurnimator>
bgiannan: in general zig only supports OSes supported by an upstream vendors. apple only support the latest 3 releases of their OS, which at this point is catalina, mojave, high sierra.
<bgiannan>
noted
riba has joined #zig
<daurnimator>
bgiannan: that said, I assume the futimens call is coming from fs.file.updateTimes? Which is allowed to round off to less precision. So we would probably accept a fix
<daurnimator>
bgiannan: though you might just end up getting a new error in its place
<bgiannan>
daurnimator, no idea where the symbol is used, it errors on llvm output step with no stack trace
<leeward>
Is there a way to print out arbitrarily-sized integers with something like std.debug.warn?
<daurnimator>
leeward: where did you get an arbitrary sized integer?
<daurnimator>
leeward: comptime or runtime?
<daurnimator>
leeward: but in general: zig comptime integers will "just work". runtime ones you'd already have a bignum object or similar and you can add a .format() method
<leeward>
comptime
<leeward>
Well
<leeward>
It's not arbitrary. It's a u512.
<leeward>
I got the number I want printed at runtime.
<daurnimator>
leeward: and what happens when you try and print it with std.debug.warn?
<daurnimator>
leeward: ah k. some math operations are missing for large integer sizes.
<daurnimator>
leeward: the printing algorithm probably does something like divide by 10 as it goes.... and we haven't provided a way to do division of a u512 yet
<leeward>
I can assign it to a variable and it builds and runs.
<leeward>
Ah, ok.
<leeward>
Is there a "print in hex/binary" mode that might work?
<leeward>
Unrelatedly: I don't see anything in the giant documentation file about reading from standard input. Should I be using scanf?
<daurnimator>
leeward: std.io.getStdIn() returns a !File
<leeward>
So I get the stream from that and... `.read()` it?
<daurnimator>
leeward: I think you're meant to use InStream and then use .readByte / .readNoEof / etc.
<mikdusan>
currently no zig userland `scanf()` stuff. there is std.mem.separate() and std.mem.tokenize() which are very helpful. also if one really wants scanf() i suppose use it from the c-library
<daurnimator>
leeward: but yeah; I think we're missing basic scanf like parsing at the moment
<mikdusan>
(after reading like daurnimator mentions)
<keithdc>
re: zig merch: For me (In Ireland) the premium hoodie is coming up as 47.50 euro. Shipping is 5.29 and handling 1.39, which seems reasonable.
<mikdusan>
daurnimator: is it idiomatic to desire wrapping behavior for a FIFO in `discard()`; seems counterintuitive that discard-too-many leaves FIFO with data
<daurnimator>
mikdusan: huh? I don't understand
<mikdusan>
one sec. i'll make example in case my understanding is wrong.
<companion_cube>
replace scanf with comptime parser combinators 🙃
<daurnimator>
companion_cube: agreed. when can you start? :)
<mq32>
i just ordered 20 Ziguana-Stickers to deploy in the local hackerspace *grin*
<riba>
mq32: where's that
<mq32>
shackspace / germany
<mq32>
(stuttgart hackerspace)
<riba>
oh, stuttgart
<mq32>
your from munich?
<riba>
no, i live by the bodensee
<THFKA4>
i wanted to make a cool orange-on-black zig cup, but every site has a minimum order of like 70
<riba>
i went to uni in vienna, i liked the metalab
<mq32>
then i interpreted your hostname wrong :D
<mikdusan>
i break mugs at a rate of about 2 per year. so yeah, 70 is too much :)
<riba>
they had one of those japanese toilets with a heatable seat
<mq32>
haha neat
<mq32>
i wonder if i could get enough people together for a zig meetup, but i think it's still too early
* mq32
has to do some propaganda
<daurnimator>
THFKA4: where are you located?
<THFKA4>
u.s.
<daurnimator>
mq32: co-locate with something else big. FOSDEM is probably a good one for most people (myself excluded :( )
doublex_ has quit [Ping timeout: 240 seconds]
<mq32>
daurnimator: i didn't plan to be *this* big :D
<mq32>
and we already have a lot of meetups at our hackerspace
<riba>
the last time i went to stuttgart was because my work sent all devs to the "jugs meetup"...
<riba>
now at least i have a bag that says JUGS on it
<mq32>
if you like old computers, you could visit our small "retro computer" meetup :D
<riba>
("java user group stuttgart")
<mikdusan>
daurnimator: yeah nevermind about my prev Q. i misunderstood the code
<mq32>
yeah, looked that up already
<riba>
i'll try to remember it next time i have to go up there
<riba>
sounds good
bjorob has quit [Ping timeout: 240 seconds]
tgschultz has quit [Quit: Going offline, see ya! (www.adiirc.com)]
tgschultz has joined #zig
doublex has joined #zig
dimenus|work has joined #zig
Akuli has joined #zig
<dimenus|work>
andrewrk: just as an fyi, it looks like we're generating non 16 byte aligned movapd instructions on windows (with your array access PR)
<dimenus|work>
the same codebase does not #GP on Linux o.0
<companion_cube>
wow, cmdlinezig looks good, talk about comptime magic
doublex has quit [Ping timeout: 246 seconds]
doublex has joined #zig
crimson_penguin has quit [Ping timeout: 264 seconds]
crimson_penguin has joined #zig
ltriant has joined #zig
ltriant has quit [Ping timeout: 240 seconds]
riba has quit [Ping timeout: 240 seconds]
<andrewrk>
dimenus|work, let me double check the IR. which function was that in?
waleee-cl has joined #zig
<leeward>
andrewrk: That WSL bug also causes problems with async.
mahmudov has joined #zig
<gonz_>
leeward: What bug is that?
doublex has quit [Read error: Connection reset by peer]
hspak has quit [Ping timeout: 240 seconds]
<leeward>
gonz_: integer overflow in vdso.zig
<leeward>
I found it originally when trying to `zig build docs` under WSL. It gets to "docgen example code 3/257...integer overflow"
<andrewrk>
I think there is a way to change this logic so that it additionally works under WSL
<daurnimator>
How can I discard const from a pointer?
<daurnimator>
==> I have a `[]const u8` and I want to write `undefined` to it for valgrind to pick up other errors
<leeward>
That's an interesting thing to do.
<andrewrk>
that's not sound. your reference says that you're not allowed to write through it, and you're trying to write through it
doublex has joined #zig
<andrewrk>
it seems like it should not be const to me
<daurnimator>
mmmm, okay
bhansconnect has joined #zig
* daurnimator
now has `fn fooNotConst() []T` and `pub fn foo() []const T { return fooNotConst(); }` methods
<andrewrk>
I suggest `Mut` instead of `NotConst`. Also, the std lib does this in a few places but matching the keywoard, the bare function is mutable, and the const one has a Const prefix
<daurnimator>
andrewrk: in this case, I only need the non-const one for internal purposes.
<andrewrk>
makes sense
TheLemonMan has joined #zig
<TheLemonMan>
leeward, can you print and paste somewhere the content of `eh` in the `lookup` function?
<leeward>
Is there a way to tell if an async function has terminated when I resume its stack frame?
<andrewrk>
leeward, you can't do that, that's a race condition
<leeward>
Maybe I'm not being clear. I have an async function, and it suspends a few times then returns. I want to know when it's returned.
<scientes>
leeward, you could use a mutex that it holds and then releases right before returning
<scientes>
but as was said, its still a race condition
<scientes>
if you use a thread, then things are a bit different
<leeward>
So is there a race condition on suspend/resume? Can I be sure that the function's run to the first suspend point after I resume it?
<leeward>
The second "Suspend and Resume" example seems to imply that I can.
<andrewrk>
leeward, if you're calling resume, you have to be sure that it's suspended
<andrewrk>
are you trying to make a generator?
<leeward>
How'd you guess?
<andrewrk>
because it's tempting to make a generator out of suspend/resume, but it's not the correct abstraction :)
<andrewrk>
consider that in theory (not in current zig) it's possible to have an async generator
<andrewrk>
where getting the next value could be a suspension point
<andrewrk>
which means the generator needs to be able to suspend and get resumed for async I/O purposes, without having the get-next-value thing mess with its suspend/resume state
<andrewrk>
these are separate things
doublex has quit [Ping timeout: 268 seconds]
<andrewrk>
a generator function could be suspended due to e.g. read(), but then when a callsite does generator.next() it should not resume; instead it should register the caller's handle, so that when the generator gets resumed by read() then it proceeds to a yield which resumes the caller of next()
<andrewrk>
in short: `suspend` and `yield` are distinct concepts
<andrewrk>
both of these examples are single threaded for starters
<leeward>
Is there something in the examples that constrains them to being single threaded?
<leeward>
If so, why can't I tell if a resumed async function has returned?
<andrewrk>
the second example has a race condition if you enable multi threading and put a different suspend point before the suspend block
<andrewrk>
the example is valid because when `resume` is executed, it is guaranteed that the function has suspended
doublex has joined #zig
sossy has quit [Remote host closed the connection]
<leeward>
How is it guaranteed? By the fact that multithreading is disabled?
<andrewrk>
threads come from std.event.Loop.initMultiThreaded(), which is the default when you don't pass --single-threaded and you use pub const io_mode = .evented; in your root source file
<andrewrk>
these tests do not opt in to multi threaded event loops (and in fact there is not a way to do this yet)
<andrewrk>
it's guaranteed because you can see the control flow. it goes from the suspend block back to the test function, and resume is the next line
<andrewrk>
" At any point, a function may suspend itself. This causes control flow to return to the callsite (in the case of the first suspension), or resumer (in the case of subsequent suspensions). "
<andrewrk>
"why can't I tell if a resumed async function has returned?" => because every use case for this has a better solution that you should do instead
ltriant has joined #zig
riba has joined #zig
<leeward>
Ok, so what's the better solution for joining a thread?
<leeward>
That seems like a legitimate use case.
<leeward>
Is it the mutex thing?
<andrewrk>
joining a thread is std.Thread.wait
<andrewrk>
async functions are not threads
<leeward>
I guess I'm missing what they are. The docs don't really describe their semantics completely or suggest a use for them.
<andrewrk>
I agree the docs of async functions is severely lacking
<andrewrk>
think of it this way: an async function is a function that you can begin at one callsite, but collect the result at a different site
<leeward>
Is there a mechanism for returning things through them?
<leeward>
Other than passing in pointers, that is.
<andrewrk>
yes you can use the return statement just like normal functions
<leeward>
It uses pthreads in the posix implementation, but I'd like to make a general purpose implementation that I can use on bare metal. The docs say that async works on freestanding, so I'm hopeful.
<dimenus|work>
andrewrk: so the bug doesn't exist at all if i declare my structs extern instead of packed
<andrewrk>
dimenus|work, that makes sense
<andrewrk>
consistent with #3133
<andrewrk>
leeward, yes, zig's async functions are uniquely suited to working on freestanding
<andrewrk>
you'll have to figure out how suspend and resume work. once you get it, I think you'll be happy with it
<andrewrk>
but it's a new concept you have to learn
<andrewrk>
leeward, one thing that might help is reading the tests in test/stage1/behavior/async_fn.zig and try to understand all the control flow
frmdstryr has joined #zig
<leeward>
andrewrk: okers, I'll check those out.
<leeward>
Incidentally, I have a 3-line change that gets the tests to pass under WSL. I'm not sure it's a good idea, though, since it changes the + and - operators to %+ and %-. It probably is actually a bug in WSL. I don't know enough about vdso to tell though.
<andrewrk>
leeward, one clue that might help thinking about this: `suspend` is *tightly coupled* with its corresponding `resume` elsewhere in the codebase
<andrewrk>
for example in the std lib event loop, there's a function called waitUntilFdIsReadable. this calls suspend, puts a pointer to its frame in an epoll set/kqueue/WIOCP, and then when a worker thread gets woken up by epoll/kqueue/WIOCP, it calls `resume` on the corresponding frame pointer
<scientes>
can the async stuff be used to implement something like setjmp()/longjmp()?
<scientes>
not that i really need it, but I think its a basic construct for languages to have
<leeward>
Sounds like a scheduler
Akuli has quit [Quit: Leaving]
<scientes>
leeward, your program is still totally preemptable on Linux, unless you do special thing and have special permissions
<leeward>
Sure, if I'm running atop Linux.
<scientes>
schedulers also need timers
mbarkhau has joined #zig
<leeward>
Preemptive ones do, sure.
<leeward>
Cooperative multitasking: for when you want any user to be able to hang the system.
data-man has quit [Remote host closed the connection]
data-man has joined #zig
plumm has joined #zig
<plumm>
andrewrk: is there a way to represent a variable as a type only known as runtime within a struct?
<nrdmn>
plumm: sounds like tagged unions to me
<data-man>
Good day, Zig community!
<plumm>
plumm im writing a zig version of the rust structopt library. id like to handle invalid types while parsing cli given the structs type, and i want to catch overflow; im not sure how to store the actual value of what the type denotes it to be
<plumm>
nrdmn: *
<andrewrk>
good day, data-man
marijnfs_ has quit [Quit: WeeChat 2.6]
ltriant has joined #zig
data-man has quit [Ping timeout: 260 seconds]
data-man91 has joined #zig
data-man91 has quit [Remote host closed the connection]
data-man has joined #zig
<data-man>
andrewrk: Is there a reason why integer size is limited to 65535 bits?
<scientes>
data-man, LLVM
<scientes>
talk to them if you want to change it
<andrewrk>
one answer is that LLVM has this limitation. But LLVM is only one possible backend for zig
<scientes>
also, you can't do much with integers that big
<andrewrk>
so, a good question will be what to set this limit to in the language specification
<scientes>
as llvm doesn't have a bigint implementation
<scientes>
so really anything bigger than u128/i128 doesn't really work
ltriant has quit [Ping timeout: 268 seconds]
<andrewrk>
I'd like to make this work though. in theory compiler_rt could gain bigint versions of functions and then any size can work
<companion_cube>
what do you even do with such big integers ‽‽
<andrewrk>
crypto is one use case
<companion_cube>
I mean, it'd be weird not to use actual bigints
<scientes>
andrewrk, why not use libgmp?
<companion_cube>
you don't do crypto with more than 65k bits, do you? :D
<scientes>
or whatever
<scientes>
companion_cube, its 64ki bits BTW
<scientes>
2^16
<data-man>
Oh, I increased limit to 262143 bits, works fine.
<scientes>
data-man, except what operations can you do?
<scientes>
does even addition and subtraction work?
<companion_cube>
at this point it has to be heap allocated integers, better reuse GMP
<scientes>
and what endianness does it use?
<data-man>
scientes yes, works. I want make PR (or proposal) for this, but first wanted to know an opinion.