<wilsonk>
how does one force a local directory executable to be output from a build.zig file? ie. I just want to continually overwrite an exe in the local build dir and not have exe's peppered in the zig-cache dir (object files in the cache are still preferred, of course)
<wilsonk>
I used b.addExecutable("blah", "blah.zig")...but that peppers the cache
<wilsonk>
hmm, nvm I suppose I can just use the 'run' step (still curious though if someone feels like chiming in) :)
<scientes>
wilsonk, the run step will still pepper the cache
<wilsonk>
scientes: hmm, seems to just run here from the build.zig file using 'zig build run' and then there isn't even a 'blah' file in the cache at all?
<wilsonk>
so no peppering, but no actual exe either though
<scientes>
you mean using "zig run"
<scientes>
that uses the cache last time i checked
<wilsonk>
no, not just 'run' but using 'zig build run' because then the build file runs the exe (so the build.zig file has a run_cmd that invokes 'exe.run()' )
<wilsonk>
or at least that seems to be the way this is working
<scientes>
its easy to test
<scientes>
if you run "zig run" twice the second time is much faster
<scientes>
ahh thats differn't i don't use builder
<wilsonk>
ah, ok. Yeah I have mostly just used the command line before, but in this case, I was wondering how to get the build.zig file to output just an exe in the local build dir.
<wilsonk>
the 'zig build run' command is actually quite nice because I use spacemacs and just run from within the ide to test. The highlighting, file-local autocomplete and especially 'automatically jump to compilers error line' functionality are nice (it jumps to lib headers and files outside your project, which is nice when working with C headers)
scientes has quit [Remote host closed the connection]
scientes has joined #zig
scientes has quit [Max SendQ exceeded]
coolreader18 has joined #zig
<andrewrk>
I'm considering making `install` the default step of zig build, and making the default install prefix `build-<mode>`
<andrewrk>
So for a hello world application, `zig build` would produce build-debug/bin/hello
<mikdusan>
andrewrk: side question: are all the flags used to create .o or .lib or .exe factors of their zig-cache hash?
<andrewrk>
And then the follow up question would be, what does `zig build run` do? Run it out of the cache dir or the install dir?
<andrewrk>
mikdusan: yes
<mikdusan>
some exes may *require* a known tree structure (install) to run from. some may not. but if the default is to install,
<mikdusan>
then my vote is for examples and such, the default `zig build run` should be geared towards running from install location
<andrewrk>
That makes sense
<andrewrk>
A related topic is when there are dependencies on packages via the zig package manager. Some dependencies may supply tools. For example, a dependency on a sha256 package may provide a sha256sum binary for general development/debugging use
<wilsonk>
andrewrk: it actually just runs the exe without leaving a remnant that I can see!?? So it literally runs the program being built from within spacemacs and then the local dir and zig-cache contain no file called "blah" once I quit the program?? Seems like a cool feature to me but maybe it isn't supposed to be doing that?
<andrewrk>
wilsonk: I believe it's running the program from inside the zig-cache dir
<wilsonk>
haha, woops nvm. I am on windows and wasn't searching for 'blah.exe'...duh
<wilsonk>
I keep bouncing back and forth between linux/win/osx and forget things sometimes ;)
<mikdusan>
andrewrk: interesting. so the `prerequisite` definition itself may say "ok my prerequisite is pretty darned sophisticated... need to supply a binary to make it work"
<andrewrk>
mikdusan, yes you can depend on, for example, a javascript minifier and then use it in your build.zig
<mikdusan>
TIL writing fuzzer compile-error tests... when you get into the "thousands" of lines, stage1 is wants the GBs of heap
<coolreader18>
Hi all, I've been working on compiling Zig to the TI-Nspire (a graphing calculator) and I was wondering what the best way to go about possibly merging my changes to the compiler into upstream would be. The diffs on it are sort of strange since the TI Nspire is sort of an exotic target, so there are a couple things that probably wouldn't fly getting merged directly into upstream as they are; I was just trying to get it
<coolreader18>
One thing also is that I've been depending on the libc that the main toolchain for development on the TI-Nspire depends on (ndless: https://github.com/ndless-nspire/ndless) and I'm not sure if it would be good to require `link_libc` or what the best way to do that would be.
<andrewrk>
Hi coolreader18 , this is a pretty fun use case you've got here
<andrewrk>
What architecture is that?
<andrewrk>
In direct answer to your question, please feel free to open a pull request with all your changes and we can discuss from there
<coolreader18>
It's armv5te and the libc uses gnueabi
triplefox has quit [Ping timeout: 248 seconds]
triplefox has joined #zig
<mikdusan>
for tests and builds i see a lot of "Unable to dump stack trace: FileNotFound" and the line above showing a truncated pathname
<mikdusan>
is this a bug?
<mikdusan>
ok i found #1938
triplefox has quit [Ping timeout: 250 seconds]
coolreader18 has quit [Ping timeout: 246 seconds]
qazo has quit [Ping timeout: 258 seconds]
kristoff_it has joined #zig
rivten has joined #zig
avoidr has quit [Quit: leaving]
kristoff_it has quit [Ping timeout: 255 seconds]
mikdusan has quit [Quit: WeeChat 2.3]
hio has joined #zig
SimonNa has quit [Remote host closed the connection]
tdc has quit [Quit: Leaving]
jevinskie has joined #zig
jevinskie has quit [Ping timeout: 258 seconds]
mikdusan has joined #zig
jevinskie has joined #zig
Zaab1t has joined #zig
Zaab1t has quit [Remote host closed the connection]
jevinskie has quit [Ping timeout: 255 seconds]
redj is now known as hix
hix is now known as hix2
hix2 is now known as nixeus
nixeus is now known as redj
knebulae has joined #zig
jevinskie has joined #zig
<stratact>
Alright, I'm donating $15/month to andrewrk now :)
jevinskie has quit [Ping timeout: 246 seconds]
halosghost has joined #zig
THFKA4 has quit [Quit: WeeChat 2.4]
THFKA4 has joined #zig
tdc has joined #zig
stratact has quit [Quit: WeeChat 2.4]
heitzmann has quit [Read error: Connection reset by peer]
heitzmann has joined #zig
rivten has quit [Ping timeout: 256 seconds]
SamTebbs33 has joined #zig
SamTebbs33 has quit [Remote host closed the connection]
jevinskie has joined #zig
Sahnvour has joined #zig
avoidr has joined #zig
jevinskie has quit [Ping timeout: 245 seconds]
jevinskie has joined #zig
jevinskie has quit [Ping timeout: 245 seconds]
meheleventyone has joined #zig
<donpdonp>
if i could change one thing about zig it'd be to make the semicolons optional
wootehfoot has joined #zig
wootehfoot has quit [Quit: Leaving]
wootehfoot has joined #zig
wilsonk has quit [Ping timeout: 245 seconds]
wilsonk|3 has joined #zig
<BitPuffin>
true
meheleventyone has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<halosghost>
really?
<BitPuffin>
I wouldn't change that one as my one thing haha
<BitPuffin>
I think it would be nice not to have them though
<BitPuffin>
What I would change is to make function be a namespace for other functions. So you can define (non-closure) helper functions order independent
<BitPuffin>
That way you can know that those functions are not called anywhere but the enclosing function
<andrewrk>
BitPuffin, you can do this right now with anonymous structs
<BitPuffin>
but an IDE can tell you that. But you also know that nobody will call that function unless it's moved out
<andrewrk>
furthermore you have access to comptime parameters within that context
<BitPuffin>
I will use that, but it's a bit clunkier than I'd like if it was just possible to put the functions in there immediately
<BitPuffin>
but this is terrific to know about
<BitPuffin>
Oh and also it's not order independent
<BitPuffin>
so I have to front load my function with struct declarations
<andrewrk>
within a struct it is order independent though
<andrewrk>
so front load your struct and everything is golden
<BitPuffin>
Yeah that's true, because the file is also a struct
<BitPuffin>
and it's order independent there
<BitPuffin>
Yeah I'm gonna have to front load, I just wish I didn't have to. But that it's supported in at least some small way is very good
<BitPuffin>
The other thing I'd want is some keyword that restricts the amount of variables visible to a block (note, not procedures or types)
<BitPuffin>
so i can be like
<BitPuffin>
only x, y { ... }
<BitPuffin>
* Reduce the amount one must remember.
<BitPuffin>
or you could even say only {} and now you know there are no global variable reads/writes here
<andrewrk>
yes, unfortunately such syntax is competing with the amount of language one must remember (or even initially learn)
<BitPuffin>
btw is there any reason why () is used in if statements
<BitPuffin>
I don't see what's gained other than some extra noise. Or is there some kind of ambiguity with | being looked at as some bitwise operator or something
<BitPuffin>
I guess that could be the case
<andrewrk>
BitPuffin, ternary
<andrewrk>
var x = if (c) a else b;
<BitPuffin>
ah I see
<BitPuffin>
var x = if c a else b;
<BitPuffin>
so there is no difference between if and ternary if except that some ifs aren't expressions
<andrewrk>
in zig all ifs are expressions
<BitPuffin>
even if there is no else?
<andrewrk>
if there is no else then the else expression returns {} (the void value)
<BitPuffin>
but do we need mandatory () for switch, while and for, or is it just there to be consistent with ()
<BitPuffin>
if*
<BitPuffin>
I see
<BitPuffin>
Anyway, it's a minute point. more interesting to consider the only keyword I was wishing for :P
<BitPuffin>
I understand that it's more syntax to learn, and I really appreciate how much you've left out of zig
<BitPuffin>
but I think it's worth considering if a feature like this can make code much more clear in return, or maybe help track down bugs, since you could wrap something in an only block and you'll discover that it was reading global variables which you maybe didn't know etc
<BitPuffin>
and maybe you could even use it in multiple places like also when declaring procedures
<BitPuffin>
pub fn foo(a: int) int only { // this fn doesn't access any globals }
<dm1try>
and just for the confirmation, reverting 6756e54 helps
kristoff_it has quit [Ping timeout: 244 seconds]
halosghost has quit [Quit: WeeChat 2.4]
halosghost has joined #zig
dm1try has quit [Quit: Page closed]
dm1try has joined #zig
<nrdmn>
is there a reason why calls to noreturn functions aren't optimized into jmps?
dm1try has quit [Client Quit]
<BitPuffin>
andrewrk: can I read files at compile time?
qazo has joined #zig
<Sahnvour>
I think that's not possible directly, but you could have some code in your build.zig that reads the file and outputs its content as a string in a zig file, probably
<nrdmn>
have you had a look at @embedFile?
<BitPuffin>
hmm but I don't wanna store the text at compile time
<BitPuffin>
I just wanna do some processing to determine at compile time how much to preallocate certain things or whatever
<BitPuffin>
or even build game assets or something
<BitPuffin>
I guess some of that could be done in build.zig
<BitPuffin>
but would be sweet to just have some comptime block that I can use to figure out some constant by reading files and then at runtime use that value for various things
<nrdmn>
you could put that into a comptime block I guess
<BitPuffin>
ahh wait yeah true
<BitPuffin>
if I do comptime {} and use embedFile within that for a temporary that's not there after compile time it should probably work
Sahnvour_ has joined #zig
<Sahnvour_>
oh I missed @embedFile. BitPuffin as long as you have access to the content of the file at comptime, you can read it and do whatever you want, doesn't matter which way you acquire it
Sahnvour has quit [Read error: Connection reset by peer]
Sahnvour_ has quit [Quit: Leaving]
halosghost has quit [Quit: WeeChat 2.4]
mikdusan has quit [Ping timeout: 246 seconds]
mikdusan has joined #zig
TheLemonMan has joined #zig
TheLemonMan has quit [Client Quit]
SamTebbs33 has quit [Quit: Lost terminal]
wootehfoot has quit [Read error: Connection reset by peer]
<donpdonp>
i see #2207 but looking at zig-ryu seems to only have float->string not string->float ?
<tgschultz>
andrewrk: generating types has the issue that, in all but the most simplistic cases, the typename quickly becomes unreadable. Is there a significant downside or impedement to showing the type alias in use at that scope instead?
<tgschultz>
otherwise, perhaps a way to override the typename is in order, like with a builtin or something.
* donpdonp
edits local json.zig to ignore floats
<tgschultz>
donpdonp: float parsing was added in #1958
<donpdonp>
so nice to be able to tweak that without even rebuilding zig
<tgschultz>
looks like it has some issues: #2207
<tgschultz>
oh you saw taht, nevermind me
<donpdonp>
no problemo.
return0e_ has quit [Ping timeout: 246 seconds]
return0e has joined #zig
<johnLate>
Can I do something like warn("x has type […]\n, …x…) in Zig?
<tgschultz>
johnLate, you want to print the type of x?
<johnLate>
Yes
<tgschultz>
`warn("x has type {}\n", @typeName(@typeOf(x)));` ought to work